Cross compiling with Clang - `crtbeginS.o: No such file or directory`

Viewed 40

I'm trying to cross compile a C file to an aarch64 ELF on x86 linux. I've set up a cross build environment on Gentoo but when I run the following command:

clang -target aarch64-unknown-linux-gnu --sysroot=/usr/aarch64-unknown-linux-gnu/ input.c -I /usr/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/ -L /usr/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/

I get the following error:

/usr/bin/aarch64-unknown-linux-gnu-ld: cannot find crtbeginS.o: No such file or directory

However, in the directory /usr/lib/gcc/aarch64-unknown-linux-gnu/11.3.0/, there is a file called crtbeginS.o. My question then is what additional compiler flags am I missing to get the linker to find this file?

0 Answers
Related