Laser
Laser

Reputation: 6960

Building cross compiler for arm HF

I'm trying to build cross compiler for arm (target=arm-linux-gnueabihf) from GCC 4.6 source code, with option -with-float=hard.

My compilation process fails on libgcc (unable to find /asm/errno.h file), I suppose I've used wrong sysroot

Configuration options: --with-float=hard --with-mode=thumb --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-bootstrap --disable-libgomp --disable-libsanitizer --enable-bootstrap=no --target=arm-linux-gnueabihf --with-sysroot=$sysroot --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16

$sysroot it's local sysroot /usr/

host=linux-x86_64

Does any body know how to build arm hard float cross-compiler, based on gcc 4.6?

Upvotes: 0

Views: 1089

Answers (1)

ams
ams

Reputation: 25599

Building cross-compilers is trickier than you'd think. There's a circular dependency in which you can't build GCC without GLIBC, and you can't build GLIBC without GCC. The solution involves building the compiler three times, and GLIBC twice, each time with increasing number of features enabled, and is hard to explain.

If you have an existing sysroot then things are much easier. The cycle is broken, so it should just work, assuming the sysroot contains the header files as well as the binaries.

Except it's not that easy: things change over time, so an older compiler will struggle to find the files it needs in a newer sysroot (even though they're most likely present). You might be able to find an older sysroot from the 4.6 era, but chances are those will use the "softfp" ABI, so they won't work with your HF compiler.

I'd recommend using something like Crosstool-ng, which is a tool that tries to automate the process, and builds a working cross-compiler and library from source.

Upvotes: 1

Related Questions