From 6c222297ab19e1bc6b74c4290446c1cb61f6fda8 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Mon, 19 Oct 2015 23:52:10 +0200 Subject: [PATCH] Make -no-rpath build more useful on Apple platforms [ChangeLog][Platform Specific Changes][OS X] Configure with -no-rpath will now yield Qt dynamic libraries and frameworks with an absolute install name (based in -libdir). OS X package managers like Homebrew install Qt in a fixed location. This change simplifies deployment for such package managers and is consistent with the default expectation on Apple platforms for libraries with a fixed location to also have absolute install names. While a relocatable installation (the default) also works in this scenario, it requires all software that depends on Qt to be aware of this and to embed a suitable RPATH into application binaries (which is not automatic for non-qmake builds). This might not be true for some select fallback search locations, but as package managers on OS X tend not to use those, embedding an RPATH becomes practically mandatory. In a default Homebrew installation, Qt is configured such that the frameworks end up in /usr/local/Cellar/qt5//lib and that will be later symlinked to /usr/local/opt/qt5/lib, both of which are not searched by the dynamic linker by default. Task-number: QTBUG-48958 Change-Id: I4395df98771e06a2ce8a293d11dc755bdc50757f Reviewed-by: Oswald Buddenhagen --- configure | 4 +++- mkspecs/features/qt_module.prf | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure b/configure index cea62fb..c29c113 100755 --- configure +++ configure @@ -2557,7 +2557,9 @@ Additional options: -l ........ Add an explicit library. -no-rpath .......... Do not use the library install path as a runtime - library path. + library path. On Apple platforms, this implies using + absolute install names (based in -libdir) for dynamic + libraries and frameworks. + -rpath ............. Link Qt libraries and executables using the library install path as a runtime library path. Equivalent to -R install_libpath diff --git a/mkspecs/features/qt_module.prf b/mkspecs/features/qt_module.prf index c89b6d2..f187b85 100644 --- mkspecs/features/qt_module.prf +++ mkspecs/features/qt_module.prf @@ -135,6 +135,8 @@ mac { contains(QT_CONFIG, rpath): \ QMAKE_SONAME_PREFIX = @rpath + else: \ + CONFIG += absolute_library_soname } DEFINES += QT_BUILDING_QT -- 2.6.2.2.g1b5ffa3