This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Building a cross-compiler


John Carter wrote:

It's a _very_ dark art....
No kidding!!!!

Some hints:...


There is a nasty tangly dependency between binutils, libc and the
compiler.

Last time I did it, I found I had to have the binutils --prefix directory
the same --prefix as the compiler.

At first, I thought that might be the problem because once I "test"-built that, I reconfigured and rebuilt and installed into the /usr/local. So, I went back to building the binutils and kept them in the /mnt/tmp directory, then tried to build gcc on top of that. For some reason, it failed because it couldn't create a file in the gcc/libiberty/pic directory (because the directory didn't exist) so I created the gcc/libiberty/pic directory, and make was able to continue, but I still ended up with the same problem. (the unistd.h and pthreads.h files missing)

At this point, I tried the brute force, copying the exact command line, but adding to it the -I../../(etc) to find the unistd.h and pthreads.h, but it failed because of an #endif without #if error... I thought I'd manually modify this file, but it was automagically created by fixincludes. (?!?!?)
You then need to have the target libc in the appropriate level of the
gcc src tree. Your error messages suggest to me you either don't have
a libc build, or have it at the wrong level.

OK, this could very easily be the problem. I was assuming this was built as a part of the gcc build, but that does not appear to be the case. But if the compiler needs libc to build, and libc is built by compiling.... which came first, the chicken or the egg?

I found I couldn't build it "out the box" for the variants I was building for, I had to find and apply some patches. (Not too surprising, given the combinatorial explosion of host os X host CPU X target os X target CPU X libc implementation X libc version X binutils version, they simply can't test everything.)

I absolutely agree... there must be several thousand combinations. I sometimes wonder if this works against the linux community rather than for it?
Good Luck! I can email you my scripts for building things, can't
guarantee they'll work for you though! Being in Ruby, I find them easy to
read / maintain than the cross gcc shell script project.

Well, I'm not real familiar with ruby (it's on my list of languages to look at), but I can't imagine it's so bizarre I can't glean a little info from it. If you would please, send me your scripts, and even if they don't work, they might give me some more ideas. Thanks!

Wenton L. Davis
wenton@ieee.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]