Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 723478

Summary: sys-devel/crossdev: building gcc fails when AR, NM & RANLIB set in /etc/portage/make.conf
Product: Gentoo Linux Reporter: Mike Lothian <mike>
Component: Current packagesAssignee: Gentoo Crossdev team <crossdev>
Status: UNCONFIRMED ---    
Severity: normal CC: cross, jstein
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Stage 2 build error

Description Mike Lothian 2020-05-17 11:07:06 UTC
Stage 2 gcc fails with missing symbols 

I eventually figured out it was because these were set in my /etc/portage/make.conf

AR="gcc-ar"
NM="gcc-nm"
RANLIB="gcc-ranlib"

Is there a way crossdev could warn they are set, or override them to the correct values, this took a very long time to figure out what was causing the failure

Error attached

It happened with gcc-9.3.0 too

I also had issues if default-gold was set on binutils, I think gcc normally forces ld.bfd when it's built

Reproducible: Always
Comment 1 Mike Lothian 2020-05-17 11:07:37 UTC
Created attachment 639802 [details]
Stage 2 build error
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-24 10:41:06 UTC
Yeah, cross-x86_64-w64-mingw32/gcc is tricky. It's techicaly a package that is not cross-compiled, but is a cross-compiler itself. It has to distinct between AR_FOR_BOUL/AR_FOR_HOST/AR_FOR_TARGET. I think AR= makes all 3 being lumped together.

I need to explore it a bit more but it's probably 2 things:
- toolchain.eclass assumes AR= to be applied for HOST
- toolchain-funcs.eclass's tc-getAR has a nasty fallback from CTARGET to CHOST of CTARGET is not present.