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

{cc,bintools}-wrapper, ghc, libgcc: Define wrapper env vars as full paths #44767

Merged
merged 4 commits into from Aug 17, 2018

Conversation

Ericson2314
Copy link
Member

@Ericson2314 Ericson2314 commented Aug 8, 2018

Motivation for this change

This makes builds more robust by having the env vars not rely on the PATH. That, for example, helps keep separate toolchains untangled even when on native builds neither are prefixed.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.

CC @bgamari we talked about this once

@Ericson2314 Ericson2314 changed the title *-wrapper, ghc, libgcc: Define wrapper env vars as full paths {cc,bintools}-wrapper, ghc, libgcc: Define wrapper env vars as full paths Aug 8, 2018
export CC="${targetCC}/bin/${targetCC.targetPrefix}cc"
export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx"
export CC="$CC_FOR_TARGET"
export CXX="$CXX_FOR_TARGET"
# Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177
export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString targetPlatform.isAarch32 ".gold"}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this one not changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we are forcing gold to be used

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: libgcc

Partial log (click to expand)

cannot build derivation '/nix/store/pvjql10zvzk9db8lnbh3bs939p1cq5q8-CF-osx-10.10.5.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/lgmcgcfpp7byvaqc9mbcw5l4d0l0cx1q-cctools-binutils-darwin-wrapper.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/q0pw11wrqi3rc66lp0cz6qmyx1v8fh6x-cctools-binutils-darwin-wrapper.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/8yxi4fy91vmlqp0raavqsblrvvf0ib6x-clang-wrapper-5.0.2.drv': 11 dependencies couldn't be built
cannot build derivation '/nix/store/n8ll7dmfh81d6dm5n28bddabqyy87pk2-clang-wrapper-5.0.2.drv': 8 dependencies couldn't be built
cannot build derivation '/nix/store/gl0sjvc9acjkaviq7whyjqrh1maqlick-stdenv-darwin.drv': 36 dependencies couldn't be built
cannot build derivation '/nix/store/h01cbk6dp6zjr24zbnr8gwz6f0immf4d-stdenv-darwin.drv': 38 dependencies couldn't be built
cannot build derivation '/nix/store/rbhyzqkfma5bf42rdjg2ijgnj1ijilpq-libiberty-7.3.0.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/bjyk4f5k3400ma24d93gnsm9dsrkhjbn-libgcc-7.3.0.drv': 4 dependencies couldn't be built
error: build of '/nix/store/bjyk4f5k3400ma24d93gnsm9dsrkhjbn-libgcc-7.3.0.drv' failed

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libgcc

Partial log (click to expand)

wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
shrinking RPATHs of ELF executables and libraries in /nix/store/v348wqa26s8lgsqnsa0mgnpnzz0438f3-libgcc-7.3.0-dev
/nix/store/0mdm8qw4b8992gjsw63v76084cd1gjcy-binutils-2.30/bin/strip is /nix/store/0mdm8qw4b8992gjsw63v76084cd1gjcy-binutils-2.30/bin/strip
stripping (with command /nix/store/0mdm8qw4b8992gjsw63v76084cd1gjcy-binutils-2.30/bin/strip and flags -S) in /nix/store/v348wqa26s8lgsqnsa0mgnpnzz0438f3-libgcc-7.3.0-dev/lib
patching script interpreter paths in /nix/store/v348wqa26s8lgsqnsa0mgnpnzz0438f3-libgcc-7.3.0-dev
checking for references to /build in /nix/store/v348wqa26s8lgsqnsa0mgnpnzz0438f3-libgcc-7.3.0-dev...
/nix/store/016xsvfqrm15kgjlbfss6gqa46v4m9nw-libgcc-7.3.0

@ryantm ryantm removed their request for review August 8, 2018 22:42
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libgcc

Partial log (click to expand)

wrong ELF type
wrong ELF type
wrong ELF type
wrong ELF type
shrinking RPATHs of ELF executables and libraries in /nix/store/0axjlvjim0i5zjj6yx891sy0p1xcaaz0-libgcc-7.3.0-dev
/nix/store/jggkjfzggjwrb3h9j24kx9i54vnpf3qs-binutils-2.30/bin/strip is /nix/store/jggkjfzggjwrb3h9j24kx9i54vnpf3qs-binutils-2.30/bin/strip
stripping (with command /nix/store/jggkjfzggjwrb3h9j24kx9i54vnpf3qs-binutils-2.30/bin/strip and flags -S) in /nix/store/0axjlvjim0i5zjj6yx891sy0p1xcaaz0-libgcc-7.3.0-dev/lib
patching script interpreter paths in /nix/store/0axjlvjim0i5zjj6yx891sy0p1xcaaz0-libgcc-7.3.0-dev
checking for references to /build in /nix/store/0axjlvjim0i5zjj6yx891sy0p1xcaaz0-libgcc-7.3.0-dev...
/nix/store/0mkvv304n0pz31aaakn5kcz36w6qkdc7-libgcc-7.3.0

@Ericson2314
Copy link
Member Author

@GrahamcOfBorg build stdenv

@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: stdenv

Partial log (click to expand)

cannot build derivation '/nix/store/xf1m6mf6anp4mi3v46am2s3bb1kzv9ws-cctools-port-895.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/lzs2yfhy2jchimz3ab9cq72azvmy9zkb-hook.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/n4gz4jsms0k92gnmrk0ih9nhk7v6w57q-ICU-osx-10.10.5.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/h8z8qj6r9w9yl2hvlw8gpz7zpb7jc0zs-cctools-binutils-darwin.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/gm556rfqmjm1kyr3bslwxj1g2mv342bl-gnutar-1.30.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/i4pvj66lxsdw1ybv9kzc5j5a1xci763x-CF-osx-10.10.5.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/sl9vjxc7pc1076z37k7a91ghmq2sygvb-cctools-binutils-darwin-wrapper.drv': 7 dependencies couldn't be built
cannot build derivation '/nix/store/pf3mpkg0acpf44ngmky00zw63grxrkvp-clang-wrapper-5.0.2.drv': 11 dependencies couldn't be built
cannot build derivation '/nix/store/ddjdvxsk56dd3xwwf2y554bkjswps9jc-stdenv-darwin.drv': 36 dependencies couldn't be built
error: build of '/nix/store/ddjdvxsk56dd3xwwf2y554bkjswps9jc-stdenv-darwin.drv' failed

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

make[1]: Leaving directory '/build/patch-2.7.6'
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/i7vcsw4p6n51b72a12ysp5j31579wkd3-patch-2.7.6
shrinking /nix/store/i7vcsw4p6n51b72a12ysp5j31579wkd3-patch-2.7.6/bin/patch
gzipping man pages under /nix/store/i7vcsw4p6n51b72a12ysp5j31579wkd3-patch-2.7.6/share/man/
/nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip is /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip
stripping (with command /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/strip and flags -S) in /nix/store/i7vcsw4p6n51b72a12ysp5j31579wkd3-patch-2.7.6/bin
checking for references to /build in /nix/store/i7vcsw4p6n51b72a12ysp5j31579wkd3-patch-2.7.6...
building '/nix/store/5jdn6gdk2q4rk3b6svx7aqbyal0d83x3-stdenv-linux.drv'...
/nix/store/fjxk3k59n102sqs572kkspdjy303kv45-stdenv-linux

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: stdenv

Partial log (click to expand)

shrinking /nix/store/fic9wm2aq8q0206jd030n94ddf0y8kk1-findutils-4.6.0/bin/find
gzipping man pages under /nix/store/fic9wm2aq8q0206jd030n94ddf0y8kk1-findutils-4.6.0/share/man/
/nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip is /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip
stripping (with command /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip and flags -S) in /nix/store/fic9wm2aq8q0206jd030n94ddf0y8kk1-findutils-4.6.0/libexec  /nix/store/fic9wm2aq8q0206jd030n94ddf0y8kk1-findutils-4.6.0/bin
checking for references to /build in /nix/store/fic9wm2aq8q0206jd030n94ddf0y8kk1-findutils-4.6.0...
shrinking RPATHs of ELF executables and libraries in /nix/store/y61l5vs4fv6xgnixv1maxbpa1v3bvyjv-findutils-4.6.0-info
/nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip is /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/y61l5vs4fv6xgnixv1maxbpa1v3bvyjv-findutils-4.6.0-info...
building '/nix/store/7kg9x415bylyg9qhiqmqy745xkdb9l6v-stdenv-linux.drv'...
/nix/store/hp2c829bnn50m4z18ysg4132bckszsn1-stdenv-linux

@Ericson2314
Copy link
Member Author

I cannot test on Darwin at the moment, but it seems unlikely that this would cause any problems.

@Ericson2314 Ericson2314 merged commit 89efc27 into NixOS:staging Aug 17, 2018
@Ericson2314 Ericson2314 deleted the wrapper-env-var-path branch August 17, 2018 20:12
@vcunat
Copy link
Member

vcunat commented Aug 18, 2018

I see a disadvantage: some packages tend to save these variables somewhere in the outputs, so this PR blows runtime closures for those. Example where it results into a failure due to closure check: https://hydra.nixos.org/build/79797093

Most of these cases probably can be handled, e.g. put those files into $dev or something, but as usual, it's takes some work (even to discover the change).

vcunat added a commit that referenced this pull request Aug 19, 2018
vcunat added a commit that referenced this pull request Aug 19, 2018
@Ericson2314
Copy link
Member Author

Ericson2314 commented Aug 20, 2018

Agh, nothing comes free. Thank you very much for catching, @vcunat.

@vcunat
Copy link
Member

vcunat commented Aug 21, 2018

Several packages started failing with some libtool error that might be due to this – any ideas? https://hydra.nixos.org/build/79808675

@vcunat
Copy link
Member

vcunat commented Aug 21, 2018

Oh, never mind, it's all the same workaround. I should have tried before asking :-)

@vcunat
Copy link
Member

vcunat commented Aug 21, 2018

No, my bad, I don't know a workaround. (I confused two packages together.)

vcunat added a commit that referenced this pull request Aug 21, 2018
Some packages just can't handle them #44767.  It was tempting to try
to abstract this in some way, but I didn't do that ATM.
@vcunat
Copy link
Member

vcunat commented Aug 21, 2018

Well, this is in master now, but we would better fixup at least the most common closure offenders, e.g. python. EDIT: or

We might consider using absolute paths only when cross-compiling, or something like that. (I guess that's the case where confusion happens most easily and it's better to use absolute paths then.)

@matthewbauer
Copy link
Member

This appears to break windows builds too:

https://hydra.nixos.org/build/79957713/

Error is:

sh: gcc: not found

matthewbauer added a commit to matthewbauer/nixpkgs that referenced this pull request Aug 21, 2018
…nv-var-path"

This reverts commit 89efc27, reversing
changes made to d0f1102.

Fixes NixOS#44936
matthewbauer added a commit that referenced this pull request Aug 21, 2018
…r-path"

This reverts commit 89efc27, reversing
changes made to d0f1102.
matthewbauer added a commit that referenced this pull request Aug 21, 2018
globin pushed a commit that referenced this pull request Aug 21, 2018
…r-path"

This reverts commit 89efc27, reversing
changes made to d0f1102.
globin pushed a commit that referenced this pull request Aug 21, 2018
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Aug 23, 2018
…nv-var-path"

This reverts commit 89efc27, reversing
changes made to d0f1102.
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Aug 23, 2018
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.

None yet

4 participants