Compiling Packages for an embedded Linux with cross compiler ?

Compiling Packages for an embedded Linux with cross compiler ?

Post by Anton Erasmu » Sun, 18 Jan 2004 00:16:59



Hi,

Most of the open source packages one get in a tar ball, one compiles
with the following:

./configure
make
make install.

Now If I have a cross compiler on a Linux box. Say RH9 (x86) and my
target is an ARM7 based board with Linux. How does one tell configure
that it should use the cross compiler for the build ?
The specific package I am interested in at the moment is CDK (Curses
Development Kit).

Regards
   Anton Erasmus

 
 
 

Compiling Packages for an embedded Linux with cross compiler ?

Post by Larry Doolittl » Sun, 18 Jan 2004 01:31:20



> Most of the open source packages one get in a tar ball, one compiles
> with the following:

> ./configure
> make
> make install.

> Now If I have a cross compiler on a Linux box. Say RH9 (x86) and my
> target is an ARM7 based board with Linux. How does one tell configure
> that it should use the cross compiler for the build ?

./configure --prefix=/tmp/embedded-target-root/usr --host=arm-linux
make
make install

Sometimes you need more "stuff" on the configure line,
like setting environment variables CC=arm-linux-gcc,
RANLIB=arm-linux-ranlib, or CXX=arm-linux-g++.  In recent
versions of autoconf, the --host=arm-linux is supposed to
take care of all this for you.

It's also generally recommended to build in a separate
directory from pristine sources, e.g.,

tar -xvzf foo.tar.gz
mkdir foo-arm
cd foo-arm
CC=arm-linux-gcc ../foo/configure --prefix=/tmp/embedded-target-root/usr
make
make install

There is also sometimes trickery to distinguish between the
path of the actual install directory (/tmp/embedded-target-root/usr)
and the directory that will show up as on the target system
(/usr).  When building glibc, for instance, you really configure
with --prefix="", then
   make install_root=/tmp/embedded-target install

These are general guidelines only.  Many open source packages
are put out by people who have never cross-compiled in their life,
and there's no end of troubles that can crop up.  It takes practice.
The more complex the package, the more issues you may have to dig
through.

    - Larry

 
 
 

1. cross compiler question? (sorry not for embedded)

Hello,
Im trying to create my own operating system.For that I need to setup
gcc as a cross compiler.I am building for i386-unknown-gnu with an
i686.

my os: redhat 6.1
binutils-2.9.1
gcc-2.95.2

the step is:
cd /home/foo
mkdir build-binutils build-gcc

#configure, buil and install binutils
cd build-binutils
../binutils-2.9.1/configure --target=i386-unknown-gnu
--prefix=/usr/local/xdev
make all install
(Works fine to build binutils.)

#configure, buil and install gcc
cd build-gcc
../gcc-2.95.2/configure --target=i386-unknown-gnu
--prefix=/usr/local/xdev
(Works fine to build binutils too.)

make LANGUAGES="c c++" LIBGCC=/dev/null

(then show:)
xgcc: libgcc.a : No such file or directory
make: *** [libgcc1-test] Error1

Any help would be greatly appreciated.

2. op.access alternatives

3. Cross-compile for embedded processor?

4. Web World, Orlando, April 1996

5. Cross-compiling XFree to embedded PowerPC processors

6. networking multiple switches

7. cross compiling for embedded ARM

8. HELP: uugetty configuration!

9. Gcc Cross-Compiler Compile Troubles ...

10. Gcc Cross Compiler Compile Troubles

11. problem compiling a cross compiler

12. cross-compiling from debian source packages

13. embedded filesystem packages & package tools