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 Tom, thanks for the reply!  I studied it for a few
minutes, 1st let me make sure I point out what I'm trying
to do, because (I think) you're suggesting a radically new
& different approach.
 
First, I want a gcc cross compiler that runs on Solaris but
produces Linux executables.
 
So, I've been trying to build this cross compiler on Solaris,
since that is where it must run, but it would seem you are
suggesting I build this cross compiler on the Linux box
itself.
 
Is that correct?  That's a completely new approach for me,
and since I *do* have a Linux box to play with, I can try
building it from Linux ... Hmmm ...
-----Original Message-----
From: Tom.Williams@diversifiedsoftware.com [mailto:Tom.Williams@diversifiedsoftware.com]
Sent: Thursday, August 30, 2001 3:38 PM
To: David.Thompson@efi.com
Subject: Re: Newbie can't build linux cross-compiler for solaris


Here is a basic procedure you can try:

1. Tar up the Solaris header files in /usr/include:
$ tar cf headers.tar /usr/include

2. Tar up the libs you will need to use the cross-compiler:
$ tar cf libs.tar /usr/lib/libc.a /usr/lib/libC.a /usr/lib/libm.a
( your list may vary.  Try to pick the handful of libs you think you will need.  At the very minimum, get the C (libc.a and libC.a (I think) and math (libm.a))

3. Transfer these files to the Linux box

AT the LINUX box:

4. Extract headers.tar and libs.tar somewhere.  I recommend making a directory (like crossdata) and untar those files in the crossdata directory.  That will create crossdata/usr/include/.... and crossdata/usr/lib/......

5. Obtain binutils2.11.2.tar.gz (from sourceware http://sources.redhat.com/binutils/) and gcc-2.95.3 from the gcc guys (http://gcc.gnu.org/)

6. Build bintuils:
PATHTOBINUTILS/configure  --prefix={installtion directory for cross tools} --host=$YOURHOST --target=$YOURTARGET  , where
YOURHOST={hw platform}-linux-gnu and YOURTARGET=sparc-sun-solaris2.7 (or 2.6)

make
Make install

7.Build GCC:
PATHTOGCCSRC/configure --prefix={installation directory for cross tools} --host=YOURHOST --target=YOURTARGET --with-gnu-ld
--with-gnu-as --with-headers={place where headers.tar was extracted} --with-libs={place where libs.tar was extracted}
make
make install


If you have problems with libgcc1.a not being properly built, try the steps below:

On YOURTARGET:
Build binutils, at a minimum copy all executable to OBJECTDIR on target
configure gcc with:
$PATHTOGCCSRC/configure --host=$YOURHOST --target=$YOURTARGET --with-gnu-ld
--with-gnu-as
make libgcc1.a        #Now save libgcc1.a.  This is how you get this file.
make distclean
$PATHTOGCCSRC/configure
make enquire
enquire -f > float.h        # you might need this
enquire -l > limits.h        # and this

I first went through at least 1.5 years ago and have since then nuked my cross compiler.  This procedure will probably NOT work the first time, but with patience it can be tweaked to work.

Let me know how far I get and hopefully, I will have mine built to answer any questions you might have.

Good luck!

Peace......

Tom

My DVD Collection


David Thompson <David.Thompson@efi.com>
Sent by: crossgcc-owner@sources.redhat.com

08/30/01 02:50 PM

       
        To:        'crossgcc' <crossgcc@sourceware.cygnus.com>
        cc:        
        Subject:        Newbie can't build linux cross-compiler for solaris



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.

--
David Thompson

david.thompson@efi.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

------
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]