microsoft / microsoft/onnxruntime-inference-examples

Fail to Build Phi-3 in android

Open
#442 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1.7k
Forks
414
Avg merge
1d 6h
Merged PRs (30d)
14

Description

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:buildCMakeDebug[x86_64]'.

com.android.ide.common.process.ProcessException: ninja: Entering directory `/Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/.cxx/Debug/5b2k5l27/x86_64'
[1/1] Linking CXX shared library Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/build/intermediates/cxx/Debug/5b2k5l27/obj/x86_64/libgenai.so
FAILED: Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/build/intermediates/cxx/Debug/5b2k5l27/obj/x86_64/libgenai.so
: &&Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=x86_64-none-linux-android27 --sysroot=/home/mbuhyd/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/linux-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -std=c++17 -fno-limit-debug-info -static-libstdc++ -Wl,--build-id=sha1 -Wl,--no-rosegment -Wl,--fatal-warnings -Wl,--gc-sections -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libgenai.so -o /Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/build/intermediates/cxx/Debug/5b2k5l27/obj/x86_64/libgenai.so CMakeFiles/genai.dir/native-lib.cpp.o -LDocuments/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/src/main/cpp/../jniLibs/x86_64 -lonnxruntime-genai -lonnxruntime -landroid -llog -latomic -lm && :
ld: error: /home/mbuhyd/Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/src/main/cpp/../jniLibs/x86_64/libonnxruntime-genai.so is incompatible with elf_x86_64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

C++ build system [build] failed while executing:
/Android/Sdk/cmake/3.22.1/bin/ninja
-C
/Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app/.cxx/Debug/5b2k5l27/x86_64
genai
from Documents/vinay/onnxruntime-inference-examples/mobile/examples/phi-3/android/app

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

BUILD FAILED in 1s
61 actionable tasks: 4 executed, 57 up-to-date

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in mobile/examples/phi-3/android/app, reading native-lib.cpp and the CMake configuration around jniLibs/x86_64. Reproduce the x86_64 build with the reported Android NDK and inspect the architecture of libonnxruntime-genai.so. Done means the x86_64 target links successfully and the Android build completes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, cmake, cpp
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.