Fix prefix for non-Windows cross-builds on Windows

When one specified a prefix "/usr/qt5" on Windows for a non-Windows
target (e.g. QNX) that prefix was translated to "C:/usr/qt5" and
passed on to the Makefiles, for example as
"-Wl,-rpath,C:/usr/qt5/lib".

The reason was that we called $$absolute_path on the user-specified
prefix. However, absolute_path operates according to the rules of the
host operating system.

When cross-building, the prefix is an on-device path. Therefore we
must not attempt to make it absolute to the build directory.

The check whether we're cross-compiling looks a bit arcane, but we
cannot use $$qtConfEvaluate(features.cross_compile) at this stage of
configure. Instead, we use XSPEC (set up by qtConfOutput_prepareSpec)
and $$[QMAKE_SPEC] which is the right host mkspec.

Fixes: QTBUG-79214
Change-Id: Id8664f8512cf1d9e178054a38e72323d7929547d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Joerg Bornemann 2019-10-18 15:26:23 +02:00
parent ef9c498215
commit 73cb5cb01e

View File

@ -741,7 +741,13 @@ defineTest(qtConfOutput_preparePaths) {
}
have_prefix = false
} else {
config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD)
equals(XSPEC, $$[QMAKE_SPEC]) {
# Only make the user-specified prefix absolute if we're not cross-compiling.
config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD)
} else {
# But we still must normalize path separators.
config.input.prefix = $$replace(config.input.prefix, \\\\, /)
}
have_prefix = true
}