Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.2.0
-
None
-
Mac OS X 10.8 (Moutain Lion), 10.9 (Mavericks), clang compiler, Qt 5.x.x
Description
Summary
When building and delivering apps for OS X users expect self contained app bundles. This meaning all depending libraries and frameworks not provided by the system should be delivered within the app bundle.
To enable libraries to be location independent install names should be @rpath based (see Mike Ash article).
Qt proposes a post-build step using macdeployqt modifying the install names of Qt frameworks. Setting up such a post build step for bigger projects is inconvenient, macdeployqt is not built with 32bit Qt and this build step should not be necessary if Qt frameworks were built with @rpath based install names.
Steps to reproduce
Build Qt with @rpath based install names:
- download or check out the source code
- add "QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/" to macx make specs:
qtbase/mkspecs/macx-clang/qmake.conf
# # qmake configuration for Clang on OS X # MAKEFILE_GENERATOR = UNIX CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname QMAKE_INCREMENTAL_STYLE = sublib include(../common/macx.conf) include(../common/gcc-base-mac.conf) include(../common/clang.conf) include(../common/clang-mac.conf) QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.6 QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ load(qt_config)
qtbase/mkspecs/macx-clang-32/qmake.conf# # qmake configuration for 32-bit Clang on OS X # MAKEFILE_GENERATOR = UNIX CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname QMAKE_INCREMENTAL_STYLE = sublib include(../common/mac.conf) include(../common/gcc-base-macx.conf) include(../common/clang.conf) include(../common/clang-mac.conf) include(../common/mac-minimum-version.conf) QMAKE_LFLAGS_SONAME = -Wl,-install_name,@rpath/ QMAKE_CFLAGS += -arch i386 QMAKE_OBJECTIVE_CFLAGS += -arch i386 QMAKE_CXXFLAGS += -arch i386 QMAKE_LFLAGS += -arch i386 load(qt_config)
- build Qt for 64bit (x86_64):
$ ../qt5-source/configure -opensource -confirm-license -prefix /opt/qt5/5.2.1beta/x86_64 -xplatform macx-clang -no-c++11 -no-glib -no-dbus -nomake tests -nomake examples $ make -j8
and 32bit (i386):
$ ../qt5-source/configure -opensource -confirm-license -prefix /opt/qt5/5.2.1beta/i386 -xplatform macx-clang-32 -no-c++11 -no-glib -no-dbus -nomake tests -nomake examples $ make -j8
- use otool to check the install names of the built libraries
Expected behavior
otool should reveal @rpath based install names.
Discovered behavior
- on i386 target (32bit):
$ otool -L /opt/qt5/5.2.1beta/i386/lib/QtNetwork.framework/QtNetwork /opt/qt5/5.2.1beta/i386/lib/QtNetwork.framework/QtNetwork: @rpath/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.2.0, current version 5.2.1) @rpath/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.1) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.11.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 453.19.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.18.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 57.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
- on x86_64 target (64bit):
$ otool -L /opt/qt5/5.2.1beta/x86_64/lib/QtNetwork.framework/QtNetwork /opt/qt5/5.2.1beta/x86_64/lib/QtNetwork.framework/QtNetwork: @rpath//opt/qt5/5.2.1beta/x86_64/lib/QtNetwork.framework/Versions/5/QtNetwork (compatibility version 5.2.0, current version 5.2.1) @rpath//opt/qt5/5.2.1beta/x86_64/lib/QtCore.framework/Versions/5/QtCore (compatibility version 5.2.0, current version 5.2.1) /System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.11.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5) /System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration (compatibility version 1.0.0, current version 453.19.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.18.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 57.0.0) /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
Regression
This behavior was tested and seen with all Qt 5.x versions.
Notes
After quick analyzing the code the problem seems to originate from qmake.
Attachments
Issue Links
- relates to
-
QTBUG-31814 Qt 4.x and Qt 5 frameworks should use @rpath
- Closed