From 41b146ff40ade8fea42addebc2f5bc7a36a154f9 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Thu, 6 Jul 2023 23:28:09 +0100 Subject: [PATCH] gcc: restore 'Configured with:' output on 'gcc -v' output When reporting 'gcc' bugs upstream I'm occasionally asked for the actual configure flags I used to build gcc. Before the change `gcc -v` always reported empty string: $ gcc -v ... Target: x86_64-unknown-linux-gnu Configured with: After the change `gcc -v` contains original options with slightly mangled nix store paths to avoid build-only dependency retention: $ gcc -v ... Target: x86_64-unknown-linux-gnu Configured with: ../source/configure --prefix=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gcc-14.0.0 --with-gmp-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-6.2.1-dev/include --with-gmp-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gmp-6.2.1/lib --with-mpfr-include=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.0-dev/include --with-mpfr-lib=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-mpfr-4.2.0/lib --with-mpc=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libmpc-1.3.1 --with-native-system-header-dir=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-glibc-2.37-8-dev/include --with-build-sysroot=/ --program-prefix= --enable-lto --disable-libstdcxx-pch --without-included-gettext --with-system-zlib --enable-checking=release --enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin --disable-libcc1 --with-isl=/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-isl-0.20 --disable-bootstrap --build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu --target=x86_64-unknown-linux-gnu While a bit verbose I think it's useful to see how we build gcc. --- pkgs/development/compilers/gcc/builder.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index 5147df1e4cc0d..75ff2a1317a64 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -185,8 +185,9 @@ preConfigure() { postConfigure() { - # Don't store the configure flags in the resulting executables. - sed -e '/TOPLEVEL_CONFIGURE_ARGUMENTS=/d' -i Makefile + # Avoid store paths when embedding ./configure flags into gcc. + # Mangled arguments are still useful when reporting bugs upstream. + sed -e "/TOPLEVEL_CONFIGURE_ARGUMENTS=/ s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" -i Makefile }