GCC Cross-Compiler Installation

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
codeblaster
Posts: 14
Joined: Fri Apr 24, 2015 1:25 pm
Libera.chat IRC: coder

GCC Cross-Compiler Installation

Post by codeblaster »

Hi,
I recently started learning about operating system. When I got to learn about the basics, I reached here on http://wiki.osdev.org/GCC_Cross-Compiler
Now I am stuck at GCC Cross-Compiler Installation.

I downloaded these packages
1)binutils-2.25.tar.gz
2)cloog-parma-0.16.1.tar.gz
3)gcc-4.9.2.tar.gz
4) gmp-6.0.0a.tar.lz
5)isl-0.12.2.tar.gz
6)mpc-1.0.3.tar.gz
7)mpfr-3.1.2.tar.gz

and I followed these instruction on by Ubuntu 14.04 with pre installed gcc version 4.8.2

Preparation

Code: Select all

 export PREFIX="$HOME/opt/cross"
export TARGET=i686-elf
export PATH="$PREFIX/bin:$PATH"
binutils

Code: Select all

# If you wish to build these packages as part of binutils:
mv isl-x.y.z binutils-x.y.z/isl
mv cloog-x.y.z binutils-x.y.z/cloog
# But reconsider: You should just get the development packages from your OS.

Code: Select all

mkdir build-binutils
cd build-binutils
../binutils-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror
make
make install

GCC

Code: Select all

cd $HOME/src
# If you wish to build these packages as part of gcc:
mv libiconv-x.y.z gcc-x.y.z/libiconv # Mac OS X users
mv gmp-x.y.z gcc-x.y.z/gmp
mv mpfr-x.y.z gcc-x.y.z/mpfr
mv mpc-x.y.z gcc-x.y.z/mpc
mv isl-x.y.z gcc-x.y.z/isl
mv cloog-x.y.z gcc-x.y.z/cloog
# But reconsider: You should just get the development packages from your OS.
mkdir build-gcc
cd build-gcc
../gcc-x.y.z/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers
make all-gcc
make all-target-libgcc
then error appears:

Code: Select all

checking for suffix of object files... configure: error: in `/home/coder/src/build-gcc/i686-elf/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make: *** [configure-target-libgcc] Error 1
because of these further steps are failing.

How shall I proceed?

I have attached the config.log file.
Attachments
config.log.txt
Config.log file
(10.58 KiB) Downloaded 43 times
cmdrcoriander
Member
Member
Posts: 29
Joined: Tue Jan 20, 2015 8:33 pm

Re: GCC Cross-Compiler Installation

Post by cmdrcoriander »

This can be caused by messing up your GMP/MPFR/MPC installation, I had this problem for a few hours just last weekend :)

Try:

1. Delete your build-binutils and build-gcc directories - I found that once I hit this point, 'make clean distclean' could no longer fix it.
2. Remake your build-binutils and build-gcc directories.
3. Change directory to the gcc directory (NOT the build-gcc directory).
4. Run ./contrib/download_prerequisites (this will get the correct versions of GMP, MPFR and MPC downloaded into your gcc tree, instead of using your system libraries)
5. Change directory to build-binutils
6. Now you should be able to follow the tutorial as written, except for the part where you put the GMP/MPFR/MPC/ISL/CLOOG libraries in the GCC directory.

I don't know why the tutorial suggests downloading the supporting libraries separately and copying them into the gcc directory, but that never worked for me (and cost me a few hours) - the ./contrib/download_prerequisites script handles doing that for you, with the correct versions guaranteed.

e: looking at your config.log file I can see you're having the literal exact same problem as I was (as: exec: -o: not found) - hopefully this saves you the three or four hours of pain I went through :P
codeblaster
Posts: 14
Joined: Fri Apr 24, 2015 1:25 pm
Libera.chat IRC: coder

Re: GCC Cross-Compiler Installation

Post by codeblaster »

Still the same error throws.
Which version of gcc and binutils did you download?
cmdrcoriander
Member
Member
Posts: 29
Joined: Tue Jan 20, 2015 8:33 pm

Re: GCC Cross-Compiler Installation

Post by cmdrcoriander »

I have both a 32-bit and 64-bit cross compiler running with binutils 2.24 and gcc 4.9.2.

Are you sure your binutils has been built properly? Try running

Code: Select all

$PREFIX/bin/i686-elf-as --version
codeblaster
Posts: 14
Joined: Fri Apr 24, 2015 1:25 pm
Libera.chat IRC: coder

Re: GCC Cross-Compiler Installation

Post by codeblaster »

I hadn't installed textinfo. Now everything works fine :) ty for ur help :)
Post Reply