This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Help needed with using cross compilers


"Tom Williams" <tom.williams@diversifiedsoftware.com> writes:
> Hi!  After spending lots of time building a cross compiler, I only now
> realized that I don't know how to use it!  Yeah I know this is a stupid
> question but I would like to try to use my new Linux hosted
> sparc-sun-solaris2.7 cross compiler to build gcc-2.95 targeted for
> sparc-sun-solaris2.7.  Basically, I want to use the cross compiler I built
> to build a native compiler for my Sun.

Ok, so you already have a cross compiler, that means the hard part is
done (and that you know the little tricks to get things working).

First thing first -- build a native binutils toolchain as well! GCC may
have trouble with Solaris as/ld (there are known bugs in Solaris ld
and known limitations in Solaris as):

  $ mkdir obj
  $ cd obj
  $ /path/to/binutils-xxx/configure --target=sparc-sun-solaris2.7 \
    --host=sparc-sun-solaris2.7 \
    --build=i686-pc-linux-gnu \
    --prefix=/usr/local \
    -v
  $ make 
  $ make install prefix=/tmp/binutils-sparc-sun-solaris2.7

Now, gcc; something very similar.

  $ mkdir obj
  $ cd obj
  $ /path/to/gcc-2.95.1/configure --target=sparc-sun-solaris2.7 \
    --host=sparc-sun-solaris2.7 \
    --build=i686-pc-linux-gnu \
    --prefix=/usr/local \
    --with-gnu-as \
    --with-gnu-ld \
    -v
  $ make 
  $ make install prefix=/tmp/gcc-2.95.1-sparc-sun-solaris2.7

This will build in the path /usr/local (which of course you may want 
to change to reflect where you want it on the destination machine!), 
and then you install to temp directory /tmp/<...>. From there you can 
tar it up and transfer to your solaris machine.

Few "2nd order" things to look out for:
  
  - you may want to edit the specs file and make the value "0" instead
    of "1" for cross_compile. This is used by the native compiler to
    decide if it should search certain directories or not. 
  - you may want to double check to see what assembler features are
    being turned on in gcc/auto-host.h and gcc/auto-build.h files.
    Ignore this if it doesn't sense to you right now.

> Where can I get info on proper use of a cross compiler?

This list is a start, but mostly scattered all over the place. 

Regards,
Mumit


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