mlc-ai / mlc-llm

Universal LLM Deployment Engine with ML Compilation
https://llm.mlc.ai/
Apache License 2.0
19.08k stars 1.56k forks source link

[Bug] file not found: LibInfo.java during android build. #382

Closed chensinit closed 1 year ago

chensinit commented 1 year ago

Thank you for everyone! I pull latest code and try to build android project. but i faced error. Please give me solution.

bug Bug

I got error during build android project. file not found: /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java

Environment Platform (e.g. WebGPU/Vulkan/IOS/Android/CUDA): cuda Operating system (e.g. Ubuntu/Windows/MacOS/...): ubuntu Device (e.g. iPhone 12 Pro, PC+RTX 3090, ...) GTX 1080 TI How you installed MLC-LLM (conda, source): source How you installed TVM-Unity (pip, source): source Python version (e.g. 3.10): 3.10.9 GPU driver version (if applicable): latest ( Iinstalled 1 month ago.) CUDA/cuDNN version (if applicable): release 12.1, V12.1.105 TVM Unity Hash Tag (python -c "import tvm; print('\n'.join(f'{k}: {v}' for k, v in tvm.support.libinfo().items()))", applicable if you compile models): USE_GTEST: AUTO SUMMARIZE: OFF USE_IOS_RPC: OFF CUDA_VERSION: NOT-FOUND USE_LIBBACKTRACE: AUTO DLPACK_PATH: 3rdparty/dlpack/include USE_TENSORRT_CODEGEN: OFF USE_THRUST: OFF USE_TARGET_ONNX: OFF USE_AOT_EXECUTOR: ON USE_CUDNN: OFF USE_TENSORRT_RUNTIME: OFF USE_ARM_COMPUTE_LIB_GRAPH_EXECUTOR: OFF USE_CCACHE: AUTO USE_ARM_COMPUTE_LIB: OFF USE_CPP_RTVM: OFF USE_OPENCL_GTEST: /path/to/opencl/gtest USE_MKL: OFF USE_PT_TVMDSOOP: OFF USE_CLML: OFF USE_STACKVM_RUNTIME: OFF USE_GRAPH_EXECUTOR_CUDA_GRAPH: OFF ROCM_PATH: /opt/rocm USE_DNNL: OFF USE_VITIS_AI: OFF USE_LLVM: ON USE_VERILATOR: OFF USE_TF_TVMDSOOP: OFF USE_THREADS: ON USE_MSVC_MT: OFF BACKTRACE_ON_SEGFAULT: OFF USE_GRAPH_EXECUTOR: ON USE_ROCBLAS: OFF GIT_COMMIT_HASH: 3c6e82fb3bb6510c676aad807c79a8e519f57f5a USE_VULKAN: OFF USE_RUST_EXT: OFF USE_CUTLASS: OFF USE_CPP_RPC: OFF USE_HEXAGON: OFF USE_CUSTOM_LOGGING: OFF USE_UMA: OFF USE_FALLBACK_STL_MAP: OFF USE_SORT: ON USE_RTTI: ON GIT_COMMIT_TIME: 2023-05-29 21:35:11 -0400 USE_HEXAGON_SDK: /path/to/sdk USE_BLAS: none USE_ETHOSN: OFF USE_LIBTORCH: OFF USE_RANDOM: ON USE_CUDA: OFF USE_COREML: OFF USE_AMX: OFF BUILD_STATIC_RUNTIME: OFF USE_CMSISNN: OFF USE_KHRONOS_SPIRV: OFF USE_CLML_GRAPH_EXECUTOR: OFF USE_TFLITE: OFF USE_HEXAGON_GTEST: /path/to/hexagon/gtest PICOJSON_PATH: 3rdparty/picojson USE_OPENCL_ENABLE_HOST_PTR: OFF INSTALL_DEV: OFF USE_PROFILER: ON USE_NNPACK: OFF LLVM_VERSION: 14.0.0 USE_OPENCL: ON COMPILER_RT_PATH: 3rdparty/compiler-rt RANG_PATH: 3rdparty/rang/include USE_SPIRV_KHR_INTEGER_DOT_PRODUCT: OFF USE_OPENMP: none USE_BNNS: OFF USE_CUBLAS: OFF USE_METAL: OFF USE_MICRO_STANDALONE_RUNTIME: OFF USE_HEXAGON_EXTERNAL_LIBS: OFF USE_ALTERNATIVE_LINKER: AUTO USE_BYODT_POSIT: OFF USE_HEXAGON_RPC: OFF USE_MICRO: OFF DMLC_PATH: 3rdparty/dmlc-core/include INDEX_DEFAULT_I64: ON USE_RELAY_DEBUG: OFF USE_RPC: ON USE_TENSORFLOW_PATH: none TVM_CLML_VERSION: USE_MIOPEN: OFF USE_ROCM: OFF USE_PAPI: OFF USE_CURAND: OFF TVM_CXX_COMPILER_PATH: /usr/bin/c++ HIDE_PRIVATE_SYMBOLS: OFF

Any other relevant information:

junrushao commented 1 year ago

Please do refer to our doc to properly install TVM rather than commenting out code :-)

https://mlc.ai/mlc-llm/docs/install/tvm.html

namchuai commented 1 year ago

@junrushao , after install tvm via pip, I still have error with Android make project

Screenshot 2023-06-13 at 01 36 30 Screenshot 2023-06-13 at 01 37 36
junrushao commented 1 year ago

Can you confirm if build/tvm_home actually exists?

chensinit commented 1 year ago

@junrushao I found that generated wrong symbolic link build/tvm_home. After fix it, I got similar error.

Task :app:generateJniHeaders FAILED /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:44: error: package Base does not exist native int tvmFuncGetGlobal(String name, Base.RefLong handle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:46: error: package Base does not exist native int tvmFuncCall(long handle, Base.RefTVMValue retVal); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:48: error: package Function does not exist native int tvmFuncCreateFromCFunc(Function.Callback function, Base.RefLong handle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:48: error: package Base does not exist native int tvmFuncCreateFromCFunc(Function.Callback function, Base.RefLong handle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:56: error: package Base does not exist int queryImports, Base.RefLong retHandle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:64: error: package Base does not exist int deviceType, int deviceId, Base.RefLong refHandle); ^ 6 errors

kmadsen commented 1 year ago

I'm going through the set up and ran into the same issue.

It works if you create a symbolic link that points to your OPENCL build of tvm-unity

(tvm-android) ubuntu:/mlc-ai/mlc-llm/android/build$ ll
total 73768
--snip--
lrwxrwxrwx  1 tvm_home -> ../../3rdparty/tvm/
(tvm-android) ubuntu:/mlc-ai/mlc-llm/android/build$ rm tvm_home
(tvm-android) ubuntu:/mlc-ai/mlc-llm/android/build$ ln -s ../../../tvm-unity tvm_home
chensinit commented 1 year ago

I'm going through the set up and ran into the same issue.

It works if you create a symbolic link that points to your OPENCL build of tvm-unity

(tvm-android) ubuntu:/mlc-ai/mlc-llm/android/build$ ll
total 73768
--snip--
lrwxrwxrwx  1 tvm_home -> ../../3rdparty/tvm/
(tvm-android) ubuntu:/mlc-ai/mlc-llm/android/build$ rm tvm_home
(tvm-android) ubuntu:/mlc-ai/mlc-llm/android/build$ ln -s ../../../tvm-unity tvm_home

Thank you for reply . : ) I changed symbolic link. but i got error. /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:44: error: package Base does not exist native int tvmFuncGetGlobal(String name, Base.RefLong handle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:46: error: package Base does not exist native int tvmFuncCall(long handle, Base.RefTVMValue retVal); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:48: error: package Function does not exist native int tvmFuncCreateFromCFunc(Function.Callback function, Base.RefLong handle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:48: error: package Base does not exist native int tvmFuncCreateFromCFunc(Function.Callback function, Base.RefLong handle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:56: error: package Base does not exist int queryImports, Base.RefLong retHandle); ^ /home/gihun/IdeaProjects/230530_LLM/mlc-llm/android/MLCChat/app/../../build/tvm_home/jvm/core/src/main/java/org/apache/tvm/LibInfo.java:64: error: package Base does not exist int deviceType, int deviceId, Base.RefLong refHandle); ^