Warnings while building LLVM

I am using the following CMake options while building the llvm from the source:

cmake -G Ninja -DCMAKE_BUILD_TYPE="Release"   -DBUILD_SHARED_LIBS=True -DLLVM_USE_SPLIT_DWARF=True   -DCMAKE_INSTALL_PREFIX="../../install"   -DLLVM_OPTIMIZED_TABLEGEN=True -DLLVM_BUILD_TESTS=False   -DDEFAULT_SYSROOT="../../install/riscv64-unknown-elf"   -DLLVM_DEFAULT_TARGET_TRIPLE="riscv64-unknown-elf"   -DLLVM_TARGETS_TO_BUILD="RISCV"   ../llvm

  1. When I execute this command, I am getting the following warning by CMake:
CMake Warning:
  Manually-specified variables were not used by the project:

    DEFAULT_SYSROOT
  1. Also, CMake is unable to locate some of the common C libraries and gives messages regarding this, e.g:
Looking for malloc/malloc.h - not found
Looking for CrashReporterClient.h - not found
  1. When llvm finishes building, clang is unable to find math.h library.

  2. Also, do I need to build libc, and libc++ if I want to compile code for the RISCV target?

Kindly help if you know how can I get these issues resolved :upside_down_face:.

The warning about DEFAULT_SYSROOT is because it’s a clang option and you don’t enable clang. If you want to build clang you need to add -DLLVM_ENABLE_PROJECTS=clang.