Qt World Summit: Register Today!

macdeployqt: specify framework location?

  • When I run macdeployqt (using Qt 4.8.6), I get the following errors:

    ERROR: no file at "/Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit" 
    ERROR: no file at "/Library/Frameworks/QtGui.framework/Versions/4/QtGui" 
    ERROR: no file at "/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork" 
    ERROR: no file at "/Library/Frameworks/QtCore.framework/Versions/4/QtCore" 

    The frameworks are not installed under /Library/Frameworks; I have them installed elsewhere.

    I suspect the problem is related to the fact that the references to these frameworks in the executable are not absolute:

    $ otool -L Foo.app/Contents/MacOS/Foo
    	/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1151.16.0)
    	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)
    	/usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    	/usr/lib/libpam.2.dylib (compatibility version 3.0.0, current version 3.0.0)
    	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    	/usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    	QtWebKit.framework/Versions/4/QtWebKit (compatibility version 4.9.0, current version 4.9.4)
    	QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.6)
    	QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.6)
    	QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.6)
    	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)

    How do I tell macdeployqt that these frameworks live somewhere else?

    Alternatively, how might I get absolute references to these frameworks in the executable?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Maybe a silly question but are you sure you are using the correct macdeployqt ?
    Did you build Qt yourself ?

  • @SGaist Yes, I built Qt myself. And, yes, I am certain that the macdeployqt I built is the one I'm using.

  • Lifetime Qt Champion

    Where is your self-built Qt 4 installed ?

  • @SGaist Wherever I want it to be.

    I tar up the output of make install and I have a script that calls install_name_tool and adjusts the dependency references for the executables and frameworks in the distribution to point to the installation location (i.e., where the tarball is extracted). Also, qtinstalldir/bin/qt.conf is written to point to the installation location.

  • I could give you an upgraded version of macdeployqt which could deploy any kind of Mac OS modules - executables, frameworks, bundles, dynamically linked libraries (dylibs), statically linked such. It could help.

  • @napajejenunedk0 Thank you for the offer. Is this something that's part of a newer Qt distribution, or something you've customized?

    At this point, I've more-or-less reimplemented macdeployqt myself as a CMake script. It probably doesn't cover all the bases that your macdeployqt does; but it does what I need it to do.

    As noted, I'm using Qt 4.8.6. I should have the opportunity to upgrade to something more recent soon. I'll revisit "official" macdeployqt then and file a bug report if I still encounter problems. It does seem to me the inability to tell macdeployqt where to look for the Qt frameworks is a rather significant missing feature; and the fact that it's looking for those frameworks somewhere other than where the tool itself is using them seems like a bug.

  • "Is this something that's part of a newer Qt distribution, or something you've customized?"
    My customization that I wanted to contribute as well but there were obstacles that prevented this. The customized macdeployqt could be given additional include paths where to search for dependencies, so I think it could help you solve your case.