homebrew-armeabi icon indicating copy to clipboard operation
homebrew-armeabi copied to clipboard

lld looking for library with suffix added

Open ryanbarry opened this issue 4 years ago • 3 comments

hi there, first off thanks for putting this tap together, it's exactly what i needed! secondly, i think i'm probably doing something wrong but i don't think i'm doing anything odd and i'm new to this so i'll try to give all the info i can and hopefully it will be clear if there's a bug or it's my mistake.

i have installed armv7em-cortex-m4f (which installed arm-none-eabi-llvm for me)

my build is failing with the following error:

ld.lld: error: unable to find library -lclang_rt.builtins-armv7em.a

the command i'm running is:

/usr/local/opt/arm-none-eabi-llvm/bin/clang --target=armv7em-none-eabi -L /usr/local/opt/armv7em-cortex-m4f/armv7em-none-eabi/cortex-m4f/lib/ -v -g main.c -o main.o

and the full output, including the "bad" lld command is:

clang version 10.0.0
Target: armv7em-none-unknown-eabi
Thread model: posix
InstalledDir: /usr/local/opt/arm-none-eabi-llvm/bin
 "/usr/local/Cellar/arm-none-eabi-llvm/10.0.0/bin/clang-10" -cc1 -triple thumbv7em-none-unknown-eabi -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name main.c -mrelocation-model static -mthread-model posix -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -nostdsysteminc -target-cpu cortex-m4 -target-feature +soft-float-abi -target-feature +strict-align -target-abi aapcs -mfloat-abi soft -fallow-half-arguments-and-returns -dwarf-column-info -fno-split-dwarf-inlining -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -target-linker-version 450.3 -v -resource-dir /usr/local/Cellar/arm-none-eabi-llvm/10.0.0/lib/clang/10.0.0 -internal-isystem /usr/local/Cellar/arm-none-eabi-llvm/10.0.0/lib/clang/10.0.0/include -internal-isystem include -fdebug-compilation-dir /Users/ryan/code/bare-metal-armv7m -ferror-limit 19 -fmessage-length 153 -fno-signed-char -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /var/folders/0r/wmb8r5v10qz6p70y4771skw00000gn/T/main-ec2dce.o -x c main.c
clang -cc1 version 10.0.0 based upon LLVM 10.0.0 default target arm-none-eabi
ignoring nonexistent directory "include"
ignoring duplicate directory "/usr/local/Cellar/arm-none-eabi-llvm/10.0.0/lib/clang/10.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/Cellar/arm-none-eabi-llvm/10.0.0/lib/clang/10.0.0/include
End of search list.
 "/usr/local/opt/arm-none-eabi-llvm/bin/ld.lld" /var/folders/0r/wmb8r5v10qz6p70y4771skw00000gn/T/main-ec2dce.o -Bstatic -L/usr/local/Cellar/arm-none-eabi-llvm/10.0.0/lib/clang/10.0.0/lib/baremetal -L/usr/local/opt/armv7em-cortex-m4f/armv7em-none-eabi/cortex-m4f/lib/ -lc -lm -lclang_rt.builtins-armv7em.a -o main.o
ld.lld: error: unable to find library -lclang_rt.builtins-armv7em.a
clang-10: error: ld.lld command failed with exit code 1 (use -v to see invocation)

i don't understand what i'm doing/have done that would make it add the -lclang_rt.builtins-armv7em.a argument to lld... seems like i just need it to not add the suffix on there?

ryanbarry avatar May 12 '20 07:05 ryanbarry

Sorry, I have no spare time at the moment to investigate this issue, but it reminds me an old issue I logged against clang nearly 3 years ago: https://bugs.llvm.org/show_bug.cgi?id=34578, and that got magically "fixed" somewhere in the 9.x branch - see the last comment.

Maybe there has been a regression introduced with 10.0, I haven't got time to test 10.0 with the default libs - I'm using custom link scripts.

Try to create a symbolic link from the awkward lib name to the real one, it may help if you're stalled. I'll try to reproduce this when I get some spare time.

eblot avatar May 12 '20 08:05 eblot

quick response! and i hear ya, no rush. i have gotten by using the symlink trick for now (also, actually found -nostdlib which is great for me for the moment since i want to learn from scratch).

i'll try to take a look at that issue you logged, maybe play with link scripts too... i've got a lot to learn 😄

ryanbarry avatar May 13 '20 07:05 ryanbarry

Hi,

You may want to have a look at the https://github.com/eblot/tde-base repos, you may find some info about the linker & stuff (there are two sub repos for Cortex-M4, STM32L4 & nRF52).

BR.

eblot avatar May 13 '20 07:05 eblot