[llvm-dev] Compile LLVM into LLVM IR with non-Xcode Clang

Mackenzie Moore via llvm-dev llvm-dev at lists.llvm.org
Fri Aug 4 22:28:34 PDT 2017


Hi everyone,

I was able to compile LLVM to LLVM IR. However, when I read the results into my program, I got "warning: ignoring debug info with an invalid version (700000003)." I figured out it was because the Clang that comes with Xcode uses an LLVM that's older than the LLVM I compiled from source, and LLVM's IR isn't backwards compatible. I've tried using the following CMake flags:
-DCMAKE_C_COMPILER=<path to clang built from source>
-DCMAKE_CXX_COMPILER=<path to clang++ built from source>

I also tried exporting the CC and CXX variables before invoking CMake. Both attempts lead to the following message:

Scanning dependencies of target LLVMDemangle
[  0%] Building CXX object lib/Demangle/CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o
[  0%] Linking CXX static library ../libLLVMDemangle.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: file: CMakeFiles/LLVMDemangle.dir/ItaniumDemangle.cpp.o is not an object file (not allowed in a library)
make[2]: *** [lib/libLLVMDemangle.a] Error 1
make[1]: *** [lib/Demangle/CMakeFiles/LLVMDemangle.dir/all] Error 2
make: *** [all] Error 2

How do I get CMake to use the correct Clang binary?

Thanks,
Mackenzie


More information about the llvm-dev mailing list