Michael Witten wrote:
On 28 Jan 2008, at 6:44 PM, Wenton L. Davis wrote:
John Carter wrote:
It's a _very_ dark art....
No kidding!!!!
I disagree wholeheartedly.
Creating a cross compiler _should_ be the easiest
thing in the world, but the gcc is so backasswards
that it can be troublesome.
I definitely agree that this should be one of the simplest tasks,
because it's so vital. I will say that building the native compiler was
1..2..3.. simple. I got the kernal to compile more easily than this!
Last time I did it, I found I had to have the binutils --prefix
directory
the same --prefix as the compiler.
This is definitely the case; gcc is really just an
interface to a bunch of different tools, so it needs
to know where to find those tools.
It would be nice if there were a configure directive
to specify the location of binutils tools for greater
flexibility. For now, just make --prefix the same for
both.
In any case, you're supposed to be able to put the
binutils source subdirectories (gprof, opcodes,
bintutils, ...) inside the top level of the gcc source
code so that one configure invocation handles both; both
source trees are actually 2 separate views of a larger
tree.
I'm not sure I understand you clearly. Right now, in my /mnt/tmp
directory, I have a binutils-2.18.50 directory, and a gcc-4.1.2
directory (and all the others that were results of building). Are you
saying the binutils directory should be moved up into the gcc-4.1.2
directory?
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. (?!?!?)
Do you need libc on these other targets? If not, use
--without-headers to indicate that you have no intention
of building libc or the runtime libraries like libstdc++.
See below.
Well, the answer to this is "eventually." For now, just the compiler is
needed, and eventually, I will need the libc. I suppose that if I can
get the compiler built, I'll be able to use it to build the libc.
(Since most of my targets communicate via RS-232c, libc will need to be
customized anyway.)
So, I went ahead with the --without-headers, and I eliminated the
--enable-threads and --enable-shared. Now, I run make, and I see
several of these:
Next, I had to disable libssp because it failed (because it needs
libc?) Not happy about eliminating this, but I'll deal with it.
and viola! there it is! I had to do a "echo $?" just to make sure I
wasn't imagining things!
My final configure command line was:
../gcc-4.1.2/configure --prefix=/mnt/tmp --program-prefix=mips-elf-
--target=mips-elf --enable-languages=c --disable-checking --verbose
--without-headers --disable-nls --disable-libssp
Now, I am assuming that this is just about the bare-bones compiler, but
I have something I can work with now.
THANKS ALL!!!!
I will go ahead and try John's scripts and see how they work for me, but
now that I can at least get something working, I have a better (slightly
better) clue what I'm doing.
Just for the sake of neatness, here's what I did (either run as root or
use sudo for the install steps!):
export DESTINATION=/usr/local
export TARGET=mips-elf
mkdir objdir
tar jxvf binutils-2.18.50.tar.bz2
tar zxfv gcc-core-4.1.2.tar.gz [&& other gcc-(lang)-4.1.2.tar.gz optional]
cd objdir
../binutils-2.18.50/configure --prefix=$DESTINATION \
--target=$TARGET --program-prefix=$(TARGET)-
make
make install
../gcc-4.1.2/configure --prefix=$DESTINATION \
--program-prefix=$(TARGET)- --target=$TARGET \
--enable-languages=c --without-headers --disable-nls --disable-libssp
make
make install
I hope this helps someone. Thanks, again, everyone that helped me!
(Still open to suggestions on building the various libc's! :-) )
Wenton L. Davis
wenton@xxxxxxxx