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.71k stars 197 forks source link

cmake build on nvidia tegra #329

Closed cinterloper closed 5 years ago

cinterloper commented 5 years ago

when building on a nvidia xavier with cuda 10, cmake fails with the following error:

terra# cmake .
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Git: /usr/bin/git (found version "2.17.1")
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY)
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:
/media/nvidia/c705f1ce-4c18-4f24-a37d-2cf0b67a0662/aps/terra/src/CLANG_INCLUDE_DIRS
   used as include directory in directory /media/nvidia/c705f1ce-4c18-4f24-a37d-2cf0b67a0662/aps/terra/src

-- Configuring incomplete, errors occurred!
See also "/media/nvidia/c705f1ce-4c18-4f24-a37d-2cf0b67a0662/aps/terra/CMakeFiles/CMakeOutput.log".
elliottslaughter commented 5 years ago

Is it possible to get more information about the system you're building on? OS, distro, compiler, CMake version, CMake configure line, etc.

Does Terra build without CUDA? CUDA is optional for Terra; do you actually need it?

Can you build other CMake projects with CUDA? We're using CMake's built in FindCUDA module, so in theory this should be a problem for any other CMake projects as well.

cinterloper commented 5 years ago

Its nvidia L4T, an ubuntu 18.04 derivative for arm64. It didnt work with no arguments (is there a way to explicitly disable cuda?) but I got cmake to work with the following command line:

cmake -DCMAKE_VERBOSE_MAKEFILE=On -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER=/usr/local/cuda-10.0/bin/nvcc -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.0/ -DCLANG_INCLUDE_DIRS=/usr/local/cuda-10.0/include/ .

However it wont build because aarch64 isint in luajit until 2.1 and terra is currently including 2.0.5

elliottslaughter commented 5 years ago

Terra does work with LuaJIT 2.1, we just need to add some logic to allow this to be configurable in CMake. In the mean time, you can edit this to set the LuaJIT version to anything you want, e.g. 2.1.0-beta3 should do what you want. (I.e. set LUAJIT_VERSION_MINOR to 1 and LUAJIT_VERSION_EXTRA to .0-beta3.)

Looking again at your log from before, I think the actual error is that CLANG_INCLUDE_DIRS isn't being set properly, which may indicate that the LLVM build isn't being found, or perhaps doesn't have what we need. E.g. are the -dev packages for clang installed? Usually I'd recommend installing clang-X.Y libclang-X.Y-dev llvm-X.Y-dev if you're using the Ubuntu package repos.

elliottslaughter commented 5 years ago

Forgot to add this link in the last email:

https://github.com/zdevito/terra/blob/master/cmake/Modules/GetLuaJIT.cmake#L3-L6