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

sys-devel/gcc: Fails to compile with jit USE #846

Open
TheGreatMcPain opened this issue Jun 1, 2022 · 3 comments
Open

sys-devel/gcc: Fails to compile with jit USE #846

TheGreatMcPain opened this issue Jun 1, 2022 · 3 comments

Comments

@TheGreatMcPain
Copy link
Contributor

TheGreatMcPain commented Jun 1, 2022

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

@BorisCarvajal
Copy link

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
 
 

@thesamesam
Copy link

thesamesam commented Jun 6, 2022

See discussion on Gentoo's Bugzilla. @ionenwks noticed that it's because the JIT path has --disable-bootstrap so we just happened to never hit it before.

As per my comment on Bugzilla, while this is a bug, it's niche, and you can easily avoid it by not stuffing LDFLAGS into CFLAGS unnecessarily.

@thesamesam
Copy link

thesamesam commented Aug 22, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants