terralang / terra

Terra is a low-level system programming language that is embedded in and meta-programmed by the Lua programming language.
terralang.org
Other
2.72k stars 201 forks source link

CMAKE_INCLUDE_DIRS Not Fund #440

Closed nisarg-ujjainkar closed 4 years ago

nisarg-ujjainkar commented 4 years ago

Hi, I encountered following error while trying to build terra

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
/home/nisarg/internship/terra-git/src/CLANG_INCLUDE_DIRS
   used as include directory in directory /home/nisarg/internship/terra-git/src

-- Configuring incomplete, errors occurred!
See also "/home/nisarg/internship/terra-git/build/CMakeFiles/CMakeOutput.log".

How can I solve this issue? I have clang/llvm 6 and 10 installed on my system.

elliottslaughter commented 4 years ago

To start with it would help to know the following:

It might also help to see the output of this command, run this from the build directory:

grep LLVM CMakeCache.txt
grep CLANG CMakeCache.txt

Thanks.

nisarg-ujjainkar commented 4 years ago

Output of

grep LLVM CMakeCache.txt

is

//The directory containing a CMake configuration file for LLVM.
LLVM_DIR:PATH=/usr/lib/llvm-10/cmake
//Include LLVM in Terra static libraries
TERRA_SLIB_INCLUDE_LLVM:BOOL=ON
//Statically link Terra against LLVM
TERRA_STATIC_LINK_LLVM:BOOL=ON
grep CLANG CMakeCache.txt

is

CLANG_EXECUTABLE:FILEPATH=/usr/bin/clang
CLANG_INCLUDE_DIRS:PATH=CLANG_INCLUDE_DIRS-NOTFOUND
CLANG_clangASTMatchers_LIB:FILEPATH=CLANG_clangASTMatchers_LIB-NOTFOUND
CLANG_clangAST_LIB:FILEPATH=CLANG_clangAST_LIB-NOTFOUND
CLANG_clangAnalysis_LIB:FILEPATH=CLANG_clangAnalysis_LIB-NOTFOUND
CLANG_clangBasic_LIB:FILEPATH=CLANG_clangBasic_LIB-NOTFOUND
CLANG_clangCodeGen_LIB:FILEPATH=CLANG_clangCodeGen_LIB-NOTFOUND
CLANG_clangDriver_LIB:FILEPATH=CLANG_clangDriver_LIB-NOTFOUND
CLANG_clangEdit_LIB:FILEPATH=CLANG_clangEdit_LIB-NOTFOUND
CLANG_clangFrontend_LIB:FILEPATH=CLANG_clangFrontend_LIB-NOTFOUND
CLANG_clangLex_LIB:FILEPATH=CLANG_clangLex_LIB-NOTFOUND
CLANG_clangParse_LIB:FILEPATH=CLANG_clangParse_LIB-NOTFOUND
CLANG_clangSema_LIB:FILEPATH=CLANG_clangSema_LIB-NOTFOUND
CLANG_clangSerialization_LIB:FILEPATH=CLANG_clangSerialization_LIB-NOTFOUND

os is Ubuntu 18.04 running on WSL2 I installed LLVM using apt.

Also, I have arch linux installed on a separate partition. On that installation, cmake configuration completes successfully on llvm/clang 10.

elliottslaughter commented 4 years ago

Can you try setting export CMAKE_PREFIX_PATH=/usr/lib/llvm-6 and try again (remove the build directory first before you try this)? LLVM 10 support isn't fully working yet (#434), so we'll need to stick with a version <= 9 for the moment.

It may be that you'll need to install some extra packages, llvm-6.0-dev libclang-6.0-dev clang-6.0 should be sufficient to do in on Ubuntu. I've got a Dockerfile here that we run against Ubuntu 18.04, so we know this recipe should work:

https://github.com/terralang/terra/blob/master/docker/Dockerfile.ubuntu

nisarg-ujjainkar commented 4 years ago

export CMAKE_PREFIX_PATH=/usr/lib/llvm-6 did not work. However, removing clang/llvm 10 solved the issue.

elliottslaughter commented 4 years ago

Glad you were able to get it to work.

Just for posterity, I think I missed a .0 in that path, so it would be /usr/lib/llvm-6.0.

nisarg-ujjainkar commented 4 years ago

Thanks for all the help.