make mkspecs not mess up -rpath-link

adding shared install paths via QMAKE_LFLAGS in the spec has the tiny
side effect that they are searched _first_, which is generally a really
bad idea - they should be _last_.

for that purpose, introduce QMAKE_RPATHLINKDIR_POST, and migrate all
specs to use it.

QMAKE_RPATHDIR_POST is added for consistency, but not actually used.

Task-number: QTBUG-59457
Change-Id: Iac6cda5e9111ef8cca454a69861fe8408bb40589
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Oswald Buddenhagen 2017-05-16 18:06:24 +02:00
parent 6dcd944dee
commit 5afde92bd7
13 changed files with 37 additions and 34 deletions

View File

@ -40,7 +40,7 @@ isEmpty(QNX_DIR) {
QMAKE_INCDIR_POST = $${QNX_DIR}/usr/include $${QNX_DIR}/usr/include/freetype2
QMAKE_LIBDIR_POST = $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib
QMAKE_LFLAGS += -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/lib -Wl,-rpath-link,$${QNX_DIR}/$${QNX_CPUDIR}/usr/lib
QMAKE_RPATHLINKDIR_POST += $${QNX_DIR}/$${QNX_CPUDIR}/lib $${QNX_DIR}/$${QNX_CPUDIR}/usr/lib
QMAKE_CXXFLAGS_CXX11 = -Wc,-std=gnu++11
QMAKE_CXXFLAGS_CXX14 = -Wc,-std=gnu++1y

View File

@ -3,8 +3,9 @@ defineTest(qtConfSanitizeMkspec) {
}
contains(DISTRO_OPTS, deb-multi-arch) {
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP}
QMAKE_RPATHLINKDIR_POST += \
$$[QT_SYSROOT]/usr/lib/$${GCC_MACHINE_DUMP} \
$$[QT_SYSROOT]/lib/$${GCC_MACHINE_DUMP}
}
contains(DISTRO_OPTS, boot2qt) {

View File

@ -26,11 +26,11 @@ QMAKE_LIBDIR_POST += \
$$[QT_SYSROOT]/lib/aarch64-linux-gnu \
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu
QMAKE_LFLAGS += \
-Wl,-rpath-link,$${VIBRANTE_SDK_TOPDIR}/lib-target \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu
QMAKE_RPATHLINKDIR_POST += \
$${VIBRANTE_SDK_TOPDIR}/lib-target \
$$[QT_SYSROOT]/usr/lib \
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
$$[QT_SYSROOT]/lib/aarch64-linux-gnu
DISTRO_OPTS += aarch64

View File

@ -20,10 +20,10 @@ QMAKE_LIBDIR_POST += \
$$[QT_SYSROOT]/lib/arm-linux-gnueabihf \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf
QMAKE_LFLAGS += \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
QMAKE_RPATHLINKDIR_POST += \
$$[QT_SYSROOT]/usr/lib \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
DISTRO_OPTS += hard-float
COMPILER_FLAGS += -mtune=cortex-a15 -march=armv7-a -mfpu=neon-vfpv4

View File

@ -24,11 +24,11 @@ QMAKE_LIBDIR_POST += \
$$[QT_SYSROOT]/lib/arm-linux-gnueabihf \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf
QMAKE_LFLAGS += \
-Wl,-rpath-link,$${VIBRANTE_SDK_TOPDIR}/lib-target \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
QMAKE_RPATHLINKDIR_POST += \
$${VIBRANTE_SDK_TOPDIR}/lib-target \
$$[QT_SYSROOT]/usr/lib \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
DISTRO_OPTS += hard-float
COMPILER_FLAGS += -mtune=cortex-a15 -march=armv7-a -mfpu=neon-vfpv4 -DWIN_INTERFACE_CUSTOM

View File

@ -34,11 +34,11 @@ QMAKE_LIBDIR_POST += \
$$[QT_SYSROOT]/lib/aarch64-linux-gnu \
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu
QMAKE_LFLAGS += \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu/tegra \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/aarch64-linux-gnu
QMAKE_RPATHLINKDIR_POST += \
$$[QT_SYSROOT]/usr/lib \
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu \
$$[QT_SYSROOT]/usr/lib/aarch64-linux-gnu/tegra \
$$[QT_SYSROOT]/lib/aarch64-linux-gnu
DISTRO_OPTS += aarch64
COMPILER_FLAGS += -mtune=cortex-a57.cortex-a53 -march=armv8-a

View File

@ -54,8 +54,7 @@ QMAKE_LIBS_EGL =
QMAKE_INCDIR_POST += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
QMAKE_LIBDIR_POST += $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
QMAKE_LFLAGS += -Wl,-rpath-link,$$QMAKE_LIBDIR_OPENGL_ES2 -Wl,-rpath-link,$${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
QMAKE_RPATHLINKDIR_POST += $$QMAKE_LIBDIR_OPENGL_ES2 $${BRCM_APPLIBS_PATH}/opensource/zlib/zlib-1.2.3
# DirectFB platform hooks for this hardware
QT_CONFIG += directfb_egl egl

View File

@ -4,7 +4,7 @@
include(../common/linux_device_pre.conf)
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2

View File

@ -2,7 +2,7 @@
include(../common/linux_device_pre.conf)
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_OPENGL_ES2 = $$[QT_SYSROOT]/opt/vc/lib
QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2

View File

@ -8,13 +8,12 @@ include(../common/linux_device_pre.conf)
# and possibly no pkg-config, have some static values as well:
# I consider it a bug that this is required, but our EGL config.test _requires_ it
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/opt/vc/lib
QMAKE_RPATHLINKDIR_POST += $$[QT_SYSROOT]/opt/vc/lib
VC_LIBRARY_PATH = /opt/vc/lib
VC_INCLUDE_PATH = =/opt/vc/include
# terrible, they do not appear to resolve "=" in rpath!
VC_LINK_LINE = -L=$${VC_LIBRARY_PATH} -Wl,-rpath-link,$$[QT_SYSROOT]$${VC_LIBRARY_PATH}
VC_LINK_LINE = -L=$${VC_LIBRARY_PATH}
QMAKE_LIBDIR_OPENGL_ES2 = =$${VC_LIBRARY_PATH}
QMAKE_LIBDIR_EGL = $$QMAKE_LIBDIR_OPENGL_ES2

View File

@ -27,7 +27,8 @@ QMAKE_OBJCOPY = $${CROSS_COMPILE}objcopy
QMAKE_NM = $${CROSS_COMPILE}nm -P
QMAKE_STRIP = $${CROSS_COMPILE}strip
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
QMAKE_RPATHLINKDIR_POST += \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabihf \
$$[QT_SYSROOT]/lib/arm-linux-gnueabihf
load(qt_config)

View File

@ -16,9 +16,10 @@ QMAKE_LIBDIR_POST += $$[QT_SYSROOT]/usr/lib \
$$[QT_SYSROOT]/lib/arm-linux-gnueabi \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi
QMAKE_LFLAGS += -Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib \
-Wl,-rpath-link,$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi \
-Wl,-rpath-link,$$[QT_SYSROOT]/lib/arm-linux-gnueabi
QMAKE_RPATHLINKDIR_POST += \
$$[QT_SYSROOT]/usr/lib \
$$[QT_SYSROOT]/usr/lib/arm-linux-gnueabi \
$$[QT_SYSROOT]/lib/arm-linux-gnueabi
TEGRA2_CFLAGS = -mtune=cortex-a9 -march=armv7-a -mhard-float -mfloat-abi=softfp -mfpu=vfpv3-d16
QMAKE_CFLAGS += $$TEGRA2_CFLAGS

View File

@ -96,6 +96,8 @@ UnixMakefileGenerator::init()
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PREBIND");
project->values("QMAKE_INCDIR") += project->values("QMAKE_INCDIR_POST");
project->values("QMAKE_LIBDIR") += project->values("QMAKE_LIBDIR_POST");
project->values("QMAKE_RPATHDIR") += project->values("QMAKE_RPATHDIR_POST");
project->values("QMAKE_RPATHLINKDIR") += project->values("QMAKE_RPATHLINKDIR_POST");
if(!project->isEmpty("QMAKE_INCDIR"))
project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR");
ProStringList ldadd;