Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to fix path in third-party libs which usage another third-party libs after macdeployqt?
QtWS25 Last Chance

How to fix path in third-party libs which usage another third-party libs after macdeployqt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
19 Posts 5 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • shavS Offline
    shavS Offline
    shav
    wrote on last edited by shav
    #1

    Hi everyone! I have a question about deploy app with third-party lib on macOS. I have a project with a few third-party libs. And I use macdeployqt tool from Qt bin folder. This tool is coping all libs to target app bundle. That’s works fine. But in my project one third-party lib is using another lib. All libs was copied to app bundle but app doesn’t work on customer mac, because app can’t find lib. I found the problem. Some of third-party lib is usage gnutls and this is using nettle lib. When macdeployqt tool copy libs they have incorrect path. I can use install_name_tool to fix this. How I can do this recursive for all libs? Maybe some of you has a script for this? Thanks for any help.

    Mac OS and iOS Developer

    1 Reply Last reply
    1
    • C Offline
      C Offline
      Charlie_Hdz
      wrote on last edited by
      #2

      So, you're defining all the libraries in the .pro file?

      Kind Regards,
      Enrique Hernandez
      gearstech.com.mx
      chernandez@gearstech.com.mx

      shavS 1 Reply Last reply
      0
      • shavS Offline
        shavS Offline
        shav
        wrote on last edited by
        #3

        Not all. Because my application is building correct without add all libs. But I try this. Thanks.

        Mac OS and iOS Developer

        1 Reply Last reply
        0
        • C Charlie_Hdz

          So, you're defining all the libraries in the .pro file?

          shavS Offline
          shavS Offline
          shav
          wrote on last edited by
          #4

          @Charlie_Hdz I check it. And still have a problem.

          The result of tool -l command for application binary file looks like:

          andrewsh$ otool -L /Volumes/HPDD/PROJECTS/QtProjects/GIT/iOS_Device_Manager/qt/build-MatterPortBackup-Desktop_Qt_5_10_0_clang_64bit2-Production/Xtended\ Backup\ Manager.app/Contents/MacOS/Xtended\ Backup\ Manager 
          /Volumes/HPDD/PROJECTS/QtProjects/GIT/iOS_Device_Manager/qt/build-MatterPortBackup-Desktop_Qt_5_10_0_clang_64bit2-Production/Xtended Backup Manager.app/Contents/MacOS/Xtended Backup Manager:
          	/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 1450.15.0)
          	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1450.15.0)
          	@loader_path/../Frameworks/libplist.3.dylib (compatibility version 5.0.0, current version 5.0.0)
          	@loader_path/../Frameworks/libimobiledevice.6.dylib (compatibility version 7.0.0, current version 7.0.0)
          	@loader_path/../Frameworks/libgnutls.30.dylib (compatibility version 45.0.0, current version 45.8.0)
          	@loader_path/../Frameworks/libnettle.6.dylib (compatibility version 6.0.0, current version 6.4.0)
          	@loader_path/../Frameworks/libhogweed.4.dylib (compatibility version 4.0.0, current version 4.4.0)
          	@rpath/QtQuick.framework/Versions/5/QtQuick (compatibility version 5.10.0, current version 5.10.0)
          	@rpath/QtQml.framework/Versions/5/QtQml (compatibility version 5.10.0, current version 5.10.0)
          	@rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.10.0, current version 5.10.0)
          	@rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.10.0, current version 5.10.0)
          	/System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration (compatibility version 1.0.0, current version 1.0.0)
          	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
          	@rpath/QtGui.framework/Versions/5/QtGui (compatibility version 5.10.0, current version 5.10.0)
          	@rpath/QtWidgets.framework/Versions/5/QtWidgets (compatibility version 5.10.0, current version 5.10.0)
          	/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
          	/System/Library/Frameworks/AGL.framework/Versions/A/AGL (compatibility version 1.0.0, current version 1.0.0)
          	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 400.9.0)
          	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
          	/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
          

          When I try to open my application on customer Mac I receive error:

          dyld: Library not loaded: /usr/local/Cellar/nettle/3.4/lib/libnettle.6.dylib
            Referenced from: /Volumes/HPDD/PROJECTS/QtProjects/GIT/iOS_Device_Manager/qt/build-MatterPortBackup-Desktop_Qt_5_10_0_clang_64bit2-Production/Xtended Backup Manager.app/Contents/Frameworks/libhogweed.4.dylib
            Reason: image not found
          Abort trap: 6
          

          But, as you can see the library libhogweed and libnettle has correct path for application binary file. If I try to use tool -l for library libhogweed I get this result:

          andrewsh$ otool -L /Volumes/HPDD/PROJECTS/QtProjects/GIT/iOS_Device_Manager/qt/build-MatterPortBackup-Desktop_Qt_5_10_0_clang_64bit2-Production/Xtended\ Backup\ Manager.app/Contents/Frameworks/libhogweed.4.dylib 
          /Volumes/HPDD/PROJECTS/QtProjects/GIT/iOS_Device_Manager/qt/build-MatterPortBackup-Desktop_Qt_5_10_0_clang_64bit2-Production/Xtended Backup Manager.app/Contents/Frameworks/libhogweed.4.dylib:
          	@executable_path/../Frameworks/libhogweed.4.dylib (compatibility version 4.0.0, current version 4.4.0)
          	/usr/local/Cellar/nettle/3.4/lib/libnettle.6.dylib (compatibility version 6.0.0, current version 6.4.0)
          	@loader_path/libgmp.10.dylib (compatibility version 14.0.0, current version 14.2.0)
          	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.0.0)
          

          As you can see the problem in incorrect path for libhogweed which usage libnettle.

          Mac OS and iOS Developer

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Charlie_Hdz
            wrote on last edited by
            #5

            Has your computer this library path, right?

            /Volumes/HPDD/PROJECTS/QtProjects/GIT/iOS_Device_Manager/qt/build-MatterPortBackup-Desktop_Qt_5_10_0_clang_64bit2-Production/Xtended
            

            Does your customer Mac has the same path?

            Kind Regards,
            Enrique Hernandez
            gearstech.com.mx
            chernandez@gearstech.com.mx

            1 Reply Last reply
            0
            • shavS Offline
              shavS Offline
              shav
              wrote on last edited by
              #6

              No. This example from my another Mac where I have the same path for application.

              Mac OS and iOS Developer

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Charlie_Hdz
                wrote on last edited by
                #7

                Ok, maybe you need to explicitly set the libraries path from your customer, also, maybe they're being shared implicitly.

                Kind Regards,
                Enrique Hernandez
                gearstech.com.mx
                chernandez@gearstech.com.mx

                1 Reply Last reply
                0
                • shavS Offline
                  shavS Offline
                  shav
                  wrote on last edited by
                  #8

                  Ok, I will try to find another way how to fix the path for customer.

                  Mac OS and iOS Developer

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi,

                    You should run ma deploy Qt with the verbose option on to see what is happening with these external libraries.

                    If it’s only this one you can copy it by hand and run install_name_tool on it.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      florent_lightingsoft
                      wrote on last edited by
                      #10

                      Hello
                      i have actually same problem with same Library :

                      Dyld Error Message:
                        Library not loaded: /usr/local/Cellar/nettle/3.3/lib/libnettle.6.dylib
                        Referenced from: /private/var/folders/8h/6gwsfzvd0497x5v7dqkf6dg80000gp/T/AppTranslocation/AC4CC981-7245-4236-9929-4EF95D0225B1/d/StoreUpgradeTools.app/Contents/Frameworks/libhogweed.4.dylib
                        Reason: image not found
                      

                      Did you fixe it ?

                      shavS 1 Reply Last reply
                      0
                      • F florent_lightingsoft

                        Hello
                        i have actually same problem with same Library :

                        Dyld Error Message:
                          Library not loaded: /usr/local/Cellar/nettle/3.3/lib/libnettle.6.dylib
                          Referenced from: /private/var/folders/8h/6gwsfzvd0497x5v7dqkf6dg80000gp/T/AppTranslocation/AC4CC981-7245-4236-9929-4EF95D0225B1/d/StoreUpgradeTools.app/Contents/Frameworks/libhogweed.4.dylib
                          Reason: image not found
                        

                        Did you fixe it ?

                        shavS Offline
                        shavS Offline
                        shav
                        wrote on last edited by
                        #11

                        @florent_lightingsoft
                        Yes, but you need to do this for every lib which generate this error.

                        install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" lib_path_for_update
                        install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" app_binnary_path_for_update
                        

                        If you find a way to use this commands for all lib and sub-libs by script let me know, because for now I use this for every lib manually.

                        Mac OS and iOS Developer

                        N 1 Reply Last reply
                        1
                        • shavS shav

                          @florent_lightingsoft
                          Yes, but you need to do this for every lib which generate this error.

                          install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" lib_path_for_update
                          install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" app_binnary_path_for_update
                          

                          If you find a way to use this commands for all lib and sub-libs by script let me know, because for now I use this for every lib manually.

                          N Offline
                          N Offline
                          ngn999
                          wrote on last edited by
                          #12

                          @shav said in How to fix path in third-party libs which usage another third-party libs after macdeployqt?:

                          @florent_lightingsoft
                          Yes, but you need to do this for every lib which generate this error.

                          install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" lib_path_for_update
                          install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" app_binnary_path_for_update
                          

                          If you find a way to use this commands for all lib and sub-libs by script let me know, because for now I use this for every lib manually.

                          it's 2022, same problem here. any solution?

                          N 1 Reply Last reply
                          0
                          • N ngn999

                            @shav said in How to fix path in third-party libs which usage another third-party libs after macdeployqt?:

                            @florent_lightingsoft
                            Yes, but you need to do this for every lib which generate this error.

                            install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" lib_path_for_update
                            install_name_tool -change "old_path" "@executable_path/../Frameworks/lib_name" app_binnary_path_for_update
                            

                            If you find a way to use this commands for all lib and sub-libs by script let me know, because for now I use this for every lib manually.

                            it's 2022, same problem here. any solution?

                            N Offline
                            N Offline
                            ngn999
                            wrote on last edited by ngn999
                            #13

                            I'm sure it's about this bug:
                            https://bugreports.qt.io/browse/QTBUG-56814

                            but the fix is not complete, it can't deal with some libraries , such as ffmpeg and nettle.

                            I made a bugfix here: https://github.com/ngn999/qttools/commit/5be4d44508c3a8b4d739de30929d9158b84b4e50

                            based on 6.2.4.

                            SGaistS 1 Reply Last reply
                            1
                            • N ngn999

                              I'm sure it's about this bug:
                              https://bugreports.qt.io/browse/QTBUG-56814

                              but the fix is not complete, it can't deal with some libraries , such as ffmpeg and nettle.

                              I made a bugfix here: https://github.com/ngn999/qttools/commit/5be4d44508c3a8b4d739de30929d9158b84b4e50

                              based on 6.2.4.

                              SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #14

                              @ngn999 hi and welcome to devnet,

                              Would you make a submission to the official repo so it can be integrated for all ? :-)

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              N 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                @ngn999 hi and welcome to devnet,

                                Would you make a submission to the official repo so it can be integrated for all ? :-)

                                N Offline
                                N Offline
                                ngn999
                                wrote on last edited by
                                #15

                                @SGaist yes, I submit a pull request to 6.2.4 https://github.com/qt/qttools/pull/5

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #16

                                  GitHub is just a mirror. Here you can find the procedure to get you started. Don't worry about the size of the page, it's just very detailed instructions :-)

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  N 2 Replies Last reply
                                  0
                                  • SGaistS SGaist

                                    GitHub is just a mirror. Here you can find the procedure to get you started. Don't worry about the size of the page, it's just very detailed instructions :-)

                                    N Offline
                                    N Offline
                                    ngn999
                                    wrote on last edited by
                                    #17

                                    @SGaist OK. I'll look at it.

                                    1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      GitHub is just a mirror. Here you can find the procedure to get you started. Don't worry about the size of the page, it's just very detailed instructions :-)

                                      N Offline
                                      N Offline
                                      ngn999
                                      wrote on last edited by ngn999
                                      #18

                                      @SGaist I have submitted one code review: https://codereview.qt-project.org/c/qt/qtbase/+/405490

                                      by the way, the workflow is complex.

                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #19

                                        Thanks !

                                        I also found it the first time but it quickly becomes easier.

                                        You forgot to add reviewers. Usually the best is to check the persons that reviewed the submissions applied to the file you changed.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved