still can't build cross compiler --target=i686-pc-linux-gnu on solaris
David Thompson
David.Thompson@efi.com
Wed Sep 19 23:01:00 GMT 2001
Title: still can't build cross compiler --target=i686-pc-linux-gnu on solaris
Hi all,
I continue to need this group's help, I'm still unable to
get my cross-compiler targeting linux running on solaris.
I just don't understand enough, if anyone has *any* notes
specific to building a cross-compiler on solaris (to be
hosted by solaris) but targeted for linux, I'd be most
appreciative of your notes.ÃÂ (I hope someone has some
really good solaris->linux notes somewhere, but beggars
can't be choosers, so I'll gladly take anything.)
I'm trying to build gcc-2.95.3 and binutils-2.10.1 on a
solaris box using --target=i686-pc-linux-gnu and although
I seem to get the compiler to build (finally), I have no
confidence I've done it right, esp with ld errors saying
can't find crt1.o, and now, libc.so.6, which is my current
problem.
I've been using http://www.objsw.com/CrossGCC/ and everything
else I can find, but nothing seems to address all the problems
I seem to encounter.ÃÂ I appreciate everyone suggesting new
URLs to read, but none of these seem to address the nittiest
of the grittiest details.
How specifically do I setup the target includes and the target
libraries when building the cross-compiler?ÃÂ Where do I get
the linux libraries from?ÃÂ Do I take /usr/lib or /lib from my
linux box?ÃÂ And what subdirs can I exclude?ÃÂ When I tar and
gzip /usr/lib on my linux box, I have a 93Mb tar file, surely
I don't need all those?
To me, it looks like I need both /lib and /usr/lib, but how do
I tell configure which one is which?ÃÂ configure has --with-includes
but only one --with-libs option.ÃÂ I've had people reply to me
that --with-include and --with-libs is "very bad hacking", and
that I should just copy them to where they are supposed to go,
of which I'm unable to infer until an error occurs, but the /lib
vs /usr/lib question (do I need them? where should they be copied
to? what do I need? what can I exclude?), I am finding way too
little information about this subtle but important requirement of
target libraries.ÃÂ Are there any rules and guidelines that have
been written that apply to *all* platforms?ÃÂ I mean, doesn't
every builder of a cross-compiler need to get the target
machine's headers and libraries and make them available
for the configure & building of the cross-compiler?ÃÂ How
does one know which headers and libraries one needs?ÃÂ Where
doee one know to get them from, how does one know what he needs,
where does one put them so that configure can find them?
I feel like I'll be experimenting forever hoping that I might
stumble upon something that works.
When I run the cross compiler, it fails to link with this error,
$ cd /home/davidt/gnu/bin-a4/bin
$ ./i686-pc-linux-gnu-gcc ~/tmp/x.c
/home/davidt/gnu/bin-a4/i686-pc-linux-gnu/bin/ld: cannot find /lib/libc.so.6
collect2: ld returned 1 exit status
Here is my last script that successfully builds a cross-compiler,
by 'successful' I mean it produces a gcc that says the target
machine when I use the -dumpmachine option,
$ cd /home/davidt/gnu/bin-a4/bin
$ ./i686-pc-linux-gnu-gcc -dumpmachine
i686-pc-linux-gnu
Note that I'm quite certain something is wrong with this script,
but I don't know where else to study & learn the Principles of
Building a GCC Cross-Compiler.ÃÂ I'm sure my error is probably
due to the target libraries, see lines 46 and 48 below,
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 1 #!/bin/sh
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 2
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 3 GCC=gcc-2.95.3
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 4 BINUTILS=binutils-2.10.1
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 5
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 6 gcc_targz=/home/davidt/gnu/tar/$GCC.tar.gz
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 7 binutils_targz=/home/davidt/gnu/tar/$BINUTILS.tar.gz
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 8 #set linuxinc_tar=/home/davidt/gnu/tar/linux.tar
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ 9 linuxinc_targz=/home/davidt/gnu/tar/electron.inc.tar.gz
ÃÂ ÃÂ ÃÂ ÃÂ 10 linuxlib_targz=/home/davidt/gnu/tar/electron.lib.tar.gz
ÃÂ ÃÂ ÃÂ ÃÂ 11
ÃÂ ÃÂ ÃÂ ÃÂ 12 sourcedir=/home/davidt/gnu/src-a4
ÃÂ ÃÂ ÃÂ ÃÂ 13 installdir=/home/davidt/gnu/bin-a4
ÃÂ ÃÂ ÃÂ ÃÂ 14
ÃÂ ÃÂ ÃÂ ÃÂ 15 mkdir -p $sourcedir
ÃÂ ÃÂ ÃÂ ÃÂ 16 cd $sourcedir
ÃÂ ÃÂ ÃÂ ÃÂ 17
ÃÂ ÃÂ ÃÂ ÃÂ 18 # untar gcc source
ÃÂ ÃÂ ÃÂ ÃÂ 19 tar zxfp $gcc_targz
ÃÂ ÃÂ ÃÂ ÃÂ 20 # the source tree is in ./gcc-2.95.3/
ÃÂ ÃÂ ÃÂ ÃÂ 21
ÃÂ ÃÂ ÃÂ ÃÂ 22 # build native gcc
ÃÂ ÃÂ ÃÂ ÃÂ 23 mkdir $GCC-native
ÃÂ ÃÂ ÃÂ ÃÂ 24 cd $GCC-native
ÃÂ ÃÂ ÃÂ ÃÂ 25 ../$GCC/configure --enable-languages=c++ --prefix=$installdir --enable-shared
ÃÂ ÃÂ ÃÂ ÃÂ 26 make bootstrap
ÃÂ ÃÂ ÃÂ ÃÂ 27 make install
ÃÂ ÃÂ ÃÂ ÃÂ 28 cd ..
ÃÂ ÃÂ ÃÂ ÃÂ 29
ÃÂ ÃÂ ÃÂ ÃÂ 30 PATH=$installdir/bin:$PATH
ÃÂ ÃÂ ÃÂ ÃÂ 31 export PATH
ÃÂ ÃÂ ÃÂ ÃÂ 32
ÃÂ ÃÂ ÃÂ ÃÂ 33 # untar binutils source
ÃÂ ÃÂ ÃÂ ÃÂ 34 tar zxfp $binutils_targz
ÃÂ ÃÂ ÃÂ ÃÂ 35 # the source tree is in ./binutils-2.10.1/
ÃÂ ÃÂ ÃÂ ÃÂ 36
ÃÂ ÃÂ ÃÂ ÃÂ 37 # build binutils for linux
ÃÂ ÃÂ ÃÂ ÃÂ 38 mkdir $BINUTILS-linux
ÃÂ ÃÂ ÃÂ ÃÂ 39 cd $BINUTILS-linux
ÃÂ ÃÂ ÃÂ ÃÂ 40 ../$BINUTILS/configure --target=i686-pc-linux-gnu --prefix=$installdir
ÃÂ ÃÂ ÃÂ ÃÂ 41 make
ÃÂ ÃÂ ÃÂ ÃÂ 42 make install
ÃÂ ÃÂ ÃÂ ÃÂ 43 cd ..
ÃÂ ÃÂ ÃÂ ÃÂ 44
ÃÂ ÃÂ ÃÂ ÃÂ 45 # untar linux header files
ÃÂ ÃÂ ÃÂ ÃÂ 46 tar zxfp $linuxinc_targz
ÃÂ ÃÂ ÃÂ ÃÂ 47 # untar linux lib files
ÃÂ ÃÂ ÃÂ ÃÂ 48 tar zxfp $linuxlib_targz
ÃÂ ÃÂ ÃÂ ÃÂ 49
ÃÂ ÃÂ ÃÂ ÃÂ 50 # build gcc for linux target
ÃÂ ÃÂ ÃÂ ÃÂ 51 mkdir $GCC-linux
ÃÂ ÃÂ ÃÂ ÃÂ 52 cd $GCC-linux
ÃÂ ÃÂ ÃÂ ÃÂ 53 ../$GCC/configure --target=i686-pc-linux-gnu --with-headers=../include --enable-threads --enable-languages=c++ --prefix=$installdir --enable-shared --with-libs=../lib
ÃÂ ÃÂ ÃÂ ÃÂ 54 make
ÃÂ ÃÂ ÃÂ ÃÂ 55 make install
ÃÂ ÃÂ ÃÂ ÃÂ 56 cd ..
The best questions I can think to ask are,
1) How *exactly* should I build $linuxinc_targz and $linuxlib_targz?
2) Please explain if I need /lib or /usr/lib or both.
ÃÂ ÃÂ A) What files *exactly* do I need?
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ a) How could I have learned this myself?
ÃÂ ÃÂ B) What files *exactly* do I NOT need?
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ a) How could I have learned this myself?
3) How do I tell configure/make where these library files are?
ÃÂ ÃÂ A) Should I use --with-libs or not?
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ a) How do I tell configure/make about my target's /lib files?
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ b) How do I tell configure/make about my target's /usr/lib files?
4) Why does building a cross-compiler make me feel so dumb?
Please provide the WHYs when answering any HOWs.ÃÂ I appreciate
everyone's replies to my previous postings, I am soooo close, I
can smell victory.ÃÂ This group is an absolute requirement to the
successful building of a cross-compiler, at least to this newbie.
Thanks.
--
David Thompson
Foster City, CA USA
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
More information about the crossgcc
mailing list