Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stdenv/linux/default.nix: add gcc rebuild during bootstrap
before the change our rebuild chain was roughly the followin: - `bootstrapTools` install - `binutils` built by `bootstrapTools` - `glibc` built by `bootstrapTools` - `gcc` built by `bootstrapTools` As a result `glibc` contained code generated by `bootstrapTools`'s `gcc`. And (what worse) colied `libgcc_s.so.1` as is from it. Such `libgcc_s.so.1` was not compatible with `nixpkgs` `gcc` at least on `aarch64` where newer `libgcc` is expected to have new symbols. As a result linking failed as: ld: /build/test.o: in function `foo(int)': test.cpp:(.text+0x2c): undefined reference to `__aarch64_ldadd4_acq_rel' collect2: error: ld returned 1 exit status The change rejigs rebuild sequence as: - `bootstrapTools` install - `binutils` built by `bootstrapTools` - `gcc` built by `bootstrapTools` - `glibc` built by `gcc` - `gcc` built by `gcc` As a result `glibc` gets built by fresher `gcc` and embeds a copy of `libgcc_s.so.1`. To make it work as is I had to use a --sysroot=<invalid path> to evade accidental pull of system headers embedded by `gcc`. While at it decreased rebuild counts for `bash` and `xz`. These are simple tools we can use as is built by `bootstrapTools` until we build final stage. List of packages with more than one build before the change: $ nix-store --query --graph $(nix-instantiate -A stdenv) | grep -P " -> " | awk '{print $3}' | sort -u | sed 's/"[0-9a-z]\{32\}-/"/g' | sort | uniq -c | sort -n | awk '$1 > 1' 2 "autoconf-2.71.drv" 2 "automake-1.16.5.drv" 2 "bootstrap-stage1-stdenv-linux.drv" 2 "bootstrap-stage2-stdenv-linux.drv" 2 "bootstrap-stage4-stdenv-linux.drv" 2 "bzip2-1.0.8.drv" 2 "file-5.43.drv" 2 "help2man-1.49.2.drv" 2 "hook.drv" 2 "libtool-2.4.7.drv" 2 "patchelf-0.15.0.drv" 2 "perl5.36.0-gettext-1.07.drv" 3 "binutils-2.39.drv" 3 "binutils-wrapper-2.39.drv" 3 "expand-response-params.drv" 3 "gettext-0.21.drv" 3 "libxcrypt-4.4.33.drv" 3 "perl-5.36.0.drv" 3 "texinfo-6.8.drv" 3 "zlib-1.2.13.drv" 4 "bash-5.1-p16.drv" 4 "xz-5.2.9.drv" List of packages with more than one build after the change: $ nix-store --query --graph $(nix-instantiate -A stdenv) | grep -P " -> " | awk '{print $3}' | sort -u | sed 's/"[0-9a-z]\{32\}-/"/g' | sort | uniq -c | sort -n | awk '$1 > 1' 2 "autoconf-2.71.drv" 2 "automake-1.16.5.drv" 2 "bash-5.2-p15.drv" 2 "bootstrap-stage1-stdenv-linux.drv" 2 "bootstrap-stage2-stdenv-linux.drv" 2 "bootstrap-stage3-stdenv-linux.drv" 2 "bootstrap-stage5-stdenv-linux.drv" 2 "bzip2-1.0.8.drv" 2 "file-5.43.drv" 2 "gcc-11.3.0.drv" 2 "gmp-with-cxx-6.2.1.drv" 2 "help2man-1.49.2.drv" 2 "hook.drv" 2 "libtool-2.4.7.drv" 2 "mpfr-4.1.1.drv" 2 "patchelf-0.15.0.drv" 2 "perl5.36.0-gettext-1.07.drv" 2 "texinfo-6.8.drv" 2 "which-2.21.drv" 2 "xz-5.4.0.drv" 3 "perl-5.36.0.drv" 4 "binutils-2.39.drv" 4 "binutils-wrapper-2.39.drv" 4 "expand-response-params.drv" 4 "gettext-0.21.drv" 4 "libxcrypt-4.4.33.drv" 4 "zlib-1.2.13.drv"
- Loading branch information