Taichi: Build taichi by llvm and clang 8.0 failed

Created on 5 Jul 2020  路  7Comments  路  Source: taichi-dev/taichi

Hi, dear taichi community,
I git pull the latest llvm and clang from its mirror, and checkout both to release_80.
Then I follow the comand the official taichi community to build llvm and clang like the following:

mkdir build
cd build
cmake .. -DLLVM_ENABLE_RTTI:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86;NVPTX" -DLLVM_ENABLE_ASSERTIONS=ON
# If you are building on NVIDIA Jetson TX2, use -DLLVM_TARGETS_TO_BUILD="ARM;NVPTX"

make -j 8
sudo make install

# Check your LLVM installation
llvm-config --version # You should get 8.0.1 or 10.0.0

my cuda version is 11.0 and Driver Version: 450.36.06
my cmake version is 3.12

But feedbacked the report when I build taichi following by the offical step by step:

CMake Error at /usr/local/share/cmake-3.12/Modules/CMakeTestCXXCompiler.cmake:45 (message):
  The C++ compiler

    "/usr/local/bin/clang++"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /home/nullspace/workspace/taichi/build/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/make" "cmTC_14c59/fast"
    /usr/bin/make -f CMakeFiles/cmTC_14c59.dir/build.make CMakeFiles/cmTC_14c59.dir/build
    make[1]: Entering directory '/home/nullspace/workspace/taichi/build/CMakeFiles/CMakeTmp'
    Building CXX object CMakeFiles/cmTC_14c59.dir/testCXXCompiler.cxx.o
    /usr/local/bin/clang++    -stdlib=libc++    -o CMakeFiles/cmTC_14c59.dir/testCXXCompiler.cxx.o -c /home/nullspace/workspace/taichi/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
    Linking CXX executable cmTC_14c59
    /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTC_14c59.dir/link.txt --verbose=1
    /usr/local/bin/clang++  -stdlib=libc++     -rdynamic CMakeFiles/cmTC_14c59.dir/testCXXCompiler.cxx.o  -o cmTC_14c59 
    /usr/bin/ld: cannot find -lc++
    clang-8: error: linker command failed with exit code 1 (use -v to see invocation)
    CMakeFiles/cmTC_14c59.dir/build.make:86: recipe for target 'cmTC_14c59' failed
    make[1]: *** [cmTC_14c59] Error 1
    make[1]: Leaving directory '/home/nullspace/workspace/taichi/build/CMakeFiles/CMakeTmp'
    Makefile:121: recipe for target 'cmTC_14c59/fast' failed
    make: *** [cmTC_14c59/fast] Error 2
potential bug

All 7 comments

sorry, I add the followint into .bashrc
and found that is okay now.

export CC=/usr/local/bin/clang
export CXX=/usr/local/bin/clang++

But I only get a shared library libtaichi_core, I don't know does it means all build finished ?

But I only get a shared library libtaichi_core, I don't know does it means all build finished ?

Yes, congrats! Now we may try run some examples to test if the build is functional, e.g.:

$ python examples/minimal.py
[Taichi] mode=development
[Taichi] preparing sandbox at /tmp/taichi-3j5koiuu
[Taichi] <dev mode>, llvm 10.0.0, commit b709fb63, python 3.8.3
[Taichi] Starting on arch=x64
42

If you got [Taichi] mode=release, please try adding these lines to ~/.bashrc:

export PYTHONPATH=/path/to/taichi
export TAICHI_REPO_DIR=/path/to/taichi

If you got [Taichi] mode=release, please try adding these lines to ~/.bashrc:

export PYTHONPATH=/path/to/taichi
export TAICHI_REPO_DIR=/path/to/taichi

okay, I add it now.(I amd under development mode now)

Yes, congrats! Now we may try run some examples to test if the build is functional, e.g.:

```
$ python examples/minimal.py
[Taichi] mode=development
[Taichi] preparing sandbox at /tmp/taichi-3j5koiuu
[Taichi] , llvm 10.0.0, commit b709fb63, python 3.8.3
[Taichi] Starting on arch=x64
42
the first time I run this script, It report RuntimeRror: [llvm_context.cpp:module_forom_bitcode_file@266] Bitcode file (xxxxxxx/taichi/external/cuda_libdevice/slim+libdevice.11.bc) not found.

But the second that is okay. I don't now why? And there exists serveral script generates such error hint.

the first time I run this script, It report RuntimeRror: [llvm_context.cpp:module_forom_bitcode_file@266] Bitcode file (xxxxxxx/taichi/external/cuda_libdevice/slim+libdevice.11.bc) not found.

It's probably because you're using CUDA 11, which is of experimental support and it's runtime has not been added yet:

$ ls external/cuda_libdevice
slim_libdevice.10.bc

@yuanming-hu I thought we've support CUDA 11 these days? Could you upload the slim_libdevice.11.bc to this directory so that people runs correctly on their first shot?

$ ls external/cuda_libdevice
slim_libdevice.10.bc

@yuanming-hu I thought we've support CUDA 11 these days? Could you upload the slim_libdevice.11.bc to this directory so that people runs correctly on their first shot?

I am not familiar with llvm tools.
I used llvm-bcanalyzer -dump slim_libdevice.10.bc, but print info is too too too long!

slim_libdevice.11.bc cannot found(I can only fond 10.bc)

I see, does adding export TI_ENABLE_CUDA=0 to ~/.bashrc fix the problem? This should disable CUDA backend permently.

I see, does adding export TI_ENABLE_CUDA=0 to ~/.bashrc fix the problem? This should disable CUDA backend permently.

Yes, that is okay if disable it permently.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quadpixels picture quadpixels  路  3Comments

zdxpan picture zdxpan  路  3Comments

yuanming-hu picture yuanming-hu  路  3Comments

yuanming-hu picture yuanming-hu  路  3Comments

archibate picture archibate  路  4Comments