I am working on getting a buildroot system (for OpenWrt) working on an armv7 device. Part of it is llvm 14.06. For the most part, the build is picking up on the need to explicitly link libatomic on this platform. However when llvm-ar is being linked, it fails to add -latomic and the build fails.
Also I don’t know if it’s OpenWrt’s buildroot system or LLVM, but when LLVM is being built it ignores the system CFLAGS and LDFLAGS environment variables. Unfortunately the nature of this particular buildroot system makes it extremely difficult to make any changes as it untars from downloaded sources every time it runs. Which means that to get it to build on this platform I had to take the step of creating shell scripts for gcc/g++ that added in -latomic.
Two questions: 1) is the llvm-ar libatomic issue on armv7 a known issue? 2) does LLVM’s build system actually ignore CFLAGS/LDFLAGS? If so, what is the correct way to pass in compiler/linker flags that I want it to honor?
I don’t know of any issue that specifically affects llvm-ar. In general, the LLVM build system should add libatomic to the link line when it’s necessary; see llvm/cmake/modules/CheckAtomic.cmake .
You should be able to force flags onto the link line using the CMake variables CMAKE_C_FLAGS/CMAKE_CXX_FLAGS. Not sure whether the CMake scripts respect CFLAGS/CXXFLAGS off the top of my head.
It’s not LLVM that was used here, unless it was used earlier in the process to generate libLLVM-14.so. The problem occurred during the compilation of llvm-ar, but I see that the actual location of the atomic call was in libLLVM-14.so.
It wasn’t, no, but thank-you for the link. I was able to take the patch and put it in OpenWrt’s build system. Version 15.0.7 successfully builds on ARM 32 now.