ptest: fix build issue with qtbase tests

ptest build had a subtle problem with qtbase where it was using
Qt6BuildInternals package from native sysroot instead of the target
install path. This could add compiler flags that were not supported
for the target architecture:
  cc1plus: error: '-fcf-protection=full' is not supported for this target

QT_ADDITIONAL_PACKAGES_PREFIX_PATH is not used in qtbase/CMakeLists.txt:
  find_package(Qt6 REQUIRED COMPONENTS BuildInternals CMAKE_FIND_ROOT_PATH_BOTH)
so the current approach for using Qt from the install path was not working.

Change the ptest build from using QT_ADDITIONAL_PACKAGES_PREFIX_PATHs
to using separate cmake toolchain file that prepends the install path
to CMAKE_FIND_ROOT_PATH, which makes CMake find the target Qt packages
correctly.

Change-Id: Idc99a26577886208b85bafe811f61538bb38d5bc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit b6a93fbdb6)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Samuli Piippo 2022-06-09 07:51:07 +00:00 committed by Qt Cherry-pick Bot
parent aa5af918fd
commit b0ff266efb

View File

@ -7,6 +7,11 @@ QT_PTEST_ENABLED ?= "${@bb.utils.contains('DISTRO_FEATURES', 'ptest', '1', '0',
PTEST_ENABLED = "${QT_PTEST_ENABLED}"
fakeroot do_install_ptest() {
cat >${WORKDIR}/toolchain-ptest.cmake <<EOF
include(${WORKDIR}/toolchain.cmake)
list(PREPEND CMAKE_FIND_ROOT_PATH ${D})
EOF
if [ -n "${OE_QMAKE_QMAKE}" ]; then
# qmake project
B_PTEST=${B}
@ -21,13 +26,13 @@ fakeroot do_install_ptest() {
cd ${B_PTEST}
cmake \
${OECMAKE_GENERATOR_ARGS} \
-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake \
-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain-ptest.cmake \
-DPython3_EXECUTABLE=${PYTHON} \
${EXTRA_OECMAKE} \
-DQT_BUILD_STANDALONE_TESTS=ON \
-DQT_ADDITIONAL_PACKAGES_PREFIX_PATH="${D}${QT6_INSTALL_LIBDIR}/cmake;${RECIPE_SYSROOT}/${QT6_INSTALL_LIBDIR}/cmake" \
-DCMAKE_STAGING_PREFIX=${D}${prefix} \
-DCMAKE_SKIP_RPATH=ON \
-DQT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES=ON \
${S} \
-Wno-dev
${CMAKE_VERBOSE} cmake --build ${B_PTEST} --target all