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. [Solved]install_name_tool of mac can't change the id

[Solved]install_name_tool of mac can't change the id

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 6.3k 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.
  • S Offline
    S Offline
    stereomatching
    wrote on last edited by
    #1

    I need to let the app know where to find the 3rd party dylib
    Study a lot of data but still don't get it

    With the help of otool
    @otool -L imageInterpolation.app/Contents/MacOS/imageInterpolation@

    otool give me the following message of the 3rd party dylib
    @lib/libopencv_core.2.4.dylib (compatibility version 2.4.0, current version 2.4.3)@
    I suppose this is the original id of the dylib?

    To tell the app how to link to the dylib
    First, create a folder inside the app

    change the id of the dylib by the install_name_tool

    @install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.3.dylib lib/libopencv_core.2.4.dylib@

    But this would pop out error message

    install_name_tool: can't open file: lib/libopencv_core.2.4.3.dylib (No such file or directory)

    To solve the problems, I copy the dylib "libopencv_core.2.4.3.dylib" to "/lib"
    and change the name to "libopencv_core.2.4.dylib"

    Run the command
    @install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.3.dylib /lib/libopencv_core.2.4.dylib"@

    This time, no error or warning, but the id remain the same
    That is, When I run the otool

    @otool -L imageInterpolation.app/Contents/MacOS/imageInterpolation@

    The result is
    @lib/libopencv_core.2.4.dylib (compatibility version 2.4.0, current version 2.4.3)@

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      I change the command
      @
      cp /usr/local/lib/libopencv_core.2.4.3.dylib /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks

      install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.3.dylib \ /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks/libopencv_core.2.4.3.dylib
      @

      But the id remain the same, nothing change
      This time I didn't use the option of -change because
      I don't know how to use it

      1 Reply Last reply
      0
      • S Offline
        S Offline
        stereomatching
        wrote on last edited by
        #3

        I solved it, thanks to the link
        "solution":http://www.dafscollaborative.org/opencv-deploy.html

        my script
        @
        #!/bin/bash

        mkdir imageInterpolation.app/Contents/Frameworks

        cp /Users/Qt/program/commercial_apps/imageInterpolation/release/libimageViewer.1.0.0.dylib /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks
        mv /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks/libimageViewer.1.0.0.dylib
        /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib

        source ~/.mybash_profile #macdeployqt path

        macdeployqt /Users/Qt/program/commercial_apps/imageInterpolation/imageInterpolation.app -verbose=2 -dmg

        #openCV libraries***********

        #update openCV id*******#

        install_name_tool -id @executable_path/../Frameworks/libopencv_core.2.4.dylib imageInterpolation.app/Contents/Frameworks/libopencv_core.2.4.dylib
        install_name_tool -id @executable_path/../Frameworks/libopencv_highgui.2.4.dylib imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib
        install_name_tool -id @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib imageInterpolation.app/Contents/Frameworks/libopencv_imgproc.2.4.dylib
        #install_name_tool -id @executable_path/../Frameworks/libopencv_photo.2.4.dylib imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib

        #change openCV libraries references*******#

        install_name_tool -change lib/libopencv_core.2.4.dylib @executable_path/../Frameworks/libopencv_core.2.4.dylib "imageInterpolation.app/Contents/MacOS/imageInterpolation"
        install_name_tool -change lib/libopencv_highgui.2.4.dylib @executable_path/../Frameworks/libopencv_highgui.2.4.dylib "imageInterpolation.app/Contents/MacOS/imageInterpolation"
        install_name_tool -change lib/libopencv_imgproc.2.4.dylib @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib "imageInterpolation.app/Contents/MacOS/imageInterpolation"
        install_name_tool -change lib/libopencv_photo.2.4.dylib @executable_path/../Frameworks/libopencv_photo.2.4.dylib "imageInterpolation.app/Contents/MacOS/imageInterpolation"

        #change openCV internal libraries cross-references*******#

        install_name_tool -change lib/libopencv_core.2.4.dylib @executable_path/../Frameworks/libopencv_core.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib"
        install_name_tool -change lib/libopencv_imgproc.2.4.dylib @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libopencv_highgui.2.4.dylib"

        install_name_tool -change lib/libopencv_core.2.4.dylib @executable_path/../Frameworks/libopencv_core.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libopencv_imgproc.2.4.dylib"

        install_name_tool -change lib/libopencv_core.2.4.dylib @executable_path/../Frameworks/libopencv_core.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib"
        install_name_tool -change lib/libopencv_imgproc.2.4.dylib @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libopencv_photo.2.4.dylib"

        #******self created library sc = self created

        #update sc id*******#

        install_name_tool -id @executable_path/../Frameworks/libimageViewer.1.dylib imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib

        #change sc libraries references*******#

        install_name_tool -change libimageViewer.1.dylib @executable_path/../Frameworks/libimageViewer.1.dylib "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

        #change sc internal libraries cross-references*******#

        install_name_tool -change lib/libopencv_core.2.4.dylib @executable_path/../Frameworks/libopencv_core.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"
        install_name_tool -change lib/libopencv_highgui.2.4.dylib @executable_path/../Frameworks/libopencv_highgui.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"
        install_name_tool -change lib/libopencv_imgproc.2.4.dylib @executable_path/../Frameworks/libopencv_imgproc.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"
        install_name_tool -change lib/libopencv_photo.2.4.dylib @executable_path/../Frameworks/libopencv_photo.2.4.dylib "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

        install_name_tool -change /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtWidgets.framework/Versions/5/QtWidgets
        @executable_path/../Frameworks/QtWidgets.framework/Versions/5/QtWidgets
        "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

        install_name_tool -change /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtGui.framework/Versions/5/QtGui
        @executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui
        "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

        install_name_tool -change /Users/yyyy/Qt5.0.1/5.0.1/clang_64/lib/QtCore.framework/Versions/5/QtCore
        @executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore
        "imageInterpolation.app/Contents/Frameworks/libimageViewer.1.dylib"

        exit 0
        @

        Whatever, this solution is hack, deploy third parties or self created dylib on mac
        is very inconvenient

        1 Reply Last reply
        0
        • L Offline
          L Offline
          leo150
          wrote on last edited by leo150
          #4

          I know it's old post but I had troubles with qt + mac + opencv deploy
          Here is final version of simple bruteforce script:
          http://pastebin.com/uwr0z9YY

          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