Fatal error when compiling llvm/clang - 'cstddef' file not found

18,102

Try building with cmake or re-installing dependancies below

mkdir build
cd build/
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_TARGETS_TO_BUILD="X86_64;JSBackend" \
-DLLVM_INCLUDE_EXAMPLES=OFF

I ran into similar errors and installed the essential gcc-4.8 and libstdc++-4.8 libraries. Worked for me atleast.

sudo apt-get install build-essential

Good luck. Hope it works

Share:
18,102
Appleshell
Author by

Appleshell

Updated on June 20, 2022

Comments

  • Appleshell
    Appleshell almost 2 years

    When trying to compile llvm/clang

    ../llvm/configure --enable-cxx11=yes --enable-libcpp=yes 
      --enable-optimized=yes --prefix=/usr/local --enable-targets=all 
      --with-gcc-toolchain=/usr/local/bin --enable-bindings=auto 
    

    the following error occurs:

    [...]llvm/include/llvm/Support/AlignOf.h:19:10: fatal error: 'cstddef' file not found
    #include <cstddef>
             ^
    1 error generated.
    rm: [...]/llvm_build/lib/Support/Release+Asserts/APFloat.d.tmp: No such file or directory
    make[1]: *** [[...]/llvm_build/lib/Support/Release+Asserts/APFloat.o] Error 1
    make: *** [all] Error 1
    

    But cstddef does indeed exist (in /usr/local/include/c++/4.8.0/). Adding --includedir=/usr/local/include/c++/4.8.0/ to the configure does not help also.

    What can be the cause for this?