Advertisement

HOW: Building gcc cross compiler':

Started by February 26, 2003 09:47 AM
1 comment, last by ugenn 21 years, 8 months ago
How do I organize my directories to allow the gcc front end to work with both native compiler and a cross-compiler. I''m using gcc 3.2.2 and binutils-2.13.2.1. I am able to build the cross-tools successfully but how do I layout the files so that I can invoke a cross-build with gcc -b. Native compiler configured for i586-pc-linux-gnu, cross for arm-thumb-elf.
What Debian does to allow you to install multiple builds of GCC with alternate hosts is to prefix the non-native copies of the executable binaries with ''arch-host-'' (e.g., gcc becomes ''i586-mingw32msvc-gcc'' in one case) and place them in the normal prefix (''/usr'' for Debian).

Then, a path (''/usr/arch-host/'') is setup with directories for compiling related files (lib, include, et cetera), for alternate headers and libraries).

There are options to configure all of this when you run the GCC configure script, before building it. If your distro offers a package for the host you want to target, I suggest you use it instead of building your own.

Advertisement
The dirs are setup properly, but now there''s another problem
when building gcc. I get the following error when running make...

checking whether the C compiler (/home/myacc/opt/src/gcc-3.2.2/gcc/xgcc -B/home/myacc/opt/src/gcc-3.2.2/gcc/ -B/home/myacc/opt/arm-elf/bin/ -B/home/myacc/opt/arm-elf/lib/ -isystem /home/myacc/opt/arm-elf/include -O2 -O3 -I/home/myacc/opt/include ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
make: *** [configure-target-libiberty] Error 1

I configure the build as follows....
configure --prefix=$HOME/opt --target=arm-elf

btw, I have switched source platforms to Solaris if that makes
a difference.

thx.

quote: Original post by Null and Void
What Debian does to allow you to install multiple builds of GCC with alternate hosts is to prefix the non-native copies of the executable binaries with ''arch-host-'' (e.g., gcc becomes ''i586-mingw32msvc-gcc'' in one case) and place them in the normal prefix (''/usr'' for Debian).

Then, a path (''/usr/arch-host/'') is setup with directories for compiling related files (lib, include, et cetera), for alternate headers and libraries).

There are options to configure all of this when you run the GCC configure script, before building it. If your distro offers a package for the host you want to target, I suggest you use it instead of building your own.



This topic is closed to new replies.

Advertisement