Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] "Build Android APP from Source" step2: "mlc_llm package" returns error ""path/to/mlc-llm/android/android/mlc4j" does not exist" #2600

Closed
mrbrantofgithub opened this issue Jun 22, 2024 · 9 comments
Labels
bug Confirmed bugs

Comments

@mrbrantofgithub
Copy link

馃悰 Bug

I'm try to build an android app according to the Docs "Android SDK".
In step "Build Runtime and Model Libraries", "mlc_llm pacakage" returns error ""path/to/mlc-llm/android/android/mlc4j" does not exist".
There is no directory "android" in directory "path/to/mlc-llm/android".
I install mlc llm python package from prebuilt develop package on macos.

@mrbrantofgithub mrbrantofgithub added the bug Confirmed bugs label Jun 22, 2024
@tqchen
Copy link
Contributor

tqchen commented Jun 24, 2024

You need to clone mlc LLM and set path to mlc source to the real path of the mlc LLM source code

@mrbrantofgithub
Copy link
Author

You need to clone mlc LLM and set path to mlc source to the real path of the mlc LLM source code

I had done all you said, then I met this error.

  1. cd /path/to/MLCChat # e.g., "android/MLCChat"
  2. export MLC_LLM_SOURCE_DIR=/path/to/mlc-llm # e.g., "../.."
  3. mlc_llm package
    But mlc4j is in "path/to/mlc-llm/android", there is no directory "path/to/mlc-llm/android/android"
    "path/to" is only a discription of my path not the path I used.

@tqchen
Copy link
Contributor

tqchen commented Jun 24, 2024

make sure you set it wiyhout the android subdir, is stead, do set the source dir to path/to/mlc-llm

@mrbrantofgithub
Copy link
Author

mrbrantofgithub commented Jun 24, 2024

make sure you set it wiyhout the android subdir, is stead, do set the source dir to path/to/mlc-llm

  1. pwd, return "**/mlc-llm/android/MLCChat"
  2. echo $MLC_LLM_SOURCE_DIR, return "../.."
  3. cd ../..
  4. pwd, return "**/mlc-llm"

@MasterJH5574
Copy link
Collaborator

Hi @mrbrantofgithub, happy to follow up here. You need to set MLC_LLM_SOURCE_DIR to the absolute path so it doesn't change when you cd into other directories. In this case, you should just set it via export MLC_LLM_SOURCE_DIR=**/mlc-llm where ** is the part you hided.

@mrbrantofgithub
Copy link
Author

mrbrantofgithub commented Jul 3, 2024

hi @MasterJH5574 , thank you for your reply. After using the absolute path I encountered some other errors.
-- The C compiler identification is Clang 14.0.7
-- The CXX compiler identification is Clang 14.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler:**/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Hide private symbols
-- TVM_SOURCE_DIR: /mlc-llm/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
-- Performing Test SUPPORT_CXX17
-- Performing Test SUPPORT_CXX17 - Success
-- VTA build with VTA_HW_PATH=/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=
/Library/Android/sdk/ndk/25.2.9519653/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: /usr/local/bin/git
-- Found TVM_GIT_COMMIT_HASH=f5f048bbd71513f087799f987019e3931f68a6d9
-- Found TVM_GIT_COMMIT_TIME=2024-06-03 09:18:53 -0400
-- Building with TVM Map...
-- Build with thread support...
-- 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
-- CLANG_VERSION 14.0
-- Setting enhanced clang warning flags
-- Performing Test FILE_PREFIX_MAP_SUPPORTED
-- Performing Test FILE_PREFIX_MAP_SUPPORTED - Success
-- Added "-fuse-ld=lld" to linker flags -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments
-- Build without FlashInfer
-- system-nameAndroid
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- VERSION: 0.2.00
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
CMake Warning at **/mlc-llm/CMakeLists.txt:107 (message):
Cannot find libflash_attn. The model must not have been built with
--use-flash-attn-mqa option.

-- TVM_SOURCE_DIR: /mlc-llm/android/mlc4j/../../3rdparty/tvm
-- Found Java: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java (found version "17.0.10")
-- Could NOT find JNI (missing: NativeHelper) (found version "25.2.9519653")
-- Try to find jni directly from android env
-- JNI_INCLUDE_DIRS=
/Library/Android/sdk/ndk/25.2.9519653/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include
-- Configuring done
-- Generating done
-- Build files have been written to: **/mlc-llm/android/MLCChat/build
[ 0%] **
[ 1%] **


[ 100%] **
**/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/object.h:574:67: error: no template named 'is_base_of_v' in namespace 'std'; did you mean 'is_base_of'?
template <typename ObjectType, typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>>

*/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/string.h:511:27: error: no matching member function for call to 'as'
if (const auto
str = a.as()) {

**/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:261:12: error: no template named 'bool_constant' in namespace 'std'; did you mean '_BoolConstant'?
: std::bool_constant<std::is_base_of_v<
**/mlc-llm/android/mlc4j/../../3rdparty/tvm/include/tvm/runtime/container/array.h:650:43: error: no template named 'invoke_result_t' in namespace 'std'
template <typename F, typename U = std::invoke_result_t<F, T>>

@mZos
Copy link

mZos commented Jul 6, 2024

@mrbrantofgithub I was also facing this problem. Update NDK to v27 and also update ndk environment variable respectively

@mrbrantofgithub
Copy link
Author

@mZos Thank you very much! It works.

@tqchen
Copy link
Contributor

tqchen commented Jul 8, 2024

glad it works out

@tqchen tqchen closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs
Projects
None yet
Development

No branches or pull requests

4 participants