0

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?

Laser
  • 6,652
  • 8
  • 54
  • 85
  • 1
    What platform? What options did you use? Etc, need more info. As an alternative, I am sure you can get a pre-built compiler somewhere. – Marc Glisse Jul 04 '14 at 14:24
  • @MarcGlisse I've updated info, I need to build it by myself – Laser Jul 04 '14 at 14:26
  • You still didn't say what your host system is, what $sysroot is, what you have already put there, why you need to build it yourself, etc. (asm/errno.h may be provided by the kernel) – Marc Glisse Jul 04 '14 at 14:33
  • @MarcGlisse I made some changes that I need to build. So I can't donwload compiler. – Laser Jul 04 '14 at 14:39
  • @MarcGlisse Do you know anything about it? – Laser Jul 04 '14 at 14:59
  • Where *is* the `asm/errno.h` that you expect it to use? – ams Jul 04 '14 at 15:05
  • I don't have it. But it's required by makefile. I've asked about some help (for example you can suggest where I can find sysroot for `arm-linux-gnueabihf`) or maybe I should change options. – Laser Jul 04 '14 at 15:13
  • 1
    You can get `qemu_debootstrap` that will install a Debian or Ubuntu sysroot (make sure it installs the `build_essential` package). Or you can download images from linaro.org, I think. – ams Jul 04 '14 at 15:26
  • That said, I think 4.6 is probably too old to build from those without patches. (It's the multiarch stuff that's the problem.) I'd suggest you look at `crosstool` or maybe Yocto Poky to build a cross-sdk (but that's a big hammer poorly documented). – ams Jul 04 '14 at 15:28
  • 1
    possible duplicate of [Linux cross-compilation for ARM architecture](http://stackoverflow.com/questions/493210/linux-cross-compilation-for-arm-architecture) – artless noise Jul 04 '14 at 16:36

1 Answers1

1

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.

ams
  • 24,923
  • 4
  • 54
  • 75