How to cross-compile standard libraries

cross-compilationgcc

I'm trying to set up a cross-compiler for ARM. I followed this tutorial and I'm at the point now where I can run the cross compiler and get:

arm-unknown-eabi-gcc (GCC) 4.8.4 Copyright (C) 2013 Free Software
Foundation, Inc. This is free software; see the source for copying
conditions.  There is NO warranty; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.

But when I try to ./configure Dropbear (the software I'm trying to compile) I get an error:

checking for gcc... /home/josh/opt/cross/bin/arm-unknown-eabi-gcc
checking whether the C compiler works... no
configure: error: in `/home/josh/src/dropbear-2016.74':
configure: error: C compiler cannot create executables
See `config.log' for more details

I believe this is because I don't yet have a standard library for the target system, because the tutorial I was following mentions:

Note how this compiler is not able to compile normal C programs. The
cross-compiler will spit errors whenever you want to #include any of
the standard headers (except for a select few that actually are
platform-independent, and generated by the compiler itself). This is
quite correct – you don't have a standard library for the target
system yet!

How can I obtain/build a standard library for my target?

Best Answer

I ended up solving this by deleting all my manually built cross compiler stuff and just doing sudo apt-get install gcc-arm-linux-gnueabi, which seems to work out of the box.

Related Question