Building libc for RISCV or AArch64

Hey,
I’m trying to build compiler together with libc using cmdline:
cmake -DLLVM_ENABLE_PROJECTS=‘clang;lld’ -DLLVM_ENABLE_RUNTIMES=“libc” -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=‘RISCV’ -G “Unix Makefiles” …/llvm

And each time I make it I get:
CMake Warning (dev) at /usr/local/share/cmake-3.21/Modules/GNUInstallDirs.cmake:236 (message):

  • Unable to determine default CMAKE_INSTALL_LIBDIR directory because no*
  • target architecture is known. Please enable at least one language before*
  • including GNUInstallDirs.*
    Call Stack (most recent call first):
  • /dev/shm/llvm2/llvm-project/llvm/cmake/modules/AddLLVM.cmake:1 (include)*
  • CMakeLists.txt:148 (include)*
    This warning is for project developers. Use -Wno-dev to suppress it.

– Linker detection: GNU ld
CMake Error at /dev/shm/llvm2/llvm-project/llvm/cmake/modules/CheckProblematicConfigurations.cmake:14 (if):

  • if given arguments:*

  • “STREQUAL” “MSVC”*

  • Unknown arguments specified*
    Call Stack (most recent call first):

  • /dev/shm/llvm2/llvm-project/llvm/cmake/modules/HandleLLVMOptions.cmake:10 (include)*

  • CMakeLists.txt:149 (include)*

Similar issues I get during building compiler-rt and/or for AArch64.
X86 works fine.
I see above is:
[100%] Performing configure step for ‘runtimes’
[100%] Linking CXX executable …/…/…/…/bin/c-index-test
– The C compiler identification is unknown
– The CXX compiler identification is unknown
– The ASM compiler identification is Clang

Is it possible to build rt libs at once with llvm/clang or should I did it in separate steps?

Thanks,
PrzemekO

libc has some information about its runtime build:
https://libc.llvm.org/runtimes_build.html

The bigger issue: there is no RISCV support in libc yet:

1 Like

Hi,
I can only talk for the libc project. A few points:

  1. As @tschuett has already pointed out, the libc project does not yet support RISCV.
  2. We have a CI builder checking this for x86_64. So, no surprises that x86_64 works for you. Can you share the exact commands you are running and the errors you are seeing on aarch64?
  3. There is a CMake bug in certain versions that generating -G "Unix Makefiles" does not work for parts of the libc project. Can you use -G Ninja?

Thanks,
Siva Chandra

1 Like

The exact cmd for aarch64 is nearly the same as for riscv:
cmake -DLLVM_ENABLE_PROJECTS=‘clang;lld’ -DLLVM_ENABLE_RUNTIMES=“libc” -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD=‘AArch64’ -G “Unix Makefiles” …/llvm
Also the same error I observe for compiler-rt.

I suspect that I should configure sth additionally when I’m doing cross compilation.

I observe the same for Ninja build also.