still can't build cross compiler --target=i686-pc-linux-gnu on so laris
William A. Gatliff
bgat@saturn.billgatliff.com
Thu Sep 20 06:02:00 GMT 2001
David:
... bgat fires up his Solaris box. News at 11. :^)
Also, I have an updated faq at crossgcc.billgatliff.com. Have you
tried that?
b.g.
On Wed, Sep 19, 2001 at 11:01:48PM -0700, David Thompson wrote:
> 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
--
Bill Gatliff
bgat@billgatliff.com
------
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