Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 235551 - cross-mips*/glibc-headers fails
Summary: cross-mips*/glibc-headers fails
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 230505 294347 323737 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-23 18:17 UTC by Joshua Kinard
Modified: 2011-03-20 21:38 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Kinard gentoo-dev 2008-08-23 18:17:55 UTC
It appears the latest crossdev forces the building of glibc headers because gcc-4.3 relies on them more.  However, for mips, it appears that either crossdev or glibc itself is passing the wrong args to the HOSTCC, causing the configure script to fail:

configure:3297: checking for suffix of object files
configure:3323: gcc -c -O1 -pipe  -mabi=n32 conftest.c >&5
cc1: error: unrecognized command line option "-mabi=n32"
configure:3326: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "GNU C Library"
| #define PACKAGE_TARNAME "c-library"
| #define PACKAGE_VERSION "(see version.h)"
| #define PACKAGE_STRING "GNU C Library (see version.h)"
| #define PACKAGE_BUGREPORT "glibc"
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:3341: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.

-mabi=n32 only works when sent to a mips toolchain.  I suspect this is glibc's fault, but crossdev probably needs to account for it and somehow strip that parameter off.
Comment 1 cyrillic 2008-08-24 04:18:11 UTC
(In reply to comment #0)
> -mabi=n32 only works when sent to a mips toolchain.

That is correct.  You need to build a cross-gcc before you can build cross-glibc or cross-glibc-headers.

Take a look here for a workaround :
http://forums.gentoo.org/viewtopic-t-699683.html
Comment 2 Arun Raghavan (RETIRED) gentoo-dev 2008-08-24 06:30:40 UTC
Test comment to see if there's a bugzie issue around.
Comment 3 Arun Raghavan (RETIRED) gentoo-dev 2008-08-24 06:30:40 UTC
Test comment to see if there's a bugzie issue around.
Comment 4 Joshua Kinard gentoo-dev 2008-08-24 17:26:36 UTC
(In reply to comment #1)
>> -mabi=n32 only works when sent to a mips toolchain.
> 
> That is correct.  You need to build a cross-gcc before you can build
> cross-glibc or cross-glibc-headers.
> 
> Take a look here for a workaround :
> http://forums.gentoo.org/viewtopic-t-699683.html

I should have stated this is a stage1 compiler, so it's C-Only and for kernel cross-compiles, so I didn't even have the cross-gcc built yet.  Only binutils.  Using emerge outside of crossdev got gcc to build fine without headers, so we just have to skip that step on mips it looks.  Crossdev's code looks like it supports skipping headers based on arch, but I'll have to look at it more closely and see if that's possible or not.
Comment 5 SpanKY gentoo-dev 2008-09-17 09:28:58 UTC
crossdev doesnt set any env var
Comment 6 Joshua Kinard gentoo-dev 2008-09-18 03:01:36 UTC
Is there a mechanism in crossdev that lets us bypass the glibc-headers stage?  I managed to kludge crossdev through a build, and it popped out a working kernel toolchain, so I think for mips, we can just bypass this step.
Comment 7 cyrillic 2008-09-19 05:33:55 UTC
(In reply to comment #9)
> Is there a mechanism in crossdev that lets us bypass the glibc-headers stage? 

Yes, it is called --without-headers

ps.  It would save a bunch of people a little bit of typing if --without-headers was the default for crossdev. 

Comment 8 SpanKY gentoo-dev 2008-10-27 05:25:18 UTC
and then you'd turn around and break everyone who attempted to use gcc-4.3.  i dont think so.
Comment 9 cyrillic 2008-11-09 05:03:48 UTC
crossdev + gcc-4.3 is broken anyway due to circular dependencies,
and the default crossdev --with-headers always fails if you don't already have a crosscompiler installed for that target.

amd64-multilib host --> x86 target is a special case that does not fail when you use --with-headers because the multilib toolchain already provides a crosscompiler (which makes crossdev redundant, in theory).

ps. I still find crossdev very useful.  I just use --without-headers and a 2 pass approach in order to get around the problems with gcc-4.3
Comment 10 SpanKY gentoo-dev 2008-11-09 07:20:53 UTC
this bug is about mips only ... do not spam completely unrelated topics
Comment 11 cyrillic 2008-11-10 23:38:16 UTC
I just verified a few minutes ago that crossdev + gcc-4.3.2 + mips target fails on the libc-headers part with the exact same error as the original poster.
Comment 12 Ferris McCormick (RETIRED) gentoo-dev 2008-11-12 20:23:56 UTC
Please compare with Bug #246339 which demonstrates a similar problem building for a sparc target on an amd64 host (here, the compiler is gcc-4.1.2).
Comment 13 SpanKY gentoo-dev 2008-12-08 01:43:34 UTC
*** Bug 230505 has been marked as a duplicate of this bug. ***
Comment 14 Zhang Le (RETIRED) gentoo-dev 2009-01-21 22:27:45 UTC
http://sources.redhat.com/cgi-bin/cvsweb.cgi/ports/sysdeps/mips/preconfigure?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=glibc&only_with_tag=HEAD

Just found the cause is CPPFLAGS contains -mabi=n32.
I really don't understand why CPPFLAGS should be like this.

Maybe this would be a workaround:
sed -i 's/-mabi=$mips_config_abi//g' ports/sysdeps/mips/preconfigure

I haven't tested it though. I will test it and report the result
Comment 15 Zhang Le (RETIRED) gentoo-dev 2009-01-22 22:25:46 UTC
just modify this file ports/sysdeps/mips/preconfigure is not enough.
There are some other problems.
I will try to fix it ASAP and write a summary about it.
Comment 16 Adam Nielsen 2009-11-24 22:17:42 UTC
*** Bug 294347 has been marked as a duplicate of this bug. ***
Comment 17 Ling Kun 2010-01-06 09:35:17 UTC
 I find a solution here  http://www.lingcc.com/2010/01/06/10594/
The detail is edit the src_compile.eblit in /usr/portage/sys-libs/glibc/  . And You can find more in gentoo loongson overlay,the modification below was based on the overlay's ebuild. I have tested it,It works fine for me.

files/eblits/src_compile.eblit
160a161,167
+ if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then
+ # remove "-32" gcc switch, since gcc for other arch don't have this
+ sed -i '2 s/-mabi=32//g' "${S}"/ports/sysdeps/mips/mips32/Makefile
+ # fix stdio_lim.h missing problem
+ sed -i 's/_MIPS_SZPTR/32/' "${S}"/ports/sysdeps/mips/bits/wordsize.h
+
+ fi
files/eblits/src_install.eblit
203a204,207
+ if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then
+ sed -i 's/\(__WORDSIZE.\+\)\(32\|64\)$/\1_MIPS_SZPTR/' \
+ "${D}"/$(alt_headers)/bits/wordsize.h || die "restore wordsize.h failed"
+ fi


Comment 18 Ling Kun 2010-01-06 09:37:10 UTC
(In reply to comment #17)
>  I find a solution here  http://www.lingcc.com/2010/01/06/10594/
> The detail is edit the src_compile.eblit in /usr/portage/sys-libs/glibc/  . And
> You can find more in gentoo loongson overlay,the modification below was based
> on the overlay's ebuild. I have tested it,It works fine for me.
> 
> files/eblits/src_compile.eblit
> 160a161,167
> + if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then
> + # remove "-32" gcc switch, since gcc for other arch don't have this
> + sed -i '2 s/-mabi=32//g' "${S}"/ports/sysdeps/mips/mips32/Makefile
> + # fix stdio_lim.h missing problem
> + sed -i 's/_MIPS_SZPTR/32/' "${S}"/ports/sysdeps/mips/bits/wordsize.h
> +
> + fi
> files/eblits/src_install.eblit
> 203a204,207
> + if [[ ${CTARGET} == "mipsel-unknown-linux-gnu" ]] ; then
> + sed -i 's/\(__WORDSIZE.\+\)\(32\|64\)$/\1_MIPS_SZPTR/' \
> + "${D}"/$(alt_headers)/bits/wordsize.h || die "restore wordsize.h failed"
> + fi
> 

This change is for O32. Please look into the ebuild if you want know the change on N32.  
Hope this can help you :)
Comment 19 SpanKY gentoo-dev 2011-03-11 02:40:26 UTC
well mips is a huge pita to crack for headers targets.  it likes to throw -mabi= everywhere possible, and basically refuses to build unless that is defined.

http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_unpack.eblit?r1=1.11&r2=1.12
http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_compile.eblit?r1=1.16&r2=1.17
http://sources.gentoo.org/sys-libs/glibc/files/eblits/src_install.eblit?r1=1.12&r2=1.13
Comment 20 SpanKY gentoo-dev 2011-03-20 21:38:50 UTC
*** Bug 323737 has been marked as a duplicate of this bug. ***