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

xz: set CONFIG_SHELL to /bin/sh, fix retained reference to bootstrap #34916

Closed
wants to merge 1 commit into from

Conversation

dtzWill
Copy link
Member

@dtzWill dtzWill commented Feb 13, 2018

stdenv should be buildable cleanly with new Nix!

I ran into this while working on the musl PR (#34645)
but this is reproducible on master with Nix 2
(AFAIK not with Nix 1.11).

Please review and test. And yes this will require rebuilding all the things.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-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/)
  • Fits CONTRIBUTING.md.

Using CONFIG_SHELL since that's what is checked first.
Don't force the shell to use, let xz test what it finds
and come to its own conclusions about suitability.

As-is our stdenv fails to build with Nix 2.0 due to references
in xz's scripts to bootstrap tools' "sh".

Try nix-build -A xz --check and look at what configure detects
for the POSIX-compat shell: it needs to be /bin/sh, and if
it instead is a path with the word "bootstrap" then you've reproduced.

Using CONFIG_SHELL since that's what is checked first.
Don't force the shell to use, let xz test what it finds
and come to its own conclusions about suitability.

As-is our stdenv fails to build with Nix 2.0 due to references
in xz's scripts to bootstrap tools' "sh".

Try `nix-build -A xz --check` and look at what configure detects
for the POSIX-compat shell: it needs to be /bin/sh, and if
it instead is a path with the word "bootstrap" then you've reproduced.
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/i8y9d92h61dfpvimvw0zn70906c8w2am-xz-5.2.3/lib
checking for references to /build in /nix/store/i8y9d92h61dfpvimvw0zn70906c8w2am-xz-5.2.3...
shrinking RPATHs of ELF executables and libraries in /nix/store/6y82lnxb1qrv9yd8xgzrwjvcdgg5jv36-xz-5.2.3-man
gzipping man pages under /nix/store/6y82lnxb1qrv9yd8xgzrwjvcdgg5jv36-xz-5.2.3-man/share/man/
strip is /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/6y82lnxb1qrv9yd8xgzrwjvcdgg5jv36-xz-5.2.3-man...
shrinking RPATHs of ELF executables and libraries in /nix/store/nsk6id9cy08aw0imhmycd4bqs0wd6c53-xz-5.2.3-doc
strip is /nix/store/gfgczbs0cy0blibb0acv39cayq7qbplg-bootstrap-tools/bin/strip
checking for references to /build in /nix/store/nsk6id9cy08aw0imhmycd4bqs0wd6c53-xz-5.2.3-doc...
/nix/store/z346cdfnvn4ihf9bwqqff99pzwr33xqr-xz-5.2.3-bin

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Partial log (click to expand)

/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/xg++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/ -B/nix/store/s670dyz8vm2mnd600l2myynsgnskfn6c-gcc-6.4.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include  -I/tmp/nix-build-gcc-6.4.0.drv-0/gcc-6.4.0/libstdc++-v3/libsupc++ -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c   -O2 -I/nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -B/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib/ -idirafter /nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -idirafter /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include-fixed -Wl,-rpath,/nix/store/grhn0xic5c6py68sb5852xvy58rq00yk-gcc-6.4.0-lib/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-rpath -Wl,/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -gtoggle -fprofile-generate -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I../../gcc-6.4.0/gcc -I../../gcc-6.4.0/gcc/. -I../../gcc-6.4.0/gcc/../include -I../../gcc-6.4.0/gcc/../libcpp/include -I/nix/store/lrw06gvflnx7kcjmli7h1p8945cg791k-gmp-6.1.2-dev/include -I/nix/store/g3496kg9vkd4n18zp94nw8hp5lkqjx2s-mpfr-3.1.3-dev/include -I/nix/store/ca7ywzdjgf98pgg26pyinkvrv1bgcglj-libmpc-1.0.3/include  -I../../gcc-6.4.0/gcc/../libdecnumber -I../../gcc-6.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-6.4.0/gcc/../libbacktrace -I/nix/store/4ij7kfj57dhxl1g9yxakrpy1f15cf5av-isl-0.14.1/include  -o tree-ssa-loop-ch.o -MT tree-ssa-loop-ch.o -MMD -MP -MF ./.deps/tree-ssa-loop-ch.TPo ../../gcc-6.4.0/gcc/tree-ssa-loop-ch.c
/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/xg++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/ -B/nix/store/s670dyz8vm2mnd600l2myynsgnskfn6c-gcc-6.4.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include  -I/tmp/nix-build-gcc-6.4.0.drv-0/gcc-6.4.0/libstdc++-v3/libsupc++ -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c   -O2 -I/nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -B/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib/ -idirafter /nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -idirafter /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include-fixed -Wl,-rpath,/nix/store/grhn0xic5c6py68sb5852xvy58rq00yk-gcc-6.4.0-lib/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-rpath -Wl,/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -gtoggle -fprofile-generate -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I../../gcc-6.4.0/gcc -I../../gcc-6.4.0/gcc/. -I../../gcc-6.4.0/gcc/../include -I../../gcc-6.4.0/gcc/../libcpp/include -I/nix/store/lrw06gvflnx7kcjmli7h1p8945cg791k-gmp-6.1.2-dev/include -I/nix/store/g3496kg9vkd4n18zp94nw8hp5lkqjx2s-mpfr-3.1.3-dev/include -I/nix/store/ca7ywzdjgf98pgg26pyinkvrv1bgcglj-libmpc-1.0.3/include  -I../../gcc-6.4.0/gcc/../libdecnumber -I../../gcc-6.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-6.4.0/gcc/../libbacktrace -I/nix/store/4ij7kfj57dhxl1g9yxakrpy1f15cf5av-isl-0.14.1/include  -o tree-ssa-loop-im.o -MT tree-ssa-loop-im.o -MMD -MP -MF ./.deps/tree-ssa-loop-im.TPo ../../gcc-6.4.0/gcc/tree-ssa-loop-im.c
/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/xg++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/ -B/nix/store/s670dyz8vm2mnd600l2myynsgnskfn6c-gcc-6.4.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include  -I/tmp/nix-build-gcc-6.4.0.drv-0/gcc-6.4.0/libstdc++-v3/libsupc++ -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c   -O2 -I/nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -B/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib/ -idirafter /nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -idirafter /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include-fixed -Wl,-rpath,/nix/store/grhn0xic5c6py68sb5852xvy58rq00yk-gcc-6.4.0-lib/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-rpath -Wl,/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -gtoggle -fprofile-generate -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I../../gcc-6.4.0/gcc -I../../gcc-6.4.0/gcc/. -I../../gcc-6.4.0/gcc/../include -I../../gcc-6.4.0/gcc/../libcpp/include -I/nix/store/lrw06gvflnx7kcjmli7h1p8945cg791k-gmp-6.1.2-dev/include -I/nix/store/g3496kg9vkd4n18zp94nw8hp5lkqjx2s-mpfr-3.1.3-dev/include -I/nix/store/ca7ywzdjgf98pgg26pyinkvrv1bgcglj-libmpc-1.0.3/include  -I../../gcc-6.4.0/gcc/../libdecnumber -I../../gcc-6.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-6.4.0/gcc/../libbacktrace -I/nix/store/4ij7kfj57dhxl1g9yxakrpy1f15cf5av-isl-0.14.1/include  -o tree-ssa-loop-ivcanon.o -MT tree-ssa-loop-ivcanon.o -MMD -MP -MF ./.deps/tree-ssa-loop-ivcanon.TPo ../../gcc-6.4.0/gcc/tree-ssa-loop-ivcanon.c
/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/xg++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/ -B/nix/store/s670dyz8vm2mnd600l2myynsgnskfn6c-gcc-6.4.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include  -I/tmp/nix-build-gcc-6.4.0.drv-0/gcc-6.4.0/libstdc++-v3/libsupc++ -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c   -O2 -I/nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -B/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib/ -idirafter /nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -idirafter /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include-fixed -Wl,-rpath,/nix/store/grhn0xic5c6py68sb5852xvy58rq00yk-gcc-6.4.0-lib/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-rpath -Wl,/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -gtoggle -fprofile-generate -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I../../gcc-6.4.0/gcc -I../../gcc-6.4.0/gcc/. -I../../gcc-6.4.0/gcc/../include -I../../gcc-6.4.0/gcc/../libcpp/include -I/nix/store/lrw06gvflnx7kcjmli7h1p8945cg791k-gmp-6.1.2-dev/include -I/nix/store/g3496kg9vkd4n18zp94nw8hp5lkqjx2s-mpfr-3.1.3-dev/include -I/nix/store/ca7ywzdjgf98pgg26pyinkvrv1bgcglj-libmpc-1.0.3/include  -I../../gcc-6.4.0/gcc/../libdecnumber -I../../gcc-6.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-6.4.0/gcc/../libbacktrace -I/nix/store/4ij7kfj57dhxl1g9yxakrpy1f15cf5av-isl-0.14.1/include  -o tree-ssa-loop-ivopts.o -MT tree-ssa-loop-ivopts.o -MMD -MP -MF ./.deps/tree-ssa-loop-ivopts.TPo ../../gcc-6.4.0/gcc/tree-ssa-loop-ivopts.c
/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/xg++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/./prev-gcc/ -B/nix/store/s670dyz8vm2mnd600l2myynsgnskfn6c-gcc-6.4.0/x86_64-unknown-linux-gnu/bin/ -nostdinc++ -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -B/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include/x86_64-unknown-linux-gnu  -I/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/include  -I/tmp/nix-build-gcc-6.4.0.drv-0/gcc-6.4.0/libstdc++-v3/libsupc++ -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/src/.libs -L/tmp/nix-build-gcc-6.4.0.drv-0/build/prev-x86_64-unknown-linux-gnu/libstdc++-v3/libsupc++/.libs -fno-PIE -c   -O2 -I/nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -B/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib/ -idirafter /nix/store/4nva0c0qadvi2sjjirk0wg5vr2883xy3-glibc-2.26-131-dev/include -idirafter /nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/include-fixed -Wl,-rpath,/nix/store/grhn0xic5c6py68sb5852xvy58rq00yk-gcc-6.4.0-lib/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-rpath -Wl,/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -Wl,-L/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131/lib -gtoggle -fprofile-generate -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -I. -I../../gcc-6.4.0/gcc -I../../gcc-6.4.0/gcc/. -I../../gcc-6.4.0/gcc/../include -I../../gcc-6.4.0/gcc/../libcpp/include -I/nix/store/lrw06gvflnx7kcjmli7h1p8945cg791k-gmp-6.1.2-dev/include -I/nix/store/g3496kg9vkd4n18zp94nw8hp5lkqjx2s-mpfr-3.1.3-dev/include -I/nix/store/ca7ywzdjgf98pgg26pyinkvrv1bgcglj-libmpc-1.0.3/include  -I../../gcc-6.4.0/gcc/../libdecnumber -I../../gcc-6.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-6.4.0/gcc/../libbacktrace -I/nix/store/4ij7kfj57dhxl1g9yxakrpy1f15cf5av-isl-0.14.1/include  -o tree-ssa-loop-manip.o -MT tree-ssa-loop-manip.o -MMD -MP -MF ./.deps/tree-ssa-loop-manip.TPo ../../gcc-6.4.0/gcc/tree-ssa-loop-manip.c
building of ‘/nix/store/svaqbrzsaf1yvmp9f6mmp08zr26b3lr3-gcc-6.4.0.drv’ timed out after 3600 seconds
cannot build derivation ‘/nix/store/gnn0r2q7kx3xymp0zdmjlw60bcad6lfy-gcc-wrapper-6.4.0.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/9i8xmdr2jj0abqmhqrc3s9s2zgiapq2c-stdenv-linux-boot.drv’: 1 dependencies couldn't be built
cannot build derivation ‘/nix/store/0zqi8bh3g89s2iln9h4w9nmjzz92nh9v-xz-5.2.3.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/0zqi8bh3g89s2iln9h4w9nmjzz92nh9v-xz-5.2.3.drv’ failed

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Partial log (click to expand)

cannot build derivation '/nix/store/7ddspi80c2nnkb2968k53q3bak9qc5xz-libtool-2.4.6.drv': 2 dependencies couldn't be built
cannot build derivation '/nix/store/dhgdmgjq2sjp5rv3gbvdrn23cvx2d1pg-cctools-port-895.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/g8q65162skaa4fn7f6psjq02rcfs8yf7-cctools-binutils-darwin.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/5k40zihf6flqn2d9ijs40qhdsass4k64-cctools-binutils-darwin-wrapper.drv': 5 dependencies couldn't be built
cannot build derivation '/nix/store/b0779abx444kg1c7gn1hx3a73qv1v0r9-bash-4.4-p12.drv': 3 dependencies couldn't be built
cannot build derivation '/nix/store/j0kfm0fn3m1m0x29ki8bb5f94gwalw10-binutils-wrapper-9.9.9.drv': 4 dependencies couldn't be built
cannot build derivation '/nix/store/ikplcsjj8f83zr9ia10i8rd9xk17cl1g-clang-wrapper-9.9.9.drv': 6 dependencies couldn't be built
cannot build derivation '/nix/store/yasrkayxfwwz426g545k1vhbqzp0jffk-stdenv-darwin-boot-3.drv': 9 dependencies couldn't be built
cannot build derivation '/nix/store/jwb5j3yxh0iwwnlg2hlyrs1bnh761dnx-xz-5.2.3.drv': 2 dependencies couldn't be built
error: build of '/nix/store/jwb5j3yxh0iwwnlg2hlyrs1bnh761dnx-xz-5.2.3.drv' failed

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

Can't reproduce

$ nix-store -qR $(nix-build -A xz.dev '<nixpkgs>')
/nix/store/z0b60y0khix9jb74ka56gw7b7n9s8awx-glibc-2.26-131
/nix/store/zsiv7x9m1bqnz0n554ckajgx5ck8i3kj-xz-5.2.3
/nix/store/f7jfl4ql2302g07r6hym9dgna2db7772-xz-5.2.3-bin
/nix/store/5dkhk20dcqilprqxdas5izwzz0l5a6ws-xz-5.2.3-dev

$ nix-store --version
nix-store (Nix) 1.12pre5788_e3013543

nixpkgs 2e4aded

I see no references to "bootstrap". Probably this only occurs for musl libc? I see similar fixes in nixpkgs though
a9a3ed1

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

@danbst did you build those paths yourself (using nix 1.12/2) or did you fetch them from a cache? You'll need to build yourself to see this.
FWIW xz.bin contains the references, I forget if xz.dev includes that or no.

Don't believe it has anything to do with musl other than we don't rebuild bootstrap tools often and so things like this can sneak in unnoticed. I say this because before filing this PR I tested using nixpkgs master to confirm it wasn't. ... Although it'd be good to see someone else reproduce to be sure it's not dtz-specific :).


Thanks for the link to the commit, I thought I remembered this being an issue. Hmm.

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

Yes, I've tried cached and local results:

$ nix-store -qR $(nix-build -A xz.bin '<nixpkgs>' --check 2>/dev/null)
/nix/store/z0b60y0khix9jb74ka56gw7b7n9s8awx-glibc-2.26-131
/nix/store/zsiv7x9m1bqnz0n554ckajgx5ck8i3kj-xz-5.2.3
/nix/store/f7jfl4ql2302g07r6hym9dgna2db7772-xz-5.2.3-bin

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

Hmm, thanks. 1.12 might not be new enough, including corresponding NixOS changes made for 2.0 that move to using a busybox-based /bin/sh instead of a more complete bash.

(Although to be honest I don't quite follow how that change caused this exactly but it seems much too related to be a coincidence :)).

Can someone already running Nix 2.0 using NixOS master give this a go?
I'll see if I can't find a way to reproduce more confidently, maybe some NixOS VM magic?

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

Alright, another attempt to reproduce this. You should see same result running locally, otherwise something impure is happening (well yes, master is impure...)

$ nix-shell -I nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz -p nixUnstable --run '
    nix-store -qR $(nix-build -A xz.bin -I nixpkgs=https://github.com/nixos/nixpkgs/archive/master.tar.gz "<nixpkgs>" --option sandbox true --check 2>/dev/null)
  '
/nix/store/4h0allsz28x9mdirzb4wv51algacxzr7-glibc-2.26-131
/nix/store/p8q89pf7xxy5n6j39sjsxryzy38yv2gd-xz-5.2.3
/nix/store/khh0hwhrzpmjb5fijxrcm0s1iapkl9jg-xz-5.2.3-bin

My NixOS is 18.03.pre.e860b65, not quite master though.

Which nixos commits are you talking about?

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

@danbst mostly I was referring to 700e21d. Your nixpkgs seems plenty new.

Thanks for the invocation goodness! That command produces no output for me since the --check fails :). I guess that's not what you're seeing.... probably the nix-daemon used matters, unless running as root? Either way it fails for me, hmm.

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

Ok, I'll try to update to that commit, 2.0 stuff should be so cool. In meanwhile I've stopped my nix-daemon and launched 2.0 one inside nix-shell - xz still builds for me.

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

Thank you for your heroic efforts. In an attempt to help I asked on IRC and @lheckemann was kind enough to try with latest Nix/NixOS. I believe he found that --check failed at least sometimes but that it still used /bin/sh not the bootstrap shell as I'm experiencing.

Meanwhile I'm still observing this behavior, currently using:

  • system: "x86_64-linux"
  • host os: Linux 4.15.2, NixOS, 18.03.git.9b080c3 (Impala)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.0pre5889_c287d731
  • channels(will): "allvm, nixos-1609-16.09.1943.25f4906da6, unstable-18.03pre127302.e860b651d6e"
  • channels(root): "nixos"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

I'm really not sure why I'd be seeing different behavior than you guys, but if no one else can reproduce ("until" they can) then that's good news for everyone :). Well, except me since I'm not sure I'll be able to let this go until I sort out what's going on.

@lheckemann
Copy link
Member

This was with

  • system: "x86_64-linux"
  • host os: Linux 4.9.80, NixOS, 18.03pre127302.e860b651d6e (Impala)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.0pre5889_c287d731
  • channels(root): "nixos-17.09.2987.59890bb1351"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs

building nixpkgs b1ba405; the result was that xz is apparently not deterministic (seems to vary depending on whether the sandbox is used or not. I also tried with the sandbox off, which produced the same output as the binary cache).

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

I have now

 - system: `"x86_64-linux"`
 - host os: `Linux 4.15.2, NixOS, 18.03.pre.e860b65 (Impala)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.0pre5889_c287d731`
 - channels(root): `"nixos-18.03pre127302.e860b651d6e"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`

which is similar to @lheckemann and @dtzWill
and still can't reproduce @dtzWill issue with either #34916 (comment) nor #34916 (comment)

Though I see now that --option sanbox true doesn't work, I should set this option in nix.conf, and now I also observe non-deterministic warning.

This kind of irreproducibility makes me sad, because Nix is all about reproducibility...

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

@dtzWill can you post your error log?

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

Allright, I see some progress. I've tried nix-build --check -K and then diffoscope on resulting outputs. Now I see like this:

--- /nix/store/khh0hwhrzpmjb5fijxrcm0s1iapkl9jg-xz-5.2.3-bin
+++ /nix/store/khh0hwhrzpmjb5fijxrcm0s1iapkl9jg-xz-5.2.3-bin.check
├── bin
│ ├── xzdiff
│ │ @@ -1,8 +1,8 @@
│ │ -#!/bin/sh
│ │ +#!/nix/store/d1prcspbh2qsviipvnaxizcj8l3g7fpw-bootstrap-tools/bin/sh
│ │  
│ │  # Copyright (C) 1998, 2002, 2006, 2007 Free Software Foundation
│ │  # Copyright (C) 1993 Jean-loup Gailly
│ │  
│ │  # Modified for XZ Utils by Andrew Dudman and Lasse Collin.
│ │  

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

So, I understand like this: nix builds xz locally, but doesn't replace the derivation in store with newly built one (because those should be identical, why bother replacing?). So @dtzWill and I both have different packages with same name

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

@danbst Yay! You reproduced it! :D. Thank you and I'm very relieved-- I was struggling something fierce to explain why I was seeing this and others weren't.

Also I found this from when this was previously discussed/observed: #3574 .

@danbst
Copy link
Contributor

danbst commented Feb 13, 2018

Still don't get why previous "fix" (unset CONFIG_SHELL) worked
See https://git.tukaani.org/?p=xz.git;a=blob;f=m4/posix-shell.m4;h=4c56193c1571dbf86074727a933b44c739bf70b7;hb=HEAD#l46

  45      for gl_cv_posix_shell in \
  46          "$CONFIG_SHELL" "$SHELL" /bin/sh /bin/bash /bin/ksh /bin/sh5 no; do
  47        case $gl_cv_posix_shell in
  48          /*)
  49            "$gl_cv_posix_shell" -c "$gl_test_posix_shell_script" 2>/dev/null \
  50              && break;;
  51        esac
  52      done])
  53 
  54   if test "$gl_cv_posix_shell" != no; then
  55     POSIX_SHELL=$gl_cv_posix_shell
  56     PREFERABLY_POSIX_SHELL=$POSIX_SHELL
  57   else
  58     POSIX_SHELL=
  59     PREFERABLY_POSIX_SHELL=/bin/sh
  60   fi

CONFIG_SHELL unset, but SHELL is not. Why doesn't it influence build result? Probably because when sandbox disabled, SHELL is set to /bin/sh (impure), but in sandbox it is set to some bash.

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

I have the same confusion, although I like your explanation.

@dtzWill
Copy link
Member Author

dtzWill commented Feb 13, 2018

FWIW this was merged as part of the musl PR, closing for now. Thanks everyone!

@dtzWill dtzWill closed this Feb 13, 2018
@danbst
Copy link
Contributor

danbst commented Feb 14, 2018

I've dig deeper here.

So here's what happens. Both with and without sandbox SHELL is initialized to some bash.
However xz configure script ignores it and sets it from CONFIG_SHELL. If CONFIG_SHELL is set, then it's used for all the shells.

Now, what happens when CONFIG_SHELL is unset?

  • configure scans /bin/sh, /bin/ksh, etc, then packages from PATH for available shells
  • first one which is (according to some test) compliant is used as CONFIG_SHELL (and SHELL subsequently)
  • the compliance is, however, strange. It requires some features, but values also some other features
  • in sandbox mode it chooses bash from PATH (the one from bootstrap tools), because it looks like "more featurefull" to configure. /bin/sh is a minimal ash shell from busybox (after NixOS/nix@a2d92bb)
  • in non-sandbox mode it chooses /bin/sh (because it's full-featured bash) and comes first in list.

Probably another instance of what #34628 should fix, but I'm not sure

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