Skip to content

qutebrowser: enable cross compilation#230171

Closed
ghost wants to merge 25 commits intomasterfrom
unknown repository
Closed

qutebrowser: enable cross compilation#230171
ghost wants to merge 25 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented May 5, 2023

This is is -- the finish line. I cross compiled 100% of the software on my laptop today -- all the way from the reset vector (coreboot) to my preferred web browser (qutebrowser).

Description of changes

This PR successfully builds pkgsCross.aarch64-multiplatform.qutebrowser and all of its dependencies (pyqt, qt-5, wayland, etc) from an x86_64-linux builder.

It works, but still needs cleanup -- especially the two [DONTMERGE] commits.

Things done
  • Built on platform(s)
    • aarch64-linux (from x86_64-linux)
  • Fits CONTRIBUTING.md.

Artturin and others added 4 commits May 5, 2023 11:52
if there is more than one qt5 attr and this file is copied then the arg
to generateSplicesForMkScope should be changed
Without this, two different copies of qtbase to wind up in the
buildInputs for cross compiled builds, leading to this sort of
breakage for PyQt:

```
Error: detected mismatched Qt dependencies:
     /nix/store/8g7xc01pj6y569qfyf5ccfbs5dr87wwq-qtbase-aarch64-unknown-linux-gnu-5.15.9-dev
     /nix/store/w19n5gzlx4fv63a3dn5965s661nhakv9-qtbase-5.15.9-dev
```
@github-actions github-actions bot added 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation labels May 5, 2023
@ghost ghost requested a review from Artturin May 5, 2023 19:10
@ofborg ofborg bot added the 6.topic: cross-compilation Building packages on a different platform than they will be used on label May 5, 2023
@Artturin
Copy link
Member

Artturin commented May 5, 2023

Don't use paths in the commit messages, use python310Packages and qt5

https://github.com/NixOS/ofborg#automatic-building

@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches. labels May 5, 2023
@RaitoBezarius
Copy link
Member

This is is -- the finish line. I cross compiled 100% of the software on my laptop today -- all the way from the reset vector (coreboot) to my preferred web browser (qutebrowser).

What a king :D.

Adam Joseph added 16 commits May 6, 2023 02:31
This commit adds the `-device` and `-device-option` flags necessary
for cross compilation to `configureFlags`.

It also adds the (one-entry at the moment) Rosetta Stone for QT-5 as
a `let`-defined `qtPlatform` function which takes a nixpkgs platform
and returns a QT-5 `mkspecs`-string.
This commit:

- sets the `PKG_CONFIG_SYSROOT_DIR` and `PKG_CONFIG_LIBDIR`
  environment variables when compiling a cross-targeted `qmake`.
  This is required; if these environment variables are unset,
  `qmake` won't even try to use `pkg-config`.

- writes `LDFLAGS`, `CFLAGS`, and `CXXFLAGS` into `qmake.conf`.
QT's configure script doesn't understand these, so let's not pass them.
Later stages of the build process expect to find

  $bin/bin/{qmlformat,qmltyperegistrar}

however qt's quirky build tooling doesn't feel like it's in the mood
to put those files there when doing a cross-compiled build.  Instead
it puts them in $dev/bin.  Let's move them to the right place and
add symlinks from whence we moved them (the symlinks can't point the
other way due to reference cycles).
QtWebChannel does not produce binaries when it is cross-compiled.
Let's omit the `$bin` output in that case.
The expression in its current form attempts to invoke the python2
interpreter for the wrong (i.e. build) architecture.

Using python3 explicitly, rather than relying on aliases, fixes this.
When cross-compiling, qmake insists on being able to find a
`pkgsHostForTarget`-style `pkg-config` with the name `pkg-config`
(no target prefix allowed).

To keep `qmake` happy, this commit creates a one-symlink derivation
containing a link `pkg-config` which points to
`${targetPrefix}pkg-config`.

This commit also sets the `PKG_CONFIG` environment variable.
The build logs from PyQT5 are quite verbose; it's nice to trim them
down so all you see is the errors.  This commit adds an option which
does that.
Adam Joseph added 5 commits May 6, 2023 02:32
This commit causes pyqtwebengine to build using -j$NIX_BUILD_CORES,
and also adds the verbose flag which really means "don't send build
errors to /dev/null".
This commit:

- adds qtwebchannel to deps
- takes sip from buildPackages
This commit successfully cross compiles qutebrowser and all its
dependencies (pyqt, qt-5, wayland, etc).
@ghost
Copy link
Author

ghost commented May 7, 2023

$ git rev-parse HEAD
0cc380b17df1570a236146c189d646944e5d3c1d
$ nix-instantiate . -A pkgsCross.aarch64-multiplatform.qutebrowser
warning: you did not specify '--add-root'; the result might be removed by the garbage collector
/nix/store/ywc7a2vljhp7fwdsziypvm25f9qvrc5x-qutebrowser-2.5.3-aarch64-unknown-linux-gnu.drv
$ nix-build /nix/store/ywc7a2vljhp7fwdsziypvm25f9qvrc5x-qutebrowser-2.5.3-aarch64-unknown-linux-gnu.drv
/nix/store/qpd4dynlmfq1zy2fi4vh8ddgv3mffans-qutebrowser-2.5.3-aarch64-unknown-linux-gnu

@ofborg build pkgsCross.aarch64-multiplatform.qutebrowser

@ghost ghost mentioned this pull request Aug 26, 2023
12 tasks
@ghost ghost marked this pull request as ready for review August 26, 2023 20:02
@ghost ghost requested a review from ttuegel as a code owner August 26, 2023 20:02
@ghost ghost closed this Oct 22, 2023
@ghost ghost deleted the pr/qutebrowser/cross branch October 22, 2023 05:36
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: cross-compilation Building packages on a different platform than they will be used on 6.topic: python Python is a high-level, general-purpose programming language. 6.topic: qt/kde Object-oriented framework for GUI creation 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 2501-5000 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants