Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt6: improve cross-compilation support, misc minor fixes #26565

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

valgur
Copy link
Contributor

@valgur valgur commented Feb 9, 2025

Summary

Changes to recipe: qt/6.x.x

Motivation

#26529 added the core logic that's necessary to cross-compiler the Qt6 recipe at all, but it still has some major limitations:

  • Optional modules that build and rely on their own tools require these to be provided by the host-context Qt instead for the build to work. This PR propagates the necessary options to the Qt tool_requires.
  • The Qt CMake modules in the host context try to use the host-context executables when defining targets like Qt6::moc, this can either fail if these have not been built and are useless for consuming projects trying to use these tools.
  • Consuming projects currently need to set CMAKE_AUTOMOC_EXECUTABLE etc. variables for CMake to find the correct build-context tools.

Details

In addition to fixing the above issues, this PR also incorporates a few other fixes that I've accumulated in the process of improving cross-compilation support for all optional modules in Qt. These include:

  • made force_build_tools optional and False by default for cross-compilation, since they are generally not useful in that context and can have build issues:

    Linking against shared libraries appears to have issues, potentially due to mixed native and cross-compiled libs.

    [1409/1453] Linking CXX executable qtbase/libexec/rcc
    FAILED: qtbase/libexec/rcc
    : && /usr/bin/aarch64-linux-gnu-g++-13 -DNDEBUG -O2 -Wl,-z,relro,-z,now -Wl,--enable-new-dtags -fPIE -pie qtbase/src/tools/rcc/CMakeFiles/rcc_native.dir/rcc_native_autogen/mocs_compilation.cpp.o qtbase/src/tools/rcc/CMakeFiles/rcc_native.dir/main.cpp.o qtbase/src/tools/rcc/CMakeFiles/rcc_native.dir/rcc.cpp.o -o qtbase/libexec/rcc  -Wl,-rpath,/home/user/.conan2/p/b/qtc8d3483cfcb1b/b/build/Release/qtbase/lib:  qtbase/lib/libQt6Core.so.6.8.2 && :
    /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: warning: libicudata.so.75, needed by /home/user/.conan2/p/b/icu9b438096da10d/p/lib/libicuuc.so.75, not found (try using -rpath or -rpath-link)
    /usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld: /home/user/.conan2/p/b/icu9b438096da10d/p/lib/libicuuc.so.75: undefined reference to `icudt75_dat'
    collect2: error: ld returned 1 exit status

  • Dropped cross_compile and sysroot options since these seem to be solely there as carry-overs from the Qt5 recipe this one was based on. These were effectively useless before the cross-compilation support and are unlikely to have ever been used. The cross_compile option has little value now that the recipe has cross-compilation support and sysroot should use the value from tools.build:sysroot instead. These could be added back if someone sees a need for them.

  • add missing package_type and a missing fPIC option.

  • Added an option for unity build, which can help with build times quite a bit. I did not remove it from package_id, though, since it can cause subtle differences in the built binaries.

  • Dropped some validation checks and workarounds which appear likely to be outdated or possibly only relevant for Conan v1.

  • Added a transitive_libs=True for opengl/system.

  • gssapi/krb5 is now supported on CCI (although the exported .pc files are not correct: krb5: set pkg_config_name #25434).

  • Added all executables built and installed by Qt to package() and refactored it a bit.

  • Improved the filtering for kept .cmake module files in package().

  • No need to remove *.la files for a CMake project.

  • Export QT_HOST_PATH and QT_HOST_PATH_CMAKE_DIR env vars for host-context Qt. These are used to find the correct executables.


@valgur
Copy link
Contributor Author

valgur commented Feb 9, 2025

Logs for Qt and ConanCenter recipes that consume Qt by default.

Cross-compiled using gcc-13-aarch64-linux-gnu: https://gist.github.com/valgur/5a550530a55b0df98016b89dbb25d861

The consuming recipes have any necessary fixes applied, such as using CMake >= 3.27 for the Qt CMake vars to work correctly. The Qt recipe has some additional fixes applied as well, such as support for relocated non-system X11.

daggy-shared.log
daggy-static.log
limereport-shared.log - Failed to find the host tool "Qt6::qhelpgenerator"
limereport-static.log - Failed to find the host tool "Qt6::qhelpgenerator"
mocknetworkaccessmanager-shared.log
mocknetworkaccessmanager-static.log
qarchive-shared.log
qarchive-static.log
qcoro-shared.log *
qcoro-static.log *
qcustomplot-shared.log *
qcustomplot-static.log
qscintilla-shared.log
qscintilla-static.log
qt-advanced-docking-system-shared.log - test_package Qt linker error
qt-advanced-docking-system-static.log
qtawesome-shared.log *
qtawesome-static.log
qt-shared.log *
qt-static.log
qwt-shared.log *
qwt-static.log
qxlsx-shared.log*
qxlsx-static.log
qxmpp-shared.log
qxmpp-static.log
runtimeqml-shared.log - linking of qml executable fails, probably due to [replace_requires] of X11
runtimeqml-static.log
spix-shared.log - linking of qml executable fails, probably due to [replace_requires] of X11
spix-static.log

* - test_package fails due to what seems to be a bug in [replace_requires] not propagating transitive headers/libraries correctly in some cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant