Cross compiling linux apps

Brendan Simon bsimon@ctam.com.au
Mon Dec 20 14:27:00 GMT 1999


"Eric A. Ayer" wrote:

> You seem to be doing almost the same thing that I am doing with compiling the
> linux apps and such.  My goal is to make my own non-distribution.  In any case,
> I've had a lot of trouble compiling the cross compiler.  Only by compiling
> glibc first, and including the headers and libraries could I get the cross
> compiler to compile.  Does this sound right?  I would appreciate any notes on
> how you accomplished what you did.
>
> Incidently, I'm going between intel platforms since I don't have a computer of
> a different architecture, but I hope the proceedure is general enough to use
> between any linux systems.

To build the cross-compiler you need binutils, gcc and glibc.
I will assume you have built and installed binutils for your target and installed
it in your path.  I never had any problems with binutils.  I installed with
prefix=/usr/local/gcc.

* Make sure $prefix/bin is in your path. (eg. export
PATH=/usr/local/gcc/bin:$PATH)
* Unpack gcc and glibc somewhere (eg. /usr/local/src).
* Create some build directories (eg. /usr/local/build/gcc and
/usr/local/build/glibc).
* Go to the gcc build directory and configure (/usr/local/src/gcc/configure) using
the --with-header=/usr/local/src/glibc/include (I'm guessing the path but it
should be similar).  Also only enable the C compiler at this stage.  Use the
--enable-languages=c then make the cross compiler using "make LANGUAGES=c".  "make
install" should install the glibc headers into $prefix/$target/include.
* Now go to the glibc build directory and configure/build/install.  The libraries
should be put in $prefix/$target/lib.
* Now go back to the gcc build directory any other componets your desire. eg. c++,
fortran, java, objc.  This is optional.  You don't need the C++ compiler to build
the linux kernel or most apps.

Hope this helps a little.
Brendan Simon.




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