This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more information.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
David: Here's a script that I'm running right now on my Sparcstation 10. If you know anything about Sparcstations, you know that it will be a while before I know if it works or not--- but it looks promising. *** #!/bin/bash # you may need to change the above line, depending on where your bash is installed export TARGET=i386-linux export PREFIX=/home/bgat export PATH=$PATH:${PREFIX}/bin # you may need to set these, depending on where bash is installed #export SHELL=/usr/local/bin/bash #export CONFIG_SHELL=/usr/local/bin/bash echo Building binutils... mkdir -p build-binutils && cd build-binutils ../binutils-2.11.2/configure --target=$TARGET --prefix=$PREFIX \ 2>&1 | tee configure.log make all install 2>&1 | tee make.log cd .. echo Building bootstrapgcc... mkdir -p build-bootstrapgcc && cd build-bootstrapgcc ../gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX \ --enable-languages=c --without-headers --with-newlib \ --disable-shared 2>&1 | tee configure.log make all-gcc install-gcc 2>&1 | tee make.log cd .. # This assumes you have a preconfigured kernel source tree. # if you don't, then you should be able to just copy the header # files from the target machine's /usr/include/linux and /usr/include/asm # directories to the locations specified in the cp commands. echo Building linux headers... cd linux make ARCH=i386 CROSS_COMPLE=i386-linux- CONFIG_SHELL=bash oldconfig \ include/linux/version.h 2>&1 | tee make.log mkdir -p ${PREFIX}/${TARGET}/include cp -r include/linux ${PREFIX}/${TARGET}/include cp -r include/asm-i386 ${PREFIX}/${TARGET}/include/asm cd .. echo Building glibc... mkdir -p build-glibc && cd build-glibc CC=${TARGET}-gcc AR=${TARGET}-ar RANLIB=${TARGET}-ranlib \ bash ../glibc-2.2.4/configure --host=$TARGET \ --disable-debug --disable-profile \ --prefix=${PREFIX}/${TARGET} --with-headers=${PREFIX}/${TARGET}/include \ --disable-sanity-checks 2>&1 | tee configure.log make 2>&1 | tee make.log make install 2>&1 | tee --append make.log cd .. echo Building gcc... mkdir -p build-gcc && cd build-gcc ../gcc-2.95.3/configure --target=$TARGET --prefix=$PREFIX \ 2>&1 | tee configure.log make all install 2>&1 | tee make.log cd .. HTH, b.g. On Fri, Sep 21, 2001 at 02:33:27PM -0700, David Thompson wrote: > Thanks, Bill, yes I have looked at your site, I don't > recall it being complete enough, specifically, you have > sections listed as TODO that appear critical to my > understanding. Since we don't use newlib, I need > info for glibc, info stuff which you don't have. > > Sigh .... > > > -----Original Message----- > > From: William A. Gatliff [mailto:bgat@saturn.billgatliff.com] > > Sent: Thursday, September 20, 2001 6:03 AM > > To: David Thompson > > Cc: 'crossgcc'; Tim Chevalier; Frederic Roussel; Fumiaki Okushi > > Subject: Re: still can't build cross compiler > > --target=i686-pc-linux-gnu > > on so laris > > > > > > 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 -- 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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |