[llvm-dev] Cross Compiling Runtime Libraries with Freestanding Toolchain

Anthony Merlino via llvm-dev llvm-dev at lists.llvm.org
Fri Jan 15 09:51:08 PST 2021


Hello everyone,

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:

```
#!/bin/bash

mkdir build-arm
cd build-arm

cmake -DCMAKE_TOOLCHAIN_FILE=../arm-toolchain.cmake \
    -DCMAKE_CROSSCOMPILING=True \
    -DCMAKE_INSTALL_PREFIX=output \
    -DLLVM_TABLEGEN=../build-host/bin/llvm-tblgen \
    -DCLANG_TABLEGEN=../build-host/bin/clang-tblgen \
    -DLLVM_DEFAULT_TARGET_TRIPLE=arm-none-eabi \
    -DLLVM_TARGET_ARCH=ARM \
    -DLLVM_TARGETS_TO_BUILD=ARM \
    -DLLVM_BUILD_STATIC=True \
    -DLLVM_ENABLE_PROJECTS="compiler-rt;libcxx;libcxxabi;libunwind" ../llvm
```

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):
  cmake/config-ix.cmake:364 (include)
  CMakeLists.txt:681 (include)
```

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!

Best,
Anthony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210115/78a55c21/attachment.html>


More information about the llvm-dev mailing list