[llvm-dev] Compiling for baremetal ARMv4 on Ubuntu Linux

cscheuer via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 4 04:21:27 PST 2018


I am currently trying to compile a pretty simple program to work on an 
experimental board. It contains an (FPGA-version of) an ARMv4 processor.
So basically, I try this (on my Ubuntu 18.04.1 LTS):
clang -v --target=arm-none-eabi -c barehello.c -o barehelloCLANG.o
clang -v --target=arm-none-eabi -c io.c -o io.o
clang -v --target=arm-none-eabi barehelloCLANG.o io.o -o 
helloCLANGstatic -static -fuse-ld=lld

Which results in

clang version 8.0.0 (https://git.llvm.org/git/clang.git/ 
a152c7a4b7ba8f4cb9532ead9a38a7121db43d50) 
(https://git.llvm.org/git/llvm.git/ 
1959ce6f3e01241919968ac1911fd45660239d23)
Target: arm-none-unknown-eabi
Thread model: posix
InstalledDir: /usr/local/my_clang/bin
  "/usr/local/my_clang/bin/ld.lld" barehelloCLANG.o io.o -Bstatic 
-L/usr/local/my_clang/lib/clang/8.0.0/lib/baremetal -lc -lm 
-lclang_rt.builtins-arm.a -o helloCLANGstatic
ld.lld: error: unable to find library -lc
ld.lld: error: unable to find library -lm
ld.lld: error: unable to find library -lclang_rt.builtins-arm.a
clang-8: error: ld.lld command failed with exit code 1 (use -v to see 
invocation)

on the linking part. I downloaded a sysroot from 
https://developer.arm.com/open-source/gnu-toolchain/gnu-a/downloads/8-2-2018-08 
and tried to include it via --sysroot=/my/path/to/it, but clang acted 
unimpressed with the same errors. So I'm missing clang_rt.builtins-arm.a 
I guess, but that does not exist on my system.
So next, I tried basically every version of "how to cross-compile 
llvm/clang/compiler-rt" That google came up with, but was not able to 
get a single one to actually work. Any ideas how to get this running?
Thanks in advance!


More information about the llvm-dev mailing list