Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 454138 - Cross-building native 32-bit gcc fails on 64-bit system
Summary: Cross-building native 32-bit gcc fails on 64-bit system
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL: http://gcc.gnu.org/ml/gcc/2010-08/msg...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-26 12:10 UTC by James Le Cuirot
Modified: 2013-01-26 16:58 UTC (History)
1 user (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 James Le Cuirot gentoo-dev 2013-01-26 12:10:09 UTC
Trying to cross-build a native gcc into a ROOT for ARM (I tried armv6j-hardfloat-linux-gnueabi and armv7a-hardfloat-linux-gnueabi) on x86_64-pc-linux-gnu results in the following error...

../../gcc/real.h: error: size of array `test_real_width' is negative

This is not a new problem and I have found several people reporting the problem over the past 10 years. Back then, the problem was actually reversed as people were trying to build for SPARC64 on x86. The URL above is a more recent example like mine. In the SPARC64 case, it was suggested to use a 64-bit compiler. In the ARM case, it was suggested to use -m32. I think gcc should be able to deal with this properly but these suggestions are certainly easier. I was able to build for both the ARM targets by simply setting CFLAGS_FOR_BUILD="-m32". It would be nice if toolchain.eclass did this automatically but I can't think of a good general way to achieve it. Any ideas?
Comment 1 James Le Cuirot gentoo-dev 2013-01-26 15:10:54 UTC
It's probably worth mentioning that I just hit the equivalent problem with Python 3...

LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)

And I was able to workaround it in the same manner, applying -m32 to CFLAGS and LDFLAGS in the "cross-configure" step. A proper solution would be very helpful.
Comment 2 James Le Cuirot gentoo-dev 2013-01-26 15:34:30 UTC
Aha, just found a much better fix in Python's case. I'll file a separate bug report for that.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-26 15:52:22 UTC
1) Please post your `emerge --info' output in a comment.
2) Please attach the entire build log to this bug report.
Comment 4 James Le Cuirot gentoo-dev 2013-01-26 16:41:36 UTC
Never mind. I decided to make doubly sure that it wasn't my own cross-building scripts causing the problem and it turns out it was. I try not to do anything too outlandish but it turns out merely setting CONFIG_SITE to some value breaks it, even if you set it to /usr/share/config.site, which is what it uses by default. Very odd. Please close this as invalid. Sorry for the noise.