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

Bug 367559

Summary: sys-devel/crossdev fails to build mips toolchain
Product: Gentoo Linux Reporter: Matt Turner <mattst88>
Component: New packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: mips, SebastianLuther
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: gcc stage1 config.log with --abis "n32 o32 n64"
cross-mips64el-unknown-linux-gnu-gcc-stage1.log for `crossdev -t mips64el-unknown-linux-gnu` (no --abis)
config.log for `crossdev -t mips64el-unknown-linux-gnu` (no --abis)

Description Matt Turner gentoo-dev 2011-05-16 17:47:44 UTC
Trying to build cross-mips64el-unknown-linux-gnu/glibc-2.13-r2 on my amd64 desktop:

 * Building multilib glibc for ABIs: x86 amd64

 *             ABI:   x86
 *          CBUILD:   x86_64-pc-linux-gnu
 *           CHOST:   x86_64-pc-linux-gnu
 *         CTARGET:   mips64el-unknown-linux-gnu
 *      CBUILD_OPT:   
 *     CTARGET_OPT:   i686-pc-linux-gnu
 *              CC:   mips64el-unknown-linux-gnu-gcc -m32
 *          CFLAGS:   -O2 -fno-strict-aliasing
 *       Manual CC:   mips64el-unknown-linux-gnu-gcc -m32

I don't see this bug when building cross-alpha-unknown-linux-gnu/glibc-2.13-r2, I'd imagine because alpha only has a single ABI.
Comment 1 SpanKY gentoo-dev 2011-06-07 20:06:57 UTC
is your crossdev up-to-date ?  are you upgrading glibc, or doing it fresh ?

crossdev -C mips64el && crossdev mips64el
Comment 2 Matt Turner gentoo-dev 2011-06-15 00:49:31 UTC
Yeah, crossdev is 20110310. Tried wiping out all the mips crossdev installations and starting over.

I even tried package.use.mask'ing cross-mips64-unknown-linux-gnu/glibc/glibc multilib. When I do that, it selects the 'amd64' ABI. So, it's picking up the host's ABI instead of the target architecture's.
Comment 3 SpanKY gentoo-dev 2011-07-05 06:46:13 UTC
your output looked weird to me, so i tried on my side.  then i realized the multilib fixes i had i didnt push out.

see if crossdev-20110705 works any better.
Comment 4 Matt Turner gentoo-dev 2011-07-05 20:40:49 UTC
The build succeeds, but it didn't produce anything but n32 libs, even though USE="multilib" was set.
Comment 5 Matt Turner gentoo-dev 2011-07-05 20:41:14 UTC
*** Bug 373815 has been marked as a duplicate of this bug. ***
Comment 6 SpanKY gentoo-dev 2011-07-05 21:31:31 UTC
that is expected behavior now.  USE=multilib in the host build env is ignored by crossdev.  if you dont specify the ABIs to crossdev with --abis, then you only get the default one.
Comment 7 Matt Turner gentoo-dev 2011-08-15 21:35:38 UTC
Created attachment 283477 [details]
gcc stage1 config.log with --abis "n32 o32 n64"

This log shows that crossdev (or something) tries to pass -mabi= to the host compiler, which is an unknown flag, causing it to fail.

This also happens if you pass one or two ABIs to crossdev.
Comment 8 Matt Turner gentoo-dev 2011-08-15 21:48:48 UTC
Created attachment 283501 [details]
cross-mips64el-unknown-linux-gnu-gcc-stage1.log for `crossdev -t mips64el-unknown-linux-gnu` (no --abis)
Comment 9 Matt Turner gentoo-dev 2011-08-15 21:50:39 UTC
Created attachment 283503 [details]
config.log for `crossdev -t mips64el-unknown-linux-gnu` (no --abis)
Comment 10 Matt Turner gentoo-dev 2011-10-30 03:21:12 UTC
(In reply to comment #7)
> Created attachment 283477 [details]
> gcc stage1 config.log with --abis "n32 o32 n64"
> 
> This log shows that crossdev (or something) tries to pass -mabi= to the host
> compiler, which is an unknown flag, causing it to fail.
> 
> This also happens if you pass one or two ABIs to crossdev.

conftest.c:1:0: error: unknown ABI (n32) for -mabi= switch

This is still the case with sys-devel/crossdev-20111018, same as it was two and a half months ago.

Any work on this, vapier?

This is easily reproducible with crossdev --abis "n32 o32 n64" -t mips64-unknown-linux-gnu.
Comment 11 Matt Turner gentoo-dev 2012-01-26 03:52:54 UTC
vapier?
Comment 12 Joshua Kinard gentoo-dev 2012-02-01 19:29:48 UTC
Try passing --without-headers.  I don't recall if that's what gcc stage1 whines about or not, but MIPS stage1/2 cross-toolchains can be built w/o requiring the glibc headers being present first.
Comment 13 SpanKY gentoo-dev 2012-03-02 05:44:35 UTC
just tried it on my system.  default works fine (so only n32).  compiling for o32/64 fails to link, but the compile flag works.

# crossdev mips64el-unknown-linux-gnu
# echo 'main(){}' | mips64el-unknown-linux-gnu-gcc -x c - -o a.out
# file a.out
a.out: ELF 32-bit LSB executable, MIPS, N32 MIPS-III version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x1040000, not stripped

then building for all abis worked too.  so i guess there's nothing to be done here ... upgrade :P.

# crossdev --abis 'n32 o32 n64' mips64el-gentoo-linux-gnu
# echo 'main(){}' | mips64el-gentoo-linux-gnu-gcc -x c - -o a.out
# file a.out
a.out: ELF 32-bit LSB executable, MIPS, N32 MIPS-III version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x1040000, not stripped

# echo 'main(){}' | mips64el-gentoo-linux-gnu-gcc -x c - -o a.out -mabi=n32
# file a.out
a.out: ELF 32-bit LSB executable, MIPS, N32 MIPS-III version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x1040000, not stripped

# echo 'main(){}' | mips64el-gentoo-linux-gnu-gcc -x c - -o a.out -mabi=32
# file a.out
a.out: ELF 32-bit LSB executable, MIPS, MIPS-I version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x1040000, not stripped

# echo 'main(){}' | mips64el-gentoo-linux-gnu-gcc -x c - -o a.out -mabi=64
# file a.out
a.out: ELF 64-bit LSB executable, MIPS, MIPS-III version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, with unknown capability 0x756e670000000f41 = 0x104000000070100, not stripped
Comment 14 SpanKY gentoo-dev 2012-03-02 05:45:29 UTC
oh, and for reference, here's what i'm using:

cross-mips64el-gentoo-linux-gnu/binutils-2.22-r1
cross-mips64el-gentoo-linux-gnu/gcc-4.5.3-r2
cross-mips64el-gentoo-linux-gnu/glibc-2.13-r4
cross-mips64el-gentoo-linux-gnu/linux-headers-3.2-r1