when running
arm-none-linux-gnueabi-gcc -print-search-dirs | grep libraries | sed \'s/:/\\n/g\'
I get the following output:
li
As explained by @osgx, gcc is looking in the wrong path for its libraries. I hit a similar issue when trying to cross-compile a program for arm on x86_64. As editing the root-owned files was not an option, I searched further and discovered the --sysroot
option:
--sysroot=dir
Use dir as the logical root directory for headers and libraries. For example, if the compiler normally searches for headers in /usr/include and libraries in /usr/lib, it instead searches dir/usr/include and dir/usr/lib.If you use both this option and the -isysroot option, then the --sysroot option applies to libraries, but the -isysroot option applies to header files.
The GNU linker (beginning with version 2.16) has the necessary support for this option. If your linker does not support this option, the header file aspect of --sysroot still works, but the library aspect does not.
Example usage:
./configure --host=arm-unknown-linux-gnueabi \
CFLAGS='-g -O2 --sysroot=/tmp/rpi-root'