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. macdeployqt does not properly remap libs?
QtWS25 Last Chance

macdeployqt does not properly remap libs?

Scheduled Pinned Locked Moved Solved General and Desktop
macdeployqt
2 Posts 1 Posters 502 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 22 Jun 2022, 19:56 last edited by
    #1

    Hey

    I'm trying to figure out why macdeploy skips half of the dependencies in my app and why despite dylib being in the file is not being found by other libs...
    I've started going over all files in my bundle and running otool -L on them.
    I noticed some strange things, some libs were not remapped properly to usen executable folder:

    appTest.app/Contents/MacOS/appTest:
    	@rpath/QtNetwork.framework/Versions/A/QtNetwork (compatibility version 6.0.0, current version 6.3.0)
    	@rpath/QtConcurrent.framework/Versions/A/QtConcurrent (compatibility version 6.0.0, current version 6.3.0)
    	@rpath/QtOpenGLWidgets.framework/Versions/A/QtOpenGLWidgets (compatibility version 6.0.0, current version 6.3.0)
    	/opt/homebrew/opt/openimageio/lib/libOpenImageIO.2.3.dylib (compatibility version 2.3.0, current version 2.3.16)
    	/opt/homebrew/opt/openimageio/lib/libOpenImageIO_Util.2.3.dylib (compatibility version 2.3.0, current version 2.3.16)
    	/opt/homebrew/opt/imath/lib/libImath-3_1.29.dylib (compatibility version 29.0.0, current version 29.4.0)
    	@rpath/QtWidgets.framework/Versions/A/QtWidgets (compatibility version 6.0.0, current version 6.3.0)
    	@rpath/QtOpenGL.framework/Versions/A/QtOpenGL (compatibility version 6.0.0, current version 6.3.0)
    	@rpath/QtGui.framework/Versions/A/QtGui (compatibility version 6.0.0, current version 6.3.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)
    	/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 2113.40.126)
    	/System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO (compatibility version 1.0.0, current version 1.0.0)
    	/System/Library/Frameworks/Metal.framework/Versions/A/Metal (compatibility version 1.0.0, current version 261.13.0)
    	@rpath/QtCore.framework/Versions/A/QtCore (compatibility version 6.0.0, current version 6.3.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)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)
    	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 1300.23.0)
    

    I'm having /opt/homebrew/opt/openimageio/lib/libOpenImageIO.2.3.dylib on quite a few dylib's and main app executable...
    Is this a bug? Or how should I tell it to remap it?
    He did copy the dylib properly to contents/frameworks/xx.dylib, but he did not link against it...
    any ideas? My own dylib that I generate gets linked properly, but the file above does not.

    I'm also having issue with this one :

    testApp.app/Contents/Frameworks/libavformat.58.dylib:
    	@executable_path/../Frameworks/libavformat.58.dylib (compatibility version 58.0.0, current version 58.76.100)
    	/opt/homebrew/Cellar/ffmpeg@4/4.4.2_2/lib/libavcodec.58.dylib (compatibility version 58.0.0, current version 58.134.100)
    	/opt/homebrew/Cellar/ffmpeg@4/4.4.2_2/lib/libswresample.3.dylib (compatibility version 3.0.0, current version 3.9.100)
    

    Hes linking against /opt/homebrew instead of the one copied to frameworks ?

    It looks that anything that comes via brew find_packages is not linked properly, and anything that comes through it is not recursively iterated. Say if I include OpenImageIO, that includes libavformat that includes libswresample then libavcodec does not get remapped properly for libswresample?

    I'm about to write python script to re-link everything, but I have a feeling that this should be recursively all re-linked to proper project-relative-location path...?

    1 Reply Last reply
    0
    • D Offline
      D Offline
      Dariusz
      wrote on 23 Jun 2022, 09:38 last edited by Dariusz
      #2

      Ok I got it working.
      To suimmarize
      macdeployqt did not relink all files properly. In order to fix it I ended up

      1. Loop over all frameworks in my bundle
      2. otool -chant oldPath newPath targetDylib file
      3. codesign --force --timestamp --sign "FSDVASDVASDVASVSA" dylibPath

      codesign stamp taken from security find-identity -v -p codesigning

      I looped over frameworks 1st, then extra libs, then target executable at the end. Apparently all this has to happen in order.
      After that both ARM and Intel build start.
      ARM is very sensitive with code signing apparently. Hope this helps the next poor soul wanted to use cmake on mac.

      EDIT1.
      There is more to this answer...
      Once. you re-path the dylibs... then you need to sign them, ideally with -option runtime. Then you need zip it all and send to apple for notarization... there is WWDC talk in 2019 that introduces the concept/explains why and in 2021 (I think) another video that shows new APi to do it all in 1 command. - well mostly.
      In any case you need to notarize ur app & then stamp. So that any mac can run it without warning... lots of FUN TIME APPPLE. But at least its provided by apple and work nicely as opposed to Microsoft signing bananas ;/// Microsoft u officially sux.

      1 Reply Last reply
      1

      1/2

      22 Jun 2022, 19:56

      • Login

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