User:DanielDrake/GCC cross compile

From OLPC
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Compiling a gcc-4.8 (October 2012) ARM cross compiler on x86:

  • Install binutils-arm-linux-gnu from Fedora
  • Inside gcc checkout:
export AR_FOR_TARGET=/usr/bin/arm-linux-gnu-ar
export AS_FOR_TARGET=/usr/bin/arm-linux-gnu-as
export DLLTOOL_FOR_TARGET=/usr/bin/arm-linux-gnu-dlltool
export LD_FOR_TARGET=/usr/bin/arm-linux-gnu-ld
export NM_FOR_TARGET=/usr/bin/arm-linux-gnu-nm
export OBJDUMP_FOR_TARGET=/usr/bin/arm-linux-gnu-objdump
export RANLIB_FOR_TARGET=/usr/bin/arm-linux-gnu-ranlib
export STRIP_FOR_TARGET=/usr/bin/arm-linux-gnu-strip
export WINDRES_FOR_TARGET=/usr/bin/arm-linux-gnu-windres
export WINDMC_FOR_TARGET=/usr/bin/arm-linux-gnu-windmc
mkdir -p build
cd build
../configure --target=arm-linux-gnueabi --enable-languages=c --disable-threads --without-headers --disable-nls --disable-decimal-float --disable-plugin --disable-libssp --disable-libgomp --disable-shared --with-system-zlib --disable-libmudflap --disable-libquadmath --with-system-libunwind --disable-libatomic

Those configure flags are quite important to avoid a variety of failures/incompatibilities. Fedora's cross-gcc.spec might help find more.

Now add $(pwd)/gcc to PATH and run cross-gcc.