chromium: cross compilation support#229265
Conversation
|
separated |
@ofborg build pkgsCross.aarch64-multiplatform.ungoogled-chromium |
xdg-utils does not cross-compile. Let's late-bind (using the runtime $PATH) in this scenario so a native-built xdg-utils can be used instead.
`llvmPackages.clang` is used in the `gnFlags` attrset, so we need to indicate explicitly which "on" platform (the build) and which "for" platform (the host) we want. This commit does that.
ungoogled-chromium is, contrary to its name, not a build of chromium. It is a patched copy of chromium's *source code*. Therefore, it needs to come from pkgsBuildBuild, because it contains python scripts which get /nix/store/.../bin/python3 patched into their shebangs.
Sometimes we access `llvmPackages` via `pkgs`, and other times via `pkgsFooBar`, so unfortunately a string (attrname) is the only way to have a single point of control over the LLVM version used for both buildPlatform and hostPlatform.
|
Rebased. |
michaeladler
left a comment
There was a problem hiding this comment.
Looks like quite the ordeal. Nice job! If it builds, then it's fine with me :)
There was a problem hiding this comment.
That's weird, Why is it necessary
There was a problem hiding this comment.
After investigating more closely I think the comment is incorrect.
I think pkgsBuildBuild.libpng is needed for something Chromium is doing at build time, not because of anything related to splicing. I'm verifying this and will remove the comment (or the entire line) once I do.
There was a problem hiding this comment.
I'm saying ++ buildInputs is weird
There was a problem hiding this comment.
Chromium compiles a ton of stuff for both the hostPlatform and the buildPlatform (which, confusingly, it calls "host"... argh). For example, in order to dump out a "quick-start image" for the javascript VM it builds an entire buildPlatform version of it!
I could slog through every last dependency and figure out exactly which ones are/aren't needed on the host, but then that list would need to be maintained separately. It's definitely more than half of them.
There was a problem hiding this comment.
See ea7c3166548919ba63c204f47598e8522de1c2d3
|
Rebased. |
|
Very messy but I guess that's just how browsers are... |
|
Merge after someone confirms that there's no build time deps included in the cross closure |
|
There's no for build deps in the output It took 3 hours to build chromium... |
Should I add a |
Sure, check how I did it in systemd. |
|
This increased the build steps and build time for non cross-compilation (e.g. It almost feels like we are building certain things twice. Would you mind looking into this again @amjoseph-nixpkgs? Edit: Wait. Are we cross-compiling to the same architecture if not invoked by |
| target_cpu = chromiumRosettaStone.cpu stdenv.hostPlatform; | ||
| v8_target_cpu = chromiumRosettaStone.cpu stdenv.hostPlatform; | ||
| target_os = chromiumRosettaStone.os stdenv.hostPlatform; |
There was a problem hiding this comment.
Setting targets may be the cause of always cross-compiling
There was a problem hiding this comment.
Possible improvement:
Chromium has its own totally custom build system, and it's a gigantic pain in the ass. That's why chromium (and &(^&% QT) were among the very last parts of nixpkgs to support cross-compiling. |
Description of changes
This commit successfully cross-compiles chromium from
buildPlatform=x86_64-linuxtohostPlatform=aarch64-linux.Other PRs included in this one (can be reviewed/merged independently):
Things done
x86_64-linux)./result/bin/)