mlc-ai / mlc-llm

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

[ANDROID] Windows android build compatibility #1337

Closed zilong-dy closed 8 months ago

zilong-dy commented 10 months ago

🐛 Bug

according to the doc https://llm.mlc.ai/docs/deploy/android.html to create android project.

the first steps all success and have Compilied Android-capable models, but when I exec the ./prepare_libs.sh show below error:

$ ./prepare_libs.sh

-- Configuring incomplete, errors occurred!

zilong-dy commented 10 months ago

or does anyone can update the dependence files?

./build/output/arm64-v8a/libtvm4j_runtime_packed.so ./build/output/tvm4j_core.jar

Tao-begd commented 10 months ago

Has the problem been solved? I got the same error @zilong-dy

The bulid file directory structure: ls ./bulid
CMakeCache.txt CMakeFiles/ config.cmake model_lib/

ls ./bulid/CMakeFiles 3.22.1-g37088a8-dirty/ CMakeOutput.log cmake.check_cache

ls ./bulid/3.22.1-g37088a8-dirty CMakeSystem.cmake VCTargetsPath.vcxproj

ls ./bulid/model_lib libmodel_android.a

The CMakeOutput.log file is The target system is: Android - 1 - aarch64 The host system is: Windows - 10.0.19045 - AMD64

Tao-begd commented 10 months ago

@zilong-dy you can look at this https://stackoverflow.com/questions/61842794/cmake-cant-get-the-value-of-vctargetspath-when-generating-for-uwp

I reinstalled the entire mobile development in C++ and now this step is working without errors image

Tao-begd commented 10 months ago

After the above problem is solved, there is a new problem now. I reinstalled java(jdk21->jdk17) and it still hasn't been solved. Can someone help me solve the confusion?

  • rustup target add aarch64-linux-android info: component 'rust-std' for target 'aarch64-linux-android' is up to date
  • mkdir -p build/model_lib
  • python prepare_model_lib.py Creating lib from ['E:\code\mlc-andriod\mlc-llm\dist\Llama-2-7b-chat-hf-q4f16_1\Llama-2-7b-chat-hf-q4f16_1-android.tar']..
  • cd build
  • touch config.cmake
  • '[' 'E:\code\mlc-llm-t\mlc-llm\3rdparty\tvm' -ne 0 ']' ./prepare_libs.sh: line 12: [: E:\code\mlc-llm-t\mlc-llm\3rdparty\tvm: integer expression expected
  • cmake .. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_TOOLCHAIN_FILE=D:\Program\Android\Sdk\ndk\26.1.10909125/build/cmake/android.toolchain.cmake' -DCMAKE_INSTALL_PREFIX=. -DCMAKE_CXX_FLAGS=-O3 -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=android-24 -DANDROID_PLATFORM=android-24 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON -DANDROID_STL=c++_static -DUSE_HEXAGON_SDK=OFF -DMLC_LLM_INSTALL_STATIC_LIB=ON -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON -DUSE_OPENCL=ON -DUSE_CUSTOM_LOGGING=ON -- Building for: Visual Studio 17 2022 -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Performing Test SUPPORT_CXX17 -- Performing Test SUPPORT_CXX17 - Success -- Hide private symbols -- TVM_HOME: 3rdparty/tvm -- Hide private symbols... -- Forbidding undefined symbols in shared library, using -Wl,--no-undefined on platform Android -- Building for Android -- Didn't find the path to CCACHE, disabling ccache -- VTA build with VTA_HW_PATH=E:/code/mlc-andriod/mlc-llm/3rdparty/tvm/3rdparty/vta-hw -- Build VTA runtime with target: sim -- Enabled runtime search for OpenCL library location -- Couldn't build OpenCL-Gtests -- Android Vulkan_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/sources/third_party/vulkan/src/include -- Skip finding SPIRV in Android, make sure you only build tvm runtime. -- Build with contrib.random -- Build with contrib.sort -- Build with contrib.hybriddump -- Git found: D:/Program Files/Git/mingw64/bin/git.exe -- Found TVM_GIT_COMMIT_HASH=189412e9ad52fee4dc3dc46bcf60d820e82422d8 -- Found TVM_GIT_COMMIT_TIME=2023-11-22 10:29:46 -0500 -- Building with TVM Map... -- Build with thread support... -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Performing Test FILE_PREFIX_MAP_SUPPORTED -- Performing Test FILE_PREFIX_MAP_SUPPORTED - Success -- Build without FlashInfer -- system-nameAndroid -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- VERSION: 0.2.00 CMake Warning at E:/code/mlc-andriod/mlc-llm/CMakeLists.txt:103 (message): Cannot find libflash_attn. The model must not have been built with --use-flash-attn-mqa option.

-- TVM_HOME: E:/code/mlc-andriod/mlc-llm/android/../3rdparty/tvm CMake Error at D:/Program/Android/Sdk/cmake/3.22.1/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Java (missing: Java_JAVA_EXECUTABLE Java_JAR_EXECUTABLE Java_JAVAC_EXECUTABLE Java_JAVAH_EXECUTABLE Java_JAVADOC_EXECUTABLE) Call Stack (most recent call first): D:/Program/Android/Sdk/cmake/3.22.1/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE) D:/Program/Android/Sdk/cmake/3.22.1/share/cmake-3.22/Modules/FindJava.cmake:336 (find_package_handle_standard_args) CMakeLists.txt:18 (find_package)

-- Configuring incomplete, errors occurred!

the CMakeError.log log content: CMakeError.log

the CMakeOutput.log log content: CMakeOutput.log

Thanks

tqchen commented 10 months ago

Thanks @Tao-begd for checking. I am not super familar with ndk in android, but likely https://developer.android.com/ndk/guides/standalone_toolchain or https://developer.android.com/ndk/guides/other_build_systems might help, both seems to use clang for compilation

The current error seems was due to finding java. I wonder if you can try install java through conda or other means to enable cmake to find it

Tao-begd commented 10 months ago

Thanks @Tao-begd for checking. I am not super familar with ndk in android, but likely https://developer.android.com/ndk/guides/standalone_toolchain or https://developer.android.com/ndk/guides/other_build_systems might help, both seems to use clang for compilation

The current error seems was due to finding java. I wonder if you can try install java through conda or other means to enable cmake to find it

I added

set(JAVA_AWT_LIBRARY NotNeeded) 
set(JAVA_JVM_LIBRARY NotNeeded)
set(JAVA_INCLUDE_PATH2 NotNeeded)
set(JAVA_AWT_INCLUDE_PATH NotNeeded)
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
....

to CMakeLists.txt to avoid Java environment issues

But now there are new problems When we run make tvm4j_runtime_packed-j10 in prepare_libs.sh, we get a error:

make*** No rule to make target `tvm4j_runtime_packed'. Stop

I don't know if it has something to do with what I did above, but this has really stuck with me for a day

The running record of prepare_libs.sh:

  • rustup target add aarch64-linux-android info: component 'rust-std' for target 'aarch64-linux-android' is up to date
  • mkdir -p build/model_lib
  • python prepare_model_lib.py Creating lib from ['E:\code\mlc-andriod\mlc-llm\dist\Llama-2-7b-chat-hf-q4f16_1\Llama-2-7b-chat-hf-q4f16_1-android.tar']..
  • cd build
  • touch config.cmake
  • '[' 'E:\code\mlc-andriod\mlc-llm\3rdparty\tvm' -ne 0 ']' ./prepare_libs.sh: line 12: [: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm: integer expression expected
  • cmake .. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_TOOLCHAIN_FILE=D:\Program\Android\Sdk\ndk\26.1.10909125/build/cmake/android.toolchain.cmake' -DCMAKE_INSTALL_PREFIX=. -DCMAKE_CXX_FLAGS=-O3 -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=android-24 -DANDROID_PLATFORM=android-24 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON -DANDROID_STL=c++_static -DUSE_HEXAGON_SDK=OFF -DMLC_LLM_INSTALL_STATIC_LIB=ON -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON -DUSE_OPENCL=ON -DUSE_CUSTOM_LOGGING=ON -- Building for: Visual Studio 17 2022 -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Performing Test SUPPORT_CXX17 -- Performing Test SUPPORT_CXX17 - Success -- Hide private symbols -- TVM_HOME: 3rdparty/tvm -- Hide private symbols... -- Forbidding undefined symbols in shared library, using -Wl,--no-undefined on platform Android -- Building for Android -- Didn't find the path to CCACHE, disabling ccache -- VTA build with VTA_HW_PATH=E:/code/mlc-andriod/mlc-llm/3rdparty/tvm/3rdparty/vta-hw -- Build VTA runtime with target: sim -- Enabled runtime search for OpenCL library location -- Couldn't build OpenCL-Gtests -- Android Vulkan_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/sources/third_party/vulkan/src/include -- Skip finding SPIRV in Android, make sure you only build tvm runtime. -- Build with contrib.random -- Build with contrib.sort -- Build with contrib.hybriddump -- Git found: D:/Program Files/Git/mingw64/bin/git.exe -- Found TVM_GIT_COMMIT_HASH=189412e9ad52fee4dc3dc46bcf60d820e82422d8 -- Found TVM_GIT_COMMIT_TIME=2023-11-22 10:29:46 -0500 -- Building with TVM Map... -- Build with thread support... -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Performing Test FILE_PREFIX_MAP_SUPPORTED -- Performing Test FILE_PREFIX_MAP_SUPPORTED - Success -- Build without FlashInfer -- system-nameAndroid -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- VERSION: 0.2.00 CMake Warning at E:/code/mlc-andriod/mlc-llm/CMakeLists.txt:103 (message): Cannot find libflash_attn. The model must not have been built with --use-flash-attn-mqa option.

-- TVM_HOME: E:/code/mlc-andriod/mlc-llm/android/../3rdparty/tvm -- Found Java: D:/Program/java/jdk-21.0.1/bin/java.exe (found version "21.0.1") -- Found JNI: NotNeeded -- JNI_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include;NotNeeded;NotNeeded -- JNI_LIBRARIES=NotNeeded;NotNeeded -- Configuring done -- Generating done CMake Warning: You are using Visual Studio tools for Android, which does not support standalone executables. However, the following executable targets do not have the ANDROID_GUI property set, and thus will not be built as expected. They will be built as shared libraries with executable filenames:

mlc_chat_cli, spm_decode, spm_encode, spm_export_vocab, spm_normalize, spm_train

-- Build files have been written to: E:/code/mlc-andriod/mlc-llm/android/build

  • make tvm4j_runtime_packed -j10 make: *** No rule to make target `tvm4j_runtime_packed'. Stop.
Tao-begd commented 10 months ago

@zilong-dy you can look at this https://stackoverflow.com/questions/61842794/cmake-cant-get-the-value-of-vctargetspath-when-generating-for-uwp

I reinstalled the entire mobile development in C++ and now this step is working without errors image

Today we found out that we can also fix this error by setting the environment variable to point to the cmake installed in android studio instead of the cmake installed independently

make: *** No rule to make targettvm4j_runtime_packed'. Stop.` is still not solved It still feels like the environment is not set up properly. I hope there is more detail about setting up the environment in the tutorial thanks

tqchen commented 10 months ago

Likely this ihs due to the fact that we are using make which is not available in windows when build through VS can you try to remove https://github.com/mlc-ai/mlc-llm/blob/main/android/prepare_libs.sh#L32 this line and try again?

Tao-begd commented 10 months ago

Likely this ihs due to the fact that we are using make which is not available in windows when build through VS can you try to remove https://github.com/mlc-ai/mlc-llm/blob/main/android/prepare_libs.sh#L32 this line and try again?

@tqchen deleting the error content is

  • rustup target add aarch64-linux-android info: component 'rust-std' for target 'aarch64-linux-android' is up to date
  • mkdir -p build/model_lib
  • python prepare_model_lib.py Creating lib from ['E:\code\mlc-andriod\mlc-llm\dist\Llama-2-7b-chat-hf-q4f16_1\Llama-2-7b-chat-hf-q4f16_1-android.tar']..
  • cd build
  • touch config.cmake
  • '[' 'E:\code\mlc-andriod\mlc-llm\3rdparty\tvm' -ne 0 ']' ./prepare_libs.sh: line 12: [: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm: integer expression expected
  • cmake .. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_TOOLCHAIN_FILE=D:\Program\Android\Sdk\ndk\26.1.10909125/build/cmake/android.toolchain.cmake' -DCMAKE_INSTALL_PREFIX=. -DCMAKE_CXX_FLAGS=-O3 -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=android-24 -DANDROID_PLATFORM=android-24 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON -DANDROID_STL=c++_static -DUSE_HEXAGON_SDK=OFF -DMLC_LLM_INSTALL_STATIC_LIB=ON -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON -DUSE_OPENCL=ON -DUSE_CUSTOM_LOGGING=ON -- Building for: Visual Studio 17 2022 -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Performing Test SUPPORT_CXX17 -- Performing Test SUPPORT_CXX17 - Success -- Hide private symbols -- TVM_HOME: 3rdparty/tvm -- Hide private symbols... -- Forbidding undefined symbols in shared library, using -Wl,--no-undefined on platform Android -- Building for Android -- Didn't find the path to CCACHE, disabling ccache -- VTA build with VTA_HW_PATH=E:/code/mlc-andriod/mlc-llm/3rdparty/tvm/3rdparty/vta-hw -- Build VTA runtime with target: sim -- Enabled runtime search for OpenCL library location -- Couldn't build OpenCL-Gtests -- Android Vulkan_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/sources/third_party/vulkan/src/include -- Skip finding SPIRV in Android, make sure you only build tvm runtime. -- Build with contrib.random -- Build with contrib.sort -- Build with contrib.hybriddump -- Git found: D:/Program Files/Git/mingw64/bin/git.exe -- Found TVM_GIT_COMMIT_HASH=189412e9ad52fee4dc3dc46bcf60d820e82422d8 -- Found TVM_GIT_COMMIT_TIME=2023-11-22 10:29:46 -0500 -- Building with TVM Map... -- Build with thread support... -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Performing Test FILE_PREFIX_MAP_SUPPORTED -- Performing Test FILE_PREFIX_MAP_SUPPORTED - Success -- Build without FlashInfer -- system-nameAndroid -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- VERSION: 0.2.00 CMake Warning at E:/code/mlc-andriod/mlc-llm/CMakeLists.txt:103 (message): Cannot find libflash_attn. The model must not have been built with --use-flash-attn-mqa option.

-- TVM_HOME: E:/code/mlc-andriod/mlc-llm/android/../3rdparty/tvm -- Found Java: D:/Program/java/jbrsdk_jcef/bin/java.exe (found version "11.0.15") -- Found JNI: D:/Program/java/jbrsdk_jcef/include -- JNI_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include;D:/Program/java/jbrsdk_jcef/include/win32;D:/Program/java/jbrsdk_jcef/include/win32 -- JNI_LIBRARIES=D:/Program/java/jbrsdk_jcef/include;D:/Program/java/jbrsdk_jcef/include -- Configuring done -- Generating done CMake Warning: You are using Visual Studio tools for Android, which does not support standalone executables. However, the following executable targets do not have the ANDROID_GUI property set, and thus will not be built as expected. They will be built as shared libraries with executable filenames:

mlc_chat_cli, spm_decode, spm_encode, spm_export_vocab, spm_normalize, spm_train

-- Build files have been written to: E:/code/mlc-andriod/mlc-llm/android/build

  • cmake --build . --target install --config release -j 适用于 .NET Framework MSBuild 版本 17.8.3+195e7f5a3

    ANDROID_HOME=C:\Microsoft\AndroidSDK\25 ANDROID_SDK_ROOT=C:\Microsoft\AndroidSDK\25 ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Checking File Globs Checking Build System ANDROID_HOME=C:\Microsoft\AndroidSDK\25 ANDROID_SDK_ROOT=C:\Microsoft\AndroidSDK\25 ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c -- Install configuration: "release" CMake Error at cmake_install.cmake:41 (file): file INSTALL cannot find "E:/code/mlc-andriod/mlc-llm/android/build/tvm4j_core.jar": File exists.

D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: 命令“setlocal [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: D:\Program\Android\Sdk\cmake\3.22.1\bin\cmake.exe -DBUILD_TYPE=release -P cmake_install.cmake [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmEnd [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmErrorLevel [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: exit /b %1 [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :cmDone [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj] D:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(166,5): error MSB3073: :VCEnd”已退出,代码为 1。 [E:\code\mlc-andriod\mlc-llm\android\build\install.vcxproj]

tqchen commented 10 months ago

Two things that might help, add the following line (before the install, replace the make)

cmake --build . --config Release --

========

Another issue that might related is that somehow cmake picks visual studio, while it comes with clang, in your case.

Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped

If you can try to force cmake to pick clang, we might have an easier live (maybe via CMAKE_CXX_COMPILER and CMAKE_C_COMPILER )

Tao-begd commented 10 months ago

I got the same error as #134 and applied the same approach.

I also changed CMakeListst.txt CMakeLists.txt and prepare_libs.sh prepare_libs.txt in the android directory

After running it, I was prompted with 20 errors

  • rustup target add aarch64-linux-android info: component 'rust-std' for target 'aarch64-linux-android' is up to date
  • mkdir -p build/model_lib
  • python prepare_model_lib.py Creating lib from ['E:\code\mlc-andriod\mlc-llm\dist\Llama-2-7b-chat-hf-q4f16_1\Llama-2-7b-chat-hf-q4f16_1-android.tar']..
  • cd build
  • touch config.cmake
  • '[' 'E:\code\mlc-andriod\mlc-llm\3rdparty\tvm' -ne 0 ']' ./prepare_libs.sh: line 12: [: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm: integer expression expected
  • cmake .. -DCMAKE_BUILD_TYPE=Release '-DCMAKE_TOOLCHAIN_FILE=D:\Program\Android\Sdk\ndk\26.1.10909125/build/cmake/android.toolchain.cmake' -DCMAKE_INSTALL_PREFIX=. -DCMAKE_CXX_FLAGS=-O3 -DANDROID_ABI=arm64-v8a -DANDROID_NATIVE_API_LEVEL=android-24 -DANDROID_PLATFORM=android-24 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ON -DANDROID_STL=c++_static -DUSE_HEXAGON_SDK=ON -DMLC_LLM_INSTALL_STATIC_LIB=ON -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON -DUSE_OPENCL=ON -DUSE_CUSTOM_LOGGING=ON -- Building for: Visual Studio 17 2022 -- The C compiler identification is unknown -- The CXX compiler identification is unknown -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped -- Performing Test SUPPORT_CXX17 -- Performing Test SUPPORT_CXX17 - Success -- Hide private symbols -- TVM_HOME: 3rdparty/tvm -- Hide private symbols... -- Forbidding undefined symbols in shared library, using -Wl,--no-undefined on platform Android -- Building for Android -- Didn't find the path to CCACHE, disabling ccache -- VTA build with VTA_HW_PATH=E:/code/mlc-andriod/mlc-llm/3rdparty/tvm/3rdparty/vta-hw -- Build VTA runtime with target: sim -- Enabled runtime search for OpenCL library location -- Couldn't build OpenCL-Gtests -- Android Vulkan_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/sources/third_party/vulkan/src/include -- Skip finding SPIRV in Android, make sure you only build tvm runtime. -- Build with contrib.random -- Build with contrib.sort -- Build with contrib.hybriddump -- Git found: D:/Program Files/Git/mingw64/bin/git.exe -- Found TVM_GIT_COMMIT_HASH=189412e9ad52fee4dc3dc46bcf60d820e82422d8 -- Found TVM_GIT_COMMIT_TIME=2023-11-22 10:29:46 -0500 -- Building with TVM Map... -- Build with thread support... -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE -- Performing Test FILE_PREFIX_MAP_SUPPORTED -- Performing Test FILE_PREFIX_MAP_SUPPORTED - Success -- Build without FlashInfer -- system-nameAndroid -- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) -- VERSION: 0.2.00 CMake Warning at E:/code/mlc-andriod/mlc-llm/CMakeLists.txt:103 (message): Cannot find libflash_attn. The model must not have been built with --use-flash-attn-mqa option.

-- TVM_HOME: E:/code/mlc-andriod/mlc-llm/android/../3rdparty/tvm -- Found Java: C:/Program Files/Android/jdk/jdk-8.0.302.8-hotspot/jdk8u302-b08/bin/java.exe (found version "1.8.0_302") -- Found JNI: C:/Program Files/Android/jdk/jdk-8.0.302.8-hotspot/jdk8u302-b08/include -- JNI_INCLUDE_DIRS=D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/sysroot/usr/include;C:/Program Files/Android/jdk/jdk-8.0.302.8-hotspot/jdk8u302-b08/include/win32;C:/Program Files/Android/jdk/jdk-8.0.302.8-hotspot/jdk8u302-b08/include/win32 -- JNI_LIBRARIES=C:/Program Files/Android/jdk/jdk-8.0.302.8-hotspot/jdk8u302-b08/include;C:/Program Files/Android/jdk/jdk-8.0.302.8-hotspot/jdk8u302-b08/include -- Configuring done -- Generating done CMake Warning: You are using Visual Studio tools for Android, which does not support standalone executables. However, the following executable targets do not have the ANDROID_GUI property set, and thus will not be built as expected. They will be built as shared libraries with executable filenames:

mlc_chat_cli, spm_decode, spm_encode, spm_export_vocab, spm_normalize, spm_train

-- Build files have been written to: E:/code/mlc-andriod/mlc-llm/android/build

  • cmake --build . --config Release -- 适用于 .NET Framework MSBuild 版本 17.8.3+195e7f5a3

    ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Checking File Globs Checking Build System ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Building Java objects for tvm4j_core.jar Building Custom Rule E:/code/mlc-andriod/mlc-llm/android/CMakeLists.txt Generating CMakeFiles/tvm4j_core.dir/java_class_filelist Creating Java archive tvm4j_core.jar ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Generating aarch64-linux-android/release/libtokenizers_c.a Compiling proc-macro2 v1.0.70 Compiling unicode-ident v1.0.12 Compiling cfg-if v1.0.0 Compiling autocfg v1.1.0 Compiling syn v1.0.109 Compiling crossbeam-utils v0.8.16 Compiling libc v0.2.150 Compiling ident_case v1.0.1 Compiling fnv v1.0.7 Compiling memchr v2.6.4 Compiling strsim v0.10.0 Compiling scopeguard v1.2.0 Compiling serde v1.0.193 Compiling either v1.9.0 Compiling memoffset v0.9.0 Compiling crossbeam-epoch v0.9.15 Compiling cc v1.0.83 Compiling pkg-config v0.3.27 Compiling rayon-core v1.12.0 Compiling quote v1.0.33 Compiling syn v2.0.39 Compiling crossbeam-deque v0.8.3 Compiling getrandom v0.2.11 Compiling paste v1.0.14 Compiling rand_core v0.6.4 Compiling aho-corasick v1.1.2 Compiling esaxx-rs v0.1.10 Compiling regex-syntax v0.8.2 Compiling serde_json v1.0.108 Compiling thiserror v1.0.50 Compiling minimal-lexical v0.2.1 Compiling ppv-lite86 v0.2.17 Compiling nom v7.1.3 Compiling rand_chacha v0.3.1 Compiling onig_sys v69.8.1 Compiling darling_core v0.14.4 Compiling serde_derive v1.0.193 Compiling monostate-impl v0.1.10 Compiling thiserror-impl v1.0.50 Compiling regex-automata v0.4.3 Compiling rayon v1.8.0 Compiling darling_macro v0.14.4 Compiling itertools v0.8.2 Compiling darling v0.14.4 Compiling derive_builder_core v0.12.0 Compiling smallvec v1.11.2 Compiling ryu v1.0.15 Compiling derive_builder_macro v0.12.0 Compiling macro_rules_attribute-proc_macro v0.1.3 Compiling bitflags v1.3.2 Compiling itoa v1.0.9 Compiling base64 v0.13.1 Compiling unicode-segmentation v1.10.1 Compiling once_cell v1.18.0 Compiling macro_rules_attribute v0.1.3 Compiling derive_builder v0.12.0 Compiling rayon-cond v0.1.0 Compiling unicode-normalization-alignments v0.1.12 Compiling regex v1.10.2 Compiling rand v0.8.5 Compiling aho-corasick v0.7.20 Compiling itertools v0.9.0 Compiling onig v6.4.0 Compiling monostate v0.1.10 Compiling spm_precompiled v0.1.4 Compiling regex-syntax v0.7.5 Compiling lazy_static v1.4.0 Compiling log v0.4.20 Compiling unicode_categories v0.1.1 Compiling tokenizers v0.13.4 Compiling tokenizers-c v0.1.0 (E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\rust) Finished release [optimized] target(s) in 57.06s Building Custom Rule E:/code/mlc-andriod/mlc-llm/3rdparty/tokenizers-cpp/CMakeLists.txt ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Building Custom Rule E:/code/mlc-andriod/mlc-llm/CMakeLists.txt conv_templates.cc In file included from E:\code\mlc-andriod\mlc-llm\cpp\conv_templates.cc:4: In file included from E:\code\mlc-andriod\mlc-llm\cpp/conversation.h:8: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(265,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] throw std::overflow_error(""); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(387,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llmobjs.vcxproj] GET(bool, u.boolean_) ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(379,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(387,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(384,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(388,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llmobjs.vcxproj] GET(std::string, *u.string_) ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(379,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(388,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(384,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(389,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llmobjs.vcxproj] GET(array, *u.array_) ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(379,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(389,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(384,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(390,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llmobjs.vcxproj] GET(object, *u.object_) ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(379,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(390,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(384,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(392,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llmobjs.vcxproj] GET(double, (type == int64_type && (constcast<value*>(this)->type = number_type, ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(379,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(392,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(384,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(395,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] GET(int64t, u.int64_) ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(379,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(395,1): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(384,5): note: expanded from macro 'GET' PICOJSON_ASSERT("type mismatch! call is() before get()" && is()); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(453,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] PICOJSON_ASSERT(is()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(459,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] PICOJSON_ASSERT(is()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(465,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] PICOJSON_ASSERT(is()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(472,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] PICOJSON_ASSERT(is()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(478,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] PICOJSON_ASSERT(is()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(483,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] PICOJSON_ASSERT(is()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\picojson\picojson.h(101,15): note: expanded from macro 'PICOJSON_ASSERT' if (!(e)) throw std::runtime_error(#e); \ ^ CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=] [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\mlc_llm_objs.vcxproj] 20 errors generated. ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Building Custom Rule E:/code/mlc-andriod/mlc-llm/3rdparty/tokenizers-cpp/sentencepiece/src/CMakeLists.txt arena.cc arenastring.cc bytestream.cc coded_stream.cc common.cc extension_set.cc generated_enum_util.cc generated_message_table_driven_lite.cc generated_message_util.cc implicit_weak_message.cc int128.cc io_win32.cc message_lite.cc parse_context.cc repeated_field.cc status.cc statusor.cc stringpiece.cc stringprintf.cc structurally_valid.cc strutil.cc time.cc wire_format_lite.cc zero_copy_stream.cc zero_copy_stream_impl.cc zero_copy_stream_impl_lite.cc sentencepiece.pb.cc sentencepiece_model.pb.cc bpe_model.cc In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\src\bpe_model.cc:15: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\src/bpe_model.h:18: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\src/model_interface.h:25: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\src/normalizer.h:28: E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(386,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to open double-array: std::bad_alloc"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(379,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(703,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to resize pool: std::bad_alloc"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(700,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(842,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to build rank index: std::bad_alloc"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(839,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1141,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to insert key: negative value"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1143,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to insert key: zero-length key"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1157,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to insert key: invalid null character"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1162,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to insert key: wrong key order"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1380,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to modify unit: too large offset"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1725,9): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to build double-array: " ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1728,9): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to build double-array: negative value"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(1743,9): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to build double-array: wrong key order"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(703,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to resize pool: std::bad_alloc"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(642,7): note: in instantiation of member function 'Darts::Details::AutoPool::resize_buf' requested here resizebuf(size + 1); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/dartsclone/darts.h(805,14): note: in instantiation of member function 'Darts::Details::AutoPool::append' requested here units.append(0); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(700,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(703,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to resize pool: std::bad_alloc"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(651,7): note: in instantiation of member function 'Darts::Details::AutoPool::resize_buf' requested here resize_buf(size); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(622,5): note: in instantiation of member function 'Darts::Details::AutoPool::resize' requested here resize(0); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/dartsclone/darts.h(1130,10): note: in instantiation of member function 'Darts::Details::AutoPool::clear' requested here nodes.clear(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(700,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(703,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] DARTS_THROW("failed to resize pool: std::bad_alloc"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(18,26): note: expanded from macro 'DARTS_THROW'

    define DARTS_THROW(msg) throw Darts::Details::Exception( \

                       ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(651,7): note: in instantiation of member function 'Darts::Details::AutoPool::resize_buf' requested here resize_buf(size); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/darts_clone/darts.h(622,5): note: in instantiation of member function 'Darts::Details::AutoPool::resize' requested here resize(0); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\sentencepiece\third_party/dartsclone/darts.h(1195,10): note: in instantiation of member function 'Darts::Details::AutoPool::clear' requested here units.clear(); ^ CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=] [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\sentencepiece\src\sentencepiece-static.vcxproj] 20 errors generated. ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Building Custom Rule E:/code/mlc-andriod/mlc-llm/3rdparty/tokenizers-cpp/CMakeLists.txt sentencepiece_tokenizer.cc huggingface_tokenizer.cc rwkv_world_tokenizer.cc In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\src\rwkv_world_tokenizer.cc:12: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack.hpp:10: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include/msgpack/object.hpp:13: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/object_decl.hpp:14: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/object_decl.hpp:15: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/zone.hpp:15: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/zone.hpp:18: E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(77,17): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(116,17): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(192,17): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] if (!p) throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(285,13): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] if (!c) throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(346,9): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(342,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(353,9): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/detail/cpp11_zone.hpp(348,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] try { ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\src\rwkv_world_tokenizer.cc:12: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack.hpp:10: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include/msgpack/object.hpp:15: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/object.hpp:14: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/adaptor/check_container_size.hpp:15: E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/adaptor/check_container_size.hpp(35,28): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] if (size > 0xffffffff) throw container_size_overflow("container size overflow"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/adaptor/check_container_size.hpp(44,28): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] if (size > 0xffffffff) throw container_size_overflow("container size overflow"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/adaptor/check_container_size.hpp(49,28): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] if (size > 0xfffffffe) throw container_size_overflow("container size overflow"); ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\src\rwkv_world_tokenizer.cc:12: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack.hpp:10: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include/msgpack/object.hpp:15: E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/object.hpp(287,17): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw msgpack::type_error(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v1/object.hpp(1043,1): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] try { ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\src\rwkv_world_tokenizer.cc:12: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack.hpp:15: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include/msgpack/parse.hpp:15: E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v2/parse.hpp(232,29): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] if (size == 0xffffffff) throw msgpack::ext_size_overflow("ext size overflow"); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v2/parse.hpp(796,9): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v2/parse.hpp(880,13): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v2/parse.hpp(900,13): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw std::bad_alloc(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v2/parse.hpp(913,17): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tokenizers-cpp\msgpack\include\msgpack/v2/parse.hpp(908,13): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] try { ^ CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=] [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tokenizers\tokenizer_cpp_objs.vcxproj] 20 errors generated. ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Building Custom Rule E:/code/mlc-andriod/mlc-llm/3rdparty/tvm/CMakeLists.txt libinfo.cc In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\support\libinfo.cc:19: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/object.h:27: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/logging.h:32: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\dmlc-core\include\dmlc/common.h(66,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] try { ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\support\libinfo.cc:20: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/registry.h:46: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/container/string.h(220,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] throw std::out_of_range("tvm::String index out of bounds"); ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\support\libinfo.cc:20: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/registry.h:47: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h:31: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/data_type.h(342,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] throw; ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\support\libinfo.cc:20: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/registry.h:47: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(788,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] throw; // never reached, LOG(FATAL) throws, but this silences a warning. ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(782,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1299,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1348,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1936,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1943,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(2208,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_libinfo_objs.vcxproj] try { ^ 10 errors generated. ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk ANT_HOME= JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08 NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c Building Custom Rule E:/code/mlc-andriod/mlc-llm/3rdparty/tvm/CMakeLists.txt builtin_fp16.cc c_runtime_api.cc In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc:27: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/device_api.h:28: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/ndarray.h:28: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/container/optional.h:29: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/container/./base.h:27: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\dmlc-core\include\dmlc/./logging.h:132: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/logging.h:32: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\3rdparty\dmlc-core\include\dmlc/common.h(66,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] try { ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc:27: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/device_api.h:28: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/ndarray.h:30: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/container/string.h(220,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw std::out_of_range("tvm::String index out of bounds"); ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc:27: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/device_api.h:28: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/ndarray.h:31: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/data_type.h(342,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw; ^ In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc:27: In file included from E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/device_api.h:29: E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(788,7): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw; // never reached, LOG(FATAL) throws, but this silences a warning. ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(782,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1299,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1348,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1936,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(1943,3): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\include\tvm/runtime/packed_func.h(2208,5): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] try { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(451,29): error : use of dynamic_cast requires -frtti [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] if (const auto wrapped = dynamic_cast<const WrappedPythonError>(&e)) { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(453,37): error : use of dynamic_cast requires -frtti [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] } else if (const auto internal = dynamic_cast<const InternalError>(&e)) { ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(471,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw wrapped_err; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(473,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw internal; ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(475,5): error : cannot use 'throw' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] throw tvm::Error(NormalizeError(message) + tvm::runtime::Backtrace()); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(485,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] API_BEGIN(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime/runtime_base.h(32,21): note: expanded from macro 'API_BEGIN'

    define API_BEGIN() try {

                  ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(496,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] API_BEGIN(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime/runtime_base.h(32,21): note: expanded from macro 'API_BEGIN'

    define API_BEGIN() try {

                  ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(503,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] API_BEGIN(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime/runtime_base.h(32,21): note: expanded from macro 'API_BEGIN'

    define API_BEGIN() try {

                  ^

    E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime\c_runtime_api.cc(521,3): error : cannot use 'try' with exceptions disabled [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] API_BEGIN(); ^ E:\code\mlc-andriod\mlc-llm\3rdparty\tvm\src\runtime/runtime_base.h(32,21): note: expanded from macro 'API_BEGIN'

    define API_BEGIN() try {

                  ^

    CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=] [E:\code\mlc-andriod\mlc-llm\android\build\mlc_llm\tvm\tvm_runtime_objs.vcxproj] 20 errors generated.

    tqchen commented 10 months ago

    OK, in this case. Seems that we have to make sure you use the clang instead of MSVC. Somehow cmake picks visual studio, while it comes with clang, in your case.

    Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped

    If you can try to force cmake to pick clang, we might have an easier live (maybe via CMAKE_CXX_COMPILER and CMAKE_C_COMPILER )

    Note that in your CMakeLists.txt file, you need to do set(CMAKE_CXX_COMPLIER xxx) (without the D prefix as that is used to set through comand line)

    Tao-begd commented 10 months ago

    OK, in this case. Seems that we have to make sure you use the clang instead of MSVC. Somehow cmake picks visual studio, while it comes with clang, in your case.

    Check for working C compiler: D:/Program/Android/Sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/windows-x86_64/bin/clang.exe - skipped

    If you can try to force cmake to pick clang, we might have an easier live (maybe via CMAKE_CXX_COMPILER and CMAKE_C_COMPILER )

    Note that in your CMakeLists.txt file, you need to do set(CMAKE_CXX_COMPLIER xxx) (without the D prefix as that is used to set through comand line)

    Thank you to Professor Chen for your guidance.I tried it, but I got the same result. Is it because my computer is Windows 10 Home edition. @tqchen

    tqchen commented 10 months ago

    I am sorry but as of now i ran out of ideas on how to forcing it to use clang, maybe you can try dig around abit or try to see if you can use WSL, or a linux

    Tao-begd commented 10 months ago

    I interviewed on ubuntu and successfully got

    ./build/output/arm64-v8a/libtvm4j_runtime_packed.so ./build/output/tvm4j_core.jar

    after setting up the environment. Thanks Professor Chen @tqchen , but I hope to be able to adapt to the windows system more.

    Tao-begd commented 9 months ago

    I reconfigured a computer and installed a professional version of windows. I didn't choose to install Visual Studio when installing rust. Instead, I used a custom install, referring to install rust.

    If you use git bash alone, there will be bash: make command not found. I re-download make-4.2.1 and copy it to git\mingw64 to solve it,link

    Through the above steps, I successfully compiled android in windows.I hope it will be helpful. Thanks

    Thanks for Professor Chen's help, I think this issues can be closed@tqchen

    tqchen commented 8 months ago

    Glad it works out

    sherelynyap commented 8 months ago

    I reconfigured a computer and installed a professional version of windows. I didn't choose to install Visual Studio when installing rust. Instead, I used a custom install, referring to install rust.

    If you use git bash alone, there will be bash: make command not found. I re-download make-4.2.1 and copy it to git\mingw64 to solve it,link

    Through the above steps, I successfully compiled android in windows.I hope it will be helpful. Thanks

    Thanks for Professor Chen's help, I think this issues can be closed@tqchen

    Hi, facing the same issue here. So we must install Windows 11 Pro, custom install rust and re-download make to resolve this issue? Can we not install windows pro? Thank you so much!

    tqchen commented 8 months ago

    i think it is mainly a rust issue likely