Hello,
I’m using TVM to tune models for Android devices. I’m using LLVM from NDK. When I run this command to build tvm_rpc:
RUN cd /usr/tvm && \
rm -rf build && \
mkdir -p build && \
cd build && \
cmake \
-DUSE_LLVM=/opt/android-sdk-linux/ndk/26.0.10792818/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-config \
-DUSE_RPC=ON \
-DUSE_CPP_RPC=ON \
-DUSE_PROFILER=ON \
-DUSE_GRAPH_EXECUTOR=ON \
.. && \
make -j10
I’m getting following problem:
520.5 [ 95%] Building CXX object CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_amdgpu.cc.o
520.5 /usr/tvm/src/target/llvm/codegen_amdgpu.cc:26:10: fatal error: llvm/ADT/SmallString.h: No such file or directory
520.5 26 | #include <llvm/ADT/SmallString.h>
520.5 | ^~~~~~~~~~~~~~~~~~~~~~~~
520.5 compilation terminated.
520.5 make[2]: *** [CMakeFiles/tvm_objs.dir/build.make:8616: CMakeFiles/tvm_objs.dir/src/target/llvm/codegen_amdgpu.cc.o] Error 1
520.5 make[2]: *** Waiting for unfinished jobs....
522.4 make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/tvm_objs.dir/all] Error 2
522.4 make: *** [Makefile:136: all] Error 2
After little searching, and debugging. I have found that very old NDK (16.1.4479499) only has this header. So when using NDK, only version 16 is able to build TVM runtime. As I see in LLVM repository this header is present in recent branches. So I think it is intentionaly removed from NDK.
Question:
- Do I build incorrectly?
- Can I build tvm for android with system LLVM?