[BusyBox] Is it a cross-compiler problem?

Xiaogeng (Shawn) Jin xjin at redswitch.com
Thu Aug 1 21:14:03 UTC 2002


I tried to use the cross gcc-2.95.3 that I built to compile 
busybox-0.60.1 and have a very strange problem.

I just followed the instructions 
(http://billgatliff.com/twiki/bin/view/Crossgcc/BuildToolchainScript) 
step by step to build my cross gcc (powerpc-linux). It looks successful. 
But when using it to compile busybox-0.60.1's 'mount.c', I encountered 
an error message 
(http://www.geocities.com/shawnxjin/crossgcc/rs-bb.txt). It complains 
that 'PATH_MAX' is not definied, which is defined in <linux/limits.h>, 
which is included in <bits/local_lim.h>, which is included in 
<bits/posix1_lim.h>, which is include in <limits.h> that 'mount.c' 
includes. Let me rephrase it. A->B means B includes A.
<linux/limits.h> -> <bits/local_lim.h> -> <bits/posix1_lim.h> -> 
<limits.h> -> 'mount.c'.

Well, I tried the ELDK (http://www.denx.de) cross gcc to compile the 
file. It passed. Here is the result 
(http://www.geocities.com/shawnxjin/crossgcc/eldk-bb.txt). The only 
difference between them is that ELDK cross gcc uses one more switch 
"-D_SOFT_FLOAT". But finally it's not this factor that causes the 
trouble. Then I traced into those headers. It seems to me that somehow 
my cross gcc didn't define '_POSIX_SOURCE' or '_GNU_SOURCE', which is 
supposed to be defined by user or compiler. These two macros will turn 
on '__USE_POSIX", which in turn includes <bits/posix1_lim.h> in 
<limits.h>. The more strange thing is that even if I add 
"-D_POSIX_SOURCE" or "_D_GNU_SOURCE", it doesn't work.

Why? Later I tried to another c file and the compiler complains that 
'LINE_MAX' is not defined, which is defined in <bits/posix2_lim.h>. So I 
believe that my cross gcc is unable to define such macros as 
'_POSIX_SOURCE' or '_GNU_SOURCE' implicitly, which may be supposed to be 
done. But how come this happens?

Nobody who successfuly built a cross gcc (powerpc-linux) have ever run 
into such problems? Why am I so 'lucky'? :(((

Any help is highly appreciated.

- Shawn.




More information about the busybox mailing list