Conversation
0a35770 to
fa7ded2
Compare
fa7ded2 to
b62c749
Compare
Implements support for cross compilation most of Qt 6, excluding pyside.
b62c749 to
eb6578e
Compare
|
Trying some |
| # Conditional is required to prevent infinite recursion during a cross build | ||
| ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ | ||
| "-DQt6QmlTools_DIR=${pkgsBuildBuild.qt6.qtdeclarative}/lib/cmake/Qt6QmlTools" | ||
| "-DPython_EXECUTABLE=${lib.getExe pkgsBuildHost.python3}" |
There was a problem hiding this comment.
Does this not get detected if you put it in nativeBuildInputs? And if it doesn't get detected could you write
| "-DPython_EXECUTABLE=${lib.getExe pkgsBuildHost.python3}" | |
| "-DPython_EXECUTABLE=python3" |
with it in nativeBuildInputs?
Though I guess how you have it here is most explicit.
There was a problem hiding this comment.
Looks like it was there previously for darwin. I would assume it didn't but I never tested darwin.
That's quite strange, especially because it builds fine from x86_64->riscv64. Maybe something changed in the rebase onto staging?. I'll try building for arm. |
Do you have binfmt misc support turned on for riscv64 on the x86_64 box you're testing with? IIRC that can leak in and let a cross build succeed when it really ought not to. #61537 |
|
I have boot.binfmt.emulatedSystems but not binfmt_misc. I'll try building with binfmt off. |
|
I was able to reproduce the shadertools issue. |
|
This is unfortunate. It looks like the tooling lookup functions that check the host paths aren't actually used in a lot of cases, and many Qt packages hard-code QT_HOST_PATH instead, for example QtDeclarative below: # Set up QT_HOST_PATH as an extra root path to look for the ShaderToolsTools package
# when cross-compiling.
if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(_qt_backup_qtdeclarative_CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
set(_qt_backup_qtdeclarative_CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
list(PREPEND CMAKE_PREFIX_PATH "${QT_HOST_PATH_CMAKE_DIR}")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}")
endif()
# This can't use the find_package(Qt6 COMPONENTS) signature, because Qt6Config uses NO_DEFAULT and
# won't look at the prepend extra find root paths.
find_package(Qt6ShaderToolsTools ${PROJECT_VERSION} CONFIG
PATHS
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
)
if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${_qt_backup_qtdeclarative_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${_qt_backup_qtdeclarative_CMAKE_FIND_ROOT_PATH})
endif()Now the main options I see are
Regardless of which option we pick here I think QT_ADDITIONAL_HOST_PACKAGES_PREFIX_PATH should still be populated for anything that does use Qt's tool lookup functions, because there are a few usages of those. I'm going to ask if upstream has any recommendations. |
|
Unfortunately I'm going to be away from my build/test setup for a couple weeks and won't be able to work on this until I'm back. I'll mark it as a draft till I have further progress. |
Is there an upstream discussion to follow for the shadertools issue? |
|
Hey there, I'm too interested in cross compiling qt6 apps, and I haven't experienced any substantial failures when cross building In #481338 , I'm trying to use the So maybe the motivation of this PR should be rephrased? |
Implements support for cross compilation most of Qt 6.
Cross compilation was tested for riscv64 but all changes here should apply generally. I did not test qtwebengine or qtquick3dphysics as they cannot compile for riscv64. Pyside and Shiboken6 still do not work, and as such all of kde still does not work.
qt6.full still builds as expected for non-cross x86_64. All new patches are applied only when cross compiling to reduce the impact of any future breakage to just things that already didn't work.
The qtbase setup hook has also been changed to account for cross compilation, and a flag to skip running it has been added, as I'm not aware of another way to skip hooks and I've had to rebuild for it quite often.
cc @NickCao @K900
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.