So here’s my situation - I am running an RTOS on an embedded system with an ARM Cortex M7. I have a freestanding GCC toolchain built for this target. What I would like to do is cross-compile LLVM to produce only the static runtime libraries: libcxxabi, libcxx, compiler-rt, and libunwind using that toolchain.
Here is my attempt to configure LLVM to get what I want:
cmake -DCMAKE_TOOLCHAIN_FILE=../arm-toolchain.cmake \
However, this results in the following error:
CMake Error at cmake/modules/CheckAtomic.cmake:56 (message):
Host compiler must support std::atomic!
Call Stack (most recent call first):
Is what I’m trying to do supported? Could someone help me chip away at this? I’m really trying to get a full LLVM stack running on this thing!
Any help would be appreciated!
In my experience I've had most success with building the static runtime libraries standalone, i.e. building each library one at a time by pointing cmake at the directory rather than using the integrated build in the top level llvm dir. In my case I do:
compiler-rt built-ins (limited support for sanitizers on a Cortex-M7)
Any remaining components of compiler-rt.
There have been posts on llvm-dev about cross-compiling for Arm, hopefully others may be able to share their experiences as well.
Apologies not got a lot of time left today, have to leave the virtual office. Arm does have a recipe for building a LLVM toolchain (initially targeting cortex-m0), this is likely doing both more and less than you want, but it may be possible to get some ideas from it GitHub - ARM-software/LLVM-embedded-toolchain-for-Arm: A project dedicated to build LLVM toolchain for 32-bit Arm embedded targets.
We are actually already building libcxx and libcxxabi by just bypassing the build system altogether. It’s a little kludgey, so I was trying to just tap into the LLVM build system, and then get to use all the pieces. I started at the top level thinking that was the cleanest way. But if you’ve had success individually driving the CMake in the libraries, I’ll try that instead.
Also, thanks for the reference, that looks relevant.