-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
qt5: cross compile with a clean separation of build and host binaries #267311
Open
eryngion
wants to merge
21
commits into
NixOS:master
Choose a base branch
from
eryngion:qt5-cross-with-a-clean-native-split
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
qt5: cross compile with a clean separation of build and host binaries #267311
eryngion
wants to merge
21
commits into
NixOS:master
from
eryngion:qt5-cross-with-a-clean-native-split
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
6.topic: python
6.topic: nixos
Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
6.topic: qt/kde
6.topic: kernel
The Linux kernel
8.has: documentation
This PR adds or changes documentation
8.has: module (update)
This PR changes an existing module in `nixos/`
6.topic: printing
6.topic: policy discussion
6.topic: vim
6.topic: ocaml
6.topic: steam
Steam game store/launcher (store.steampowered.com)
6.topic: nodejs
labels
Nov 13, 2023
github-actions
bot
removed
6.topic: python
6.topic: nixos
Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
6.topic: kernel
The Linux kernel
8.has: documentation
This PR adds or changes documentation
8.has: module (update)
This PR changes an existing module in `nixos/`
6.topic: printing
6.topic: policy discussion
6.topic: vim
6.topic: ocaml
6.topic: steam
Steam game store/launcher (store.steampowered.com)
6.topic: nodejs
labels
Nov 13, 2023
eryngion
commented
Nov 13, 2023
eryngion
commented
Nov 13, 2023
@@ -56,7 +52,7 @@ qmakePathHook() { | |||
QMAKEPATH="${QMAKEPATH}${QMAKEPATH:+:}$1" | |||
fi | |||
} | |||
envBuildHostHooks+=(qmakePathHook) | |||
envHostTargetHooks+=(qmakePathHook) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe qmakePathHook should be run for both types of packages? Not sure yet.
NixOSInfra
added
the
12. first-time contribution
This PR is the author's first one; please be gentle!
label
Nov 13, 2023
@amjoseph-nixpkgs @Artturin |
FliegendeWurst
added
the
6.topic: cross-compilation
Building packages on a different platform than they will be used on
label
Nov 13, 2023
ofborg
bot
added
the
2.status: merge conflict
This PR has merge conflicts with the target branch
label
Nov 13, 2023
Add to qtbase support for building a small bootstrap package. Move qmake and other tools from qtbase.dev to qtbase.qmake to avoid pulling in a second version of qtbase.dev in cross builds. Use hidden bootstrap packages for qtbase and qttools instead of overrideScope-based staging process to solve some spurious builds and infinite recursions. This commit by itself will allow to cross compile only qttranslations and qtbase.
Also teach the setup hook, qmake and cmake scripts to search various build tools in PATH and use them for cross compilation. This will allow to cross compile packages that require only qtbase and qmake.
… a native-built one For this we need to dynamically detect cross compilation in qtbase-setup-hook.sh and in mkspecs, and stop unconditionally using binary lndir in propagatedNativeBuildInputs. For now qtbase substitution will work only in one (most used) direction, and in many cases will additionally require to manually add a buildHost version of qtbase.qmake to nativeBuildInputs of the package that depends on qtbase.
Without it qtwebchannel will fail to find some library includes, qtquickcontrols will refuse to build without properly failing the build: ``` Some of the required modules (qtHaveModule(quick)) are not available. Skipped. ``` And there are probably more problems, not always obvious.
It needs only qtdeclarative to build, not qtquickcontrols.
If you're a nativeBuildInput somewhere, you probably shouldn't propagate qtbase.
…s with qttools as a buildInput And don't propagate qtbase to avoid pulling in a second qtbase.dev in cross builds.
The sources in tarbals are identical, and hyphen from pkgs properly supports cross compilation.
It will use the bundled woff2 lib if we don't provide a system one. And "DWARF optimization and duplicate removal tool" is just nice to have, I guess.
Not sure why it was done. This reverts commit 49e8d9d.
I expect here that qtwebengine will propagate qtwebchannel and qtdeclarative and that qtdeclarative will propagate itself as a nativeBuildInput. But maybe we shouldn't rely on those propagations?
Rely on callPackage whenever possible. And pass a spliced version of stdenv to fix cross compilaton for qtwebengine.
It never worked and it's just an attempt to duplicate the logic from qmake (i.e. QMAKEPATH -> QMAKEMODULES translation) that qmake does all by itself.
Artturin
force-pushed
the
qt5-cross-with-a-clean-native-split
branch
from
May 28, 2024 12:32
a5ebde0
to
27353f1
Compare
Rebased. |
ofborg
bot
removed
the
2.status: merge conflict
This PR has merge conflicts with the target branch
label
May 28, 2024
wegank
added
the
2.status: merge conflict
This PR has merge conflicts with the target branch
label
Jul 4, 2024
13 tasks
wegank
added
the
2.status: stale
https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
label
Jan 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
2.status: merge conflict
This PR has merge conflicts with the target branch
2.status: stale
https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md
6.topic: cross-compilation
Building packages on a different platform than they will be used on
6.topic: nixos
Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS
6.topic: python
6.topic: qt/kde
8.has: module (update)
This PR changes an existing module in `nixos/`
8.has: package (new)
This PR adds a new package
10.rebuild-darwin: 501+
10.rebuild-darwin: 1001-2500
10.rebuild-linux: 501+
10.rebuild-linux: 5001+
12. first-time contribution
This PR is the author's first one; please be gentle!
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
By default when cross compiling QT builds all binaries that are marked in their .pro files with
option(host_build)
for the build platform instead of the host platform, and those binaries end up in the dev outputs (maybe not only there) of packages intended for the host platform. While there is some expectation of this situation in Nix [1], it prevents us from easily swapping natively and cross built dependencies, i.e. "lazy cross-compiling" and the host platform doesn't get the full set of binaries.Here I'm attempting to have only host-targeted binaries in the cross-compiled packages and somehow live with this new situation. Even if this approach fails, I have here a couple of fixes that can helpful elsewhere.
I'll direct this PR to staging when we will be done discussing it.
[1]
patchShebangs
expects that binaries in dev outputs will be run on the build platform, andpropagatedNativeBuildInputs
, being implemented as an in-store dependency, essentially adds the same hard dependency on the platform where the package was built.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)