Skip to content
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

gcc: fix Hydra builds for bootstrapTools.mips64el-linux-gnuabin32 #185284

Merged
merged 3 commits into from Aug 16, 2022
Merged

gcc: fix Hydra builds for bootstrapTools.mips64el-linux-gnuabin32 #185284

merged 3 commits into from Aug 16, 2022

Conversation

ghost
Copy link

@ghost ghost commented Aug 5, 2022

Description of changes

The Hydra builds for bootstrapTools.mips64el-linux-gnuabin32.build are currently failing due to make-bootstrap-files.nix expecting to find libraries in $PREFIX/lib, whereas on mips gcc uses the slightly awkward IRIX convention:

$PREFIX/lib   = mips32
$PREFIX/lib32 = mips64n32
$PREFIX/lib64 = mips64n64

We already work around a similar problem on x86_64 by creating symlinks from lib64 to lib. This PR disables that workaround if isMips64n32 and enables an analogous workaround to link lib32 to lib.

Things done
  • Built on platform(s)
    • powerpc64le-linux (cross to mips64n32)
    • mips64n32-linux (bootstrap from newly-built bootstrap-files, up to hello)
  • Tested compilation of many packages that depend on this change
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Adam Joseph added 2 commits August 5, 2022 11:07
Our gcc builder creates lib64->lib links to ensure that the "primary"
libraries for the targetPlatform wind up in $PREFIX/lib.  This is
required in order for make-bootstrap-files.nix to work correctly.

On mips, gcc follows the somewhat awkward IRIX convention of putting
mips32 binaries in `lib` and mips64n32 binaries in `lib32`.  So we
need similar symlinks there.  This may come up on other ILP32
platforms as well, so a general-purpose variable name is provided.
On mips, gcc follows the somewhat awkward IRIX convention of putting
mips64 binaries in `lib64` and mips64n32 binaries in `lib32`.  So on
mips64n32 we do not want the `lib64` symlinks.
This commit factors out the conditional which creates the `lib64->lib`
symlink in the `preInstall` phase, and calculates its value in nix
code rather than bash code so touching it doesn't cause a global
rebuild on every platform.
@ghost ghost marked this pull request as ready for review August 6, 2022 20:20
@ghost ghost requested a review from matthewbauer as a code owner August 6, 2022 20:20
@ghost
Copy link
Author

ghost commented Aug 6, 2022

Using bootstrap-files built from this PR:

nix build -f . -L --arg localSystem '(import ./lib).systems.examples.mips64el-linux-gnuabin32' hello
...
hello> make[3]: Leaving directory '/build/hello-2.12'
hello> make[2]: Leaving directory '/build/hello-2.12'
hello> make[1]: Leaving directory '/build/hello-2.12'
hello> post-installation fixup
hello> shrinking RPATHs of ELF executables and libraries in /nix/store/5d04x57amfyc1sb42g21jrjxfhx2pd4n-hello-2.12
hello> shrinking /nix/store/5d04x57amfyc1sb42g21jrjxfhx2pd4n-hello-2.12/bin/hello
hello> gzipping man pages under /nix/store/5d04x57amfyc1sb42g21jrjxfhx2pd4n-hello-2.12/share/man/
hello> strip is /nix/store/29jinn47ar9s1brdyi8qfyb8n74g63k8-gcc-wrapper-10.4.0/bin/strip
hello> stripping (with command strip and flags -S) in /nix/store/5d04x57amfyc1sb42g21jrjxfhx2pd4n-hello-2.12/bin
hello> patching script interpreter paths in /nix/store/5d04x57amfyc1sb42g21jrjxfhx2pd4n-hello-2.12
hello> checking for references to /build/ in /nix/store/5d04x57amfyc1sb42g21jrjxfhx2pd4n-hello-2.12...
nix@oak:/nix/nixpkgs$ result/bin/hello
Hello, world!

@ghost
Copy link
Author

ghost commented Aug 6, 2022

Note that the nix binary in the example above needs to be built with NixOS/nix#6456 (or else use --disable-syscall-filters).

@vcunat vcunat merged commit ddc75d1 into NixOS:staging Aug 16, 2022
@ghost
Copy link
Author

ghost commented Aug 25, 2022

This Hydra build is the first one to include this PR, so it ought to produce a working bootstrap-files.

@vcunat
Copy link
Member

vcunat commented Aug 25, 2022

Hmm, yes: https://hydra.nixos.org/eval/1777726?filter=mips
Some failing jobs remain, but those steps probably shouldn't be attempted and "fix" would be by removing them (or something similar).

@ghost
Copy link
Author

ghost commented Aug 25, 2022

This Hydra build is the first one to include this PR, so it ought to produce a working bootstrap-files.

Nice: #188334

Hmm, yes: https://hydra.nixos.org/eval/1777726?filter=mips
Some failing jobs remain, but those steps probably shouldn't be attempted and "fix" would be by removing them (or something similar).

When I click the link above, I see the failures, all for attrnames of the form bootstrapTools.${PLATFORM}.bootstrapTools.

Hydra should never attempt to build bootstrapTools.${PLATFORM}.bootstrapTools unless with stdenv; buildPlatform.canExecute hostPlatform.

Indeed, there are a ton of Hydra failures in this category; I count 17 of them:

https://hydra.nixos.org/eval/1777726?filter=.bootstrapTools&compare=1777572&full=#tabs-still-fail

I'm preparing a PR to fix this.

@ghost
Copy link
Author

ghost commented Aug 26, 2022

Indeed, there are a ton of Hydra failures in this category; I count 17 of them:

The fix is #188339.

@ghost ghost deleted the pr/mips64n32/fix-bootstrap-files branch January 23, 2024 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant