qt5: cross compile with a clean separation of build and host binaries#267311
qt5: cross compile with a clean separation of build and host binaries#267311eryngion wants to merge 26 commits intoNixOS:stagingfrom
Conversation
There was a problem hiding this comment.
Maybe qmakePathHook should be run for both types of packages? Not sure yet.
|
@amjoseph-nixpkgs @Artturin |
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.
hyphen's sources in tarbals are identical, and the version from pkgs properly supports cross compilation.
This reverts commit 6e27bc9.
propagate less of them
…qmakeFlags but don't use __structuredAttrs
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.
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?
15f1639 to
3bff735
Compare
|
Okay, there's now a second track with simpler changes in #487372. But since they're required for everything else and GitHub doesn't seem to have stacked PRs, for now I'm keeping them here too. Also the checks are exploding on me for the second day: yesterday it was formatting that I can't get out of |
Hopefully these issues will be fixed by the time we reach to this PR again. Let's focus on #487372 in the meantime (I'm marking this one as a draft 🙏). |
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]
patchShebangsexpects 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 = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)