User:DanielDrake/GCC cross compile

From OLPC

< User:DanielDrake
Revision as of 20:13, 8 October 2012 by DanielDrake (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.

Personal tools
  • Log in
  • Login with OpenID
About OLPC
About the laptop
About the tablet
Projects
OLPC wiki
Toolbox
In other languages