1 |
Hi, sorry it took me so long to reply! |
2 |
|
3 |
I was doing something that I probably should have realized was a bad |
4 |
idea right from the start. |
5 |
|
6 |
While cross-compiling gcc (build=i686,host=arm,target=arm) I had CFLAGS |
7 |
and CXXFLAGS set - Doh!! |
8 |
|
9 |
It has nothing(?) to do with --enable-serial (which I guess I |
10 |
interpreted incorrectly anyway) |
11 |
|
12 |
Cross-compiling gcc kept failing at libiberty saying "cannot compute |
13 |
suffix of object files". And I was seeing that libiberty was being |
14 |
configured for build=i686 _and_ host=i686. |
15 |
|
16 |
What I didn't realize at first was that libiberty is configured twice |
17 |
when cross-compiling gcc. The first time for the host machine and the |
18 |
second time for the build machine. The host libiberty files are located |
19 |
in gcc-build/libiberty. The build libiberty files are located in |
20 |
gcc-build/build-i686-pc-linux-gnu/libiberty. |
21 |
|
22 |
I assumed at first it was only necessary to configure libiberty once - |
23 |
even when cross compiling gcc. When I saw it configured for the second |
24 |
time, with build=i686 and host=i686, i thought "hey a secondary stage of |
25 |
the configure process isn't realizing that i said |
26 |
host=arm-softfloat-inux-gnu the fist time!" |
27 |
|
28 |
That's why i assumed --enable-serial-host,build,target would fix my problem. |
29 |
|
30 |
Just so other people hopefully find this on Google and don't waste as |
31 |
much of their time as i did, I'm going to append all of my values below. |
32 |
|
33 |
INCORRECT: |
34 |
|
35 |
======================================================================= |
36 |
$ CXXFLAGS="-O2 -mcpu=arm920t" CFLAGS="-O2 -mcpu=arm920t" |
37 |
../gcc-4.1.2/configure ${MY_ECONF_OPTS} --build=i686-pc-linux-gnu |
38 |
--target=arm-softfloat-linux-gnu --host=arm-softfloat-linux-gnu |
39 |
--disable-checking --disable-werror --enable-secureplt |
40 |
--disable-libunwind-exceptions --disable-nls --with-float=soft |
41 |
--with-cpu=arm920t |
42 |
--with-gxx-include-dir=/usr/lib/gcc/arm-softfloat-linux-gnu/4.1.2/include/g++-v4 |
43 |
--enable-languages=c,c++,java |
44 |
======================================================================= |
45 |
|
46 |
CORRECT: |
47 |
|
48 |
======================================================================= |
49 |
$ ../gcc-4.1.2/configure ${MY_ECONF_OPTS} --build=i686-pc-linux-gnu |
50 |
--target=arm-softfloat-linux-gnu --host=arm-softfloat-linux-gnu |
51 |
--disable-checking --disable-werror --enable-secureplt |
52 |
--disable-libunwind-exceptions --disable-nls --with-float=soft |
53 |
--with-cpu=arm920t |
54 |
--with-gxx-include-dir=/usr/lib/gcc/arm-softfloat-linux-gnu/4.1.2/include/g++-v4 |
55 |
--enable-languages=c,c++,java |
56 |
======================================================================= |
57 |
|
58 |
For those interested, MY_ECONF_OPTS was from 'man 5 ebuild' (under |
59 |
econf), and the rest came from /usr/portage/eclass/toolchain.eclass. |
60 |
I removed --with-system-zlib because it caused a cross-compile error. |
61 |
|
62 |
The error that I ran into when i mistakenly issued CFLAGS as an |
63 |
environment variable was: |
64 |
|
65 |
======================================================================= |
66 |
$ make |
67 |
(everything works normally until getting to libiberty [Edit:2nd time]) |
68 |
... |
69 |
Configuring in build-i686-pc-linux-gnu/libiberty |
70 |
configure: creating cache ../config.cache |
71 |
checking whether to enable maintainer-specific portions of Makefiles... no |
72 |
checking for makeinfo... makeinfo --split-size=5000000 |
73 |
checking for perl... perl |
74 |
checking build system type... i686-pc-linux-gnu |
75 |
checking host system type... i686-pc-linux-gnu |
76 |
checking for i686-pc-linux-gnu-ar... i686-pc-linux-gnu-ar |
77 |
checking for i686-pc-linux-gnu-ranlib... i686-pc-linux-gnu-ranlib |
78 |
checking for i686-pc-linux-gnu-gcc... gcc |
79 |
checking for suffix of object files... configure: error: cannot compute |
80 |
suffix of object files: cannot compile |
81 |
See `config.log' for more details. |
82 |
make[1]: *** [configure-build-libiberty] Error 1 |
83 |
======================================================================= |
84 |
|
85 |
With config.log saying: |
86 |
|
87 |
======================================================================= |
88 |
configure:2251: checking for suffix of object files |
89 |
configure:2272: gcc -c -O2 -mcpu=arm920t conftest.c >&5 |
90 |
`-mcpu=' is deprecated. Use `-mtune=' or '-march=' instead. |
91 |
conftest.c:1: error: bad value (arm920t) for -mtune= switch |
92 |
configure:2275: $? = 1 |
93 |
======================================================================= |
94 |
|
95 |
Note to self: do not set a CFLAGS environment variable when |
96 |
cross-compiling gcc, if CFLAGS is to have _any_ architecture dependent |
97 |
flags! |
98 |
|
99 |
It's too bad that gcc doesn't use BUILD_CFLAGS and HOST_CFLAGS. I think |
100 |
Python does that, no? |
101 |
|
102 |
At least now I understand why libiberty is compiled twice though. I've |
103 |
been doing this stuff for years, and I still am finding out really |
104 |
crucially important things today! |
105 |
|
106 |
Thanks for the replies - sorry if I've confused anyone. |
107 |
|
108 |
~/Chris |
109 |
|
110 |
|
111 |
Mike Frysinger wrote: |
112 |
> On Saturday 01 September 2007, Peter Stuge wrote: |
113 |
>> On Thu, Aug 30, 2007 at 06:03:58PM -0400, Mike Frysinger wrote: |
114 |
>>> is_crosscompile is used to detect whether we're building a |
115 |
>>> cross-compiler, not whether we're cross-compiling the compiler |
116 |
>> Suggest name change to is_crosscompiler |
117 |
> |
118 |
> makes sense |
119 |
> |
120 |
>>>> The point is though, that even for straight cross-compiles it's |
121 |
>>>> usually more dependent on CHOST being set to a different |
122 |
>>>> architecture than CTARGET. |
123 |
>>> in the normal case, CTARGET is never set ... however, for all |
124 |
>>> toolchain based packages, the three tuples (CBUILD CHOST CTARGET) |
125 |
>>> are made sure to be set to the correct value |
126 |
>> What about those --enable-serial-* though? Is there a better |
127 |
>> solution for the author's problem? |
128 |
> |
129 |
> i really dont have an idea of what the problem is. i build cross-compilers |
130 |
> and cross-compile native compilers and cross-compile cross-compilers and have |
131 |
> yet to hit any problems (which are not fixed in the current tree). |
132 |
> -mike |
133 |
-- |
134 |
gentoo-embedded@l.g.o mailing list |