How to cross compile TVM to RISCV on x86 Ubuntu 22.04.2?
I want to cross-compile TVM for RISC-V on x86 Ubuntu 22.04.2.
Environment:
TVM version: 0.13.0-dev0
LLVM : sudo apt install llvm, version: 14.0.0
GNU toolchain for RISC-V : sudo apt-get install gcc-riscv64-linux-gnu, version: 11.3.0
I turned off the "use_libbacktrace" option in the config.cmake file and disabled the "USE_ALTERNATIVE_LINKER" option in the CMakeLists.txt file.
TVM cross-compile for RISC-V
cmake .. \ -DCMAKE_SYSTEM_NAME=Linux \ -DCMAKE_SYSTEM_VERSION=1 \ -DCMAKE_C_COMPILER=/usr/bin/riscv64-linux-gnu-gcc \ -DCMAKE_CXX_COMPILER=/usr/bin/riscv64-linux-gnu-g++ \ -DCMAKE_FIND_ROOT_PATH=/usr/riscv64-linux-gnu \ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER \ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY \ -DMACHINE_NAME=riscv64-linux-gnumake -j$(nproc)
Then I encountered the following error:
/usr/lib/gcc-cross/riscv64-linux-gnu/11/../../../../riscv64-linux-gnu/bin/ld: /usr/lib/llvm-14/lib/libLLVM-14.so: error adding symbols: file in wrong formatcollect2: error: ld returned 1 exit statusmake[2]: *** [CMakeFiles/tvm.dir/build.make:1448: libtvm.so] Error 1make[1]: *** [CMakeFiles/Makefile2:253: CMakeFiles/tvm.dir/all] Error 2make: *** [Makefile:136: all] Error 2
Thanks!