AOT-DEMO ci报错

我按照readme进行运行,报错如下

$ python3 ci/run_tests.py -l $TAICHI_C_API_INSTALL_DIR
– The C compiler identification is GNU 11.3.0
– The CXX compiler identification is GNU 11.3.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: /usr/bin/c++ - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– TAICHI_C_API_INSTALL_DIR=/home/mi/taichi_nightly/taichi_nightly-1.3.0.post20221204.data/data/c_api
– TAICHI_C_API_INSTALL_DIR=/home/mi/taichi_nightly/taichi_nightly-1.3.0.post20221204.data/data/c_api
CMake Error at cmake/env.cmake:21 (message):
Couldn’t find C-API library; ensure your Taichi is built with
*** TI_WITH_CAPI=ON***
Call Stack (most recent call first):
CMakeLists.txt:16 (configure_environment)

– Configuring incomplete, errors occurred!
See also “/ssd1/android_projects/taichi-aot-demo/build/CMakeFiles/CMakeOutput.log”.
gmake: Makefile: 没有那个文件或目录
gmake: *** 没有规则可制作目标“Makefile”。 停止。
Traceback (most recent call last):
File “/ssd1/android_projects/taichi-aot-demo/ci/run_tests.py”, line 112, in
build_project(project_dir, build_dir, cmake_args)
File “/ssd1/android_projects/taichi-aot-demo/ci/run_tests.py”, line 41, in build_project
raise Exception(“Cmake Error!”)
Exception: Cmake Error!

看起来是没有找到Taichi C API,需要设置环境变量 $TAICHI_C_API_INSTALL_DIR 包含 libtaichi_c_api.so

还有就是不要直接跑 run_tests.py, 这是GitHub CI跑的脚本。你可以使用CMAKE编译所有的Tutorial,然后跑一下每个example。

或者按照Tutorial,跑个小例子。我自己根据Tutorial,自己写了一个小工程,你可以参考:here

非常感谢,此外$TAICHI_C_API_INSTALL_DIR 放在.bashrc里就可以了是吗

是的,不过记得使用命令 source ~/.bashrc,让环境变量起作用。