Search code examples
gcccross-compilingosdevbinutils

Binutils fails to build when building GCC Cross Compiler


I am building a GCC 6.10 cross-compiler. I am using the tutorial from OSDev. When I go and build binutils using my shell sript, I get an error like this: Binutils error as mentioned

I used a shell script to move ClooG and ISL into the build-binutils directory as specified in the tutorial I mentioned above. Here is my shell script:

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

cd $HOME/src

mv isl-0.17 binutils-2.9.1/isl
mv cloog-0.18.4 binutils-2.9.1/cloog

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

I am using the latest versions from their websites. GCC, as mentioned in the tutorial above, installs fine but binutils doesn't. Binutils starts to setup but it eventually crashes. Is this a bug within binutils itself or have I done something wrong with the setup? Am I using the incorrect versions? Any suggestions?


Solution

  • Good to see people take the advice of building a GCC cross-compiler to avoid potential problems with host environment GCC compilers and their native header files.

    Versioning of BINUTILS (and many projects) use versioning of major.minor.patch. A value of 9 < 26, 1 < 2 etc. Binutils-2.9.1 is from the late 1990's. The latest is version 2.26. In this case 9 < 26 so the 2.9.x releases are earlier than 2.26.x. With this in mind, one should consult the successful build matrix on the OSDEV Wiki.

    You are building a GCC 6.10 cross compiler. Member(s) on OSDev (as of this writing) have found that Binutils-2.26 has successfully been used to build GCC 6.10 cross compilers.