sys-devel/gcc: Fails to compile with `jit` USE
TheGreatMcPain opened this issue · comments
When emerging sys-devel/gcc
with the jit
useflag it fails to configure build-jit/gcc
with this error.
checking size of int... 0
checking size of long... 0
checking for long long... yes
checking size of long long... configure: error: in `/var/tmp/portage/sys-devel/gcc-11.3.0/work/build-jit/gcc':
configure: error: cannot compute sizeof (long long)
See `config.log' for more details
make[1]: *** [Makefile:4366: configure-gcc] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-devel/gcc-11.3.0/work/build-jit'
make: *** [Makefile:956: all] Error 2
Looking at work/build-jit/gcc/config.log
I noticed it put -Wl,-Wl,--as-needed
causing ld
to fail.
configure:6293: result: 0
configure:6307: checking size of long
configure:6312: x86_64-pc-linux-gnu-g++ -o conftest -march=native -pipe -Wl,-Wl,--as-needed -O2 -static-libstdc++ -static-libgcc -Wl,-O1 -Wl,--as-needed -march=native -pipe conftest.cpp >&5
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: unrecognized option '-Wl'
/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
configure:6312: $? = 1
configure: program exited with status 1
Adding sys-devel/gcc NOLDADD=1
to package.cflags
seems to work.
I think this started happening after this commit to toolchain.eclass
.
EDIT: Here's some log files if they're needed.
emerge --info
emerge --info sys-devel/gcc
/var/tmp/portage/sys-devel/gcc-11.3.0/temp/build.log.
/var/tmp/portage/sys-devel/gcc-11.3.0/work/build-jit/gcc/config.log
Confirmed, this code path wasn't taken before the change in toolchain.eclass
and it's messing up our linker argument.
I should probably report it to gcc bugzilla.
Here is a temporary fix.
/etc/portage/patches/sys-devel/gcc/fix_sed.patch:
--- a/gcc/configure 2022-06-02 03:40:20.557616640 -0400
+++ b/gcc/configure 2022-06-02 03:41:33.216325056 -0400
@@ -5392,8 +5392,8 @@
# optimizations to be activated explicitly by the toplevel.
case "$CC" in
*/prev-gcc/xgcc*) ;;
- *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/-O[0-9]*[ ]//" `
- CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/-O[0-9]*[ ]//" ` ;;
+ *) CFLAGS=`echo "$CFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/\(^\|[ ]\)-O[0-9]*[ ]/\1/" `
+ CXXFLAGS=`echo "$CXXFLAGS " | sed -e "s/-Ofast[ ]//" -e "s/-O[gs][ ]//" -e "s/\(^\|[ ]\)-O[0-9]*[ ]/\1/" ` ;;
esac
There's a fix in ::gentoo for 10.4+/11.3+/12 now, so this can be closed. But as per my comment on Bugzilla, I'd still really suggest disabling the flag mangling from bashrc anyway.