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]

RE: Newbie can't build linux cross-compiler for solaris


Hi David,

I've built a cross-compiler targetting linux hosted on my win2k box.  Below is 
an email I exchanged with Kevin about how I was able to do this.  I think it will 
answer your questions.

HTH
-(some other) Jim

<enclosed email>
Yes, you should be able to just copy the headers and libs to the 
appropriate place on the host machine.  I've built a cross-compiler 
targetting linux hosted on win2k and I just pulled the libraries and 
headers off my linux box and that seemed to go okay.

I grabbed the headers from the linux machine in /usr/include and I 
think you just need to point to wherever you put them with the --with-
headers flag when you configure gcc.

I grabbed the libs from /usr/lib and put them in $prefix/$target/lib and 
I put the libs from /lib in /lib/gcc/$target/2.95.3-2.  Both of these I 
believe were listed in the search path when I did a "gcc -print-
search-dirs".  I belive that some of these libs came from when 
someone built glibc on this target machine before I got here, so I'm 
not sure what went into that.  If you can build glibc on your target 
machine, you should be able to do it.

I also needed to modify the file libc.so (text file) to point to where a 
couple of libs were that gave me link errors when I tried to build a 
test.c.  Just look at that file when you get the link errors and you'll 
see how to modify it.

HTH
-Jim

On 4 Jun 2001, at 13:56, Kevin Heatwole wrote:

> I'm attempting to build a gcc cross-compiler hosted on AIX and 
> targeted to LinuxPPC (installed on an iMac).
> 
> Everything looks very straight forward.  The process I am using I got 
> from Bill Gatliff's site (http://crossgcc.billgatliff.com) where he 
> outlines how to build a cross-compiler for an embedded target.  In 
> this process, you first build binutils (which built fine for me). 
> Then, you build a "gcc-core" (which also built fine for me).  Then, 
> you use this little gcc cross-compiler to build glibc.  And finally, 
> you rebuild a full gcc cross-compiler using the libs you built with 
> the little gcc cross-compiler.
> 
> Unfortunately, glibc isn't building very well for me.  I've had to 
> edit some files that had preprocessing errors to get the build to 
> succeed (I haven't gotten all the way through this yet, though).
> 
> Anyway, my question to the group is:
> 
> Since I already have a complete LinuxPPC environment including a gcc 
> and all it's libraries sitting on the iMac and this is the platform I 
> want to build a gcc cross for (so I can build complete binaries on 
> AIX and just ftp them to the iMac), shouldn't I be able to just copy 
> all these libraries/include files into my cross on AIX and not have 
> to rebuild anything (especially the glibc that I'm having problems 
> building now)?
> 
> Can someone indicate what files/directories I should copy from 
> LinuxPPC into my gcc cross on AIX to do this and where I should put 
> them on AIX?
> 
> Thanks for any help...  I just want to give this a try before I turn 
> to hiring a consultant to do it for me.
> 
> Kevin
> -- 
> 
</enclosed email>

On 30 Aug 2001, at 16:38, David Thompson wrote:

> Hi Jim, but I need the header files from the target platform,
> right?  Isn't this how --with-headers is used?  In my case,
> building on Solaris, I need --with-headers to point to a
> path where I've copied the Linux headers ... right ??
> 
> > -----Original Message-----
> > From: Jim Tison [mailto:jtison@ntplx.net]
> > Sent: Thursday, August 30, 2001 4:15 PM
> > To: 'crossgcc'
> > Subject: Re: Newbie can't build linux cross-compiler for solaris
> > 
> > 
> > I ran into the same thing at the same place for another 
> > target. What fixed it 
> > for me was using the --with-headers= switch in ./configure. 
> > This needs to 
> > point to the system headers. In your case (you'll be running 
> > this compiler 
> > with the Sun libs, I take it....) you can probably just get away with 
> > pointing --with-headers to /usr/include (or is that 
> > /usr/ccb/include? Heck, 
> > I've forgotten... my Solaris experience is so dated!). 
> > 
> > You will need to reconfigure and restart your build. It might 
> > be smart to 
> > make clean, too. 
> > 
> > Peace,
> > --Jim--
> > 
> > On Thursday 30 August 2001 17:50, David Thompson wrote:
> > > Hi there,
> > >
> > > I am a newbie at building a cross compiler so I'm trying
> > > to read everything I can find, but I've failed in all my
> > > attempts to build a Linux gcc cross-compiler than runs
> > > on Solaris.  Here is my simple script,
> > >
> > >  #!/bin/ksh
> > >  GCC=gcc-2.95.3
> > >  BINUTILS=binutils-2.10.1
> > >  TARGET=i686-pc-linux-gnu
> > >  SRCDIR=/home/davidt/gnu/src/sun
> > >  BINDIR=/home/davidt/gnu/bin/sun
> > >
> > >  cd $SRCDIR
> > >  mkdir build-binutils build-gcc
> > >
> > >  # configure, build and install binutils
> > >  cd build-binutils
> > >  ../$BINUTILS/configure --target=$TARGET --prefix=$BINDIR -v
> > >  make all install
> > >
> > >  # configure, build and install gcc
> > >  cd ../build-gcc
> > >  ../$GCC/configure --target=$TARGET --prefix=$BINDIR -v
> > >  make all install
> > >
> > > I have untarred the packages into /home/davidt/gnu/bin/sun,
> > > and binutils builds fine.  The error I get is from building
> > > gcc, here is the [slightly formatted] error output,
> > >
> > >  for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 
> > _negdi2 _lshrdi3 \
> > >   _ashldi3 _ashrdi3 _ffsdi2 _udiv_w_sdiv _udivmoddi4 
> > _cmpdi2 _ucmpdi2 \
> > >   _floatdidf _floatdisf _fixunsdfsi _fixunssfsi _fixunsdfdi 
> > _fixdfdi \
> > >   _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
> > >   _fixtfdi _fixunstfdi _floatditf __gcc_bcmp _varargs 
> > __dummy _eprintf \
> > >   _bb _shtab _clear_cache _trampoline __main _exit _ctors _pure; \
> > >  do \
> > >    echo ${name}; \
> > >     /home/davidt/gnu/src/sun/build-gcc/gcc/xgcc \
> > >      -B/home/davidt/gnu/src/sun/build-gcc/gcc/ \
> > >      -B/home/davidt/gnu/bin/sun/i686-pc-linux-gnu/bin/ \
> > >      -I/home/davidt/gnu/bin/sun/i686-pc-linux-gnu/include -O2  \
> > >      -DCROSS_COMPILE -DIN_GCC   -DSVR4  -g -O2 -I./include  \
> > >      -fPIC -g1  -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED \
> > >      -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config \
> > >      -I../../gcc-2.95.3/gcc/../include -c -DL${name} \
> > >      ../../gcc-2.95.3/gcc/libgcc2.c -o ${name}.o; \
> > >    if [ $? -eq 0 ] ; then true; else exit 1; fi; \
> > >    i686-pc-linux-gnu-ar rc tmplibgcc2.a ${name}.o; \
> > >    rm -f ${name}.o; \
> > >  done
> > >  _muldi3
> > >  ../../gcc-2.95.3/gcc/libgcc2.c:41: stdlib.h: No such file 
> > or directory
> > >  ../../gcc-2.95.3/gcc/libgcc2.c:42: unistd.h: No such file 
> > or directory
> > >  make[1]: *** [libgcc2.a] Error 1
> > >  make[1]: Leaving directory `/home/davidt/gnu/src/sun/build-gcc/gcc'
> > >  make: *** [all-gcc] Error 2
> > >
> > > I don't understand why stdlib.h & unistd.h cannot be found.  I need
> > > help, what am I doing wrong?  Any advice or URLs that would help me
> > > (the above script is from http://www.objsw.com/CrossGCC) would be
> > > extremely appreciated.
> > 
> > ----------------------------------------
> > Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
> > Content-Transfer-Encoding: 7bit
> > Content-Description: 
> > ----------------------------------------
> > 
> > ----------------------------------------
> > Content-Type: text/plain; charset="us-ascii"; name="Attachment: 2"
> > Content-Transfer-Encoding: 7bit
> > Content-Description: 
> > ----------------------------------------
> > 
> > ------
> > Want more information?  See the CrossGCC FAQ, 
> http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to
> crossgcc-unsubscribe@sourceware.cygnus.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]