Closed lbl1120 closed 6 months ago
likely it depends on the JNI environment you are using, previosly android jni was directly triggred as https://github.com/apache/tvm/blob/main/jvm/native/src/main/native/org_apache_tvm_native_c_api.cc#L232 which pass in the address and normal java should not have TVM4J_ANDROID defined, whichi will trigger the other path that relates to here. I am not sure what was specifically happening in your case
I modified this file /mlc-llm/android/library/CMakeLists.txt Added this content
The following is the configuration of my environment variables
This is due to your JAVA_HOME setting, we highly recommend pointing to Android studio's jdk, see also https://github.com/mlc-ai/mlc-llm/pull/2327
checkout the latest instructions here https://llm.mlc.ai/docs/deploy/android.html
csyw@ubuntu:/opt/AI/llm_obj/mlc-llm/android/library$ ./prepare_libs.sh
-- TVM_HOME: /opt/AI/llm_obj/mlc-llm/android/library/../../3rdparty/tvm -- Found Java: /usr/local/java/jdk-17.0.11/bin/java (found version "17.0.11") -- Found JNI: /usr/local/java/jdk-17.0.11/include/linux
-- JNI_INCLUDE_DIRS=/root/Android/Sdk/ndk/27.0.11718014/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include;/usr/local/java/jdk-17.0.11/include/linux;/usr/local/java/jdk-17.0.11/include -- JNI_LIBRARIES=/usr/local/java/jdk-17.0.11/include/linux;/usr/local/java/jdk-17.0.11/include/linux -- Configuring done -- Generating done -- Build files have been written to: /opt/AI/llm_obj/mlc-llm/android/library/build