-
Notifications
You must be signed in to change notification settings - Fork 348
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fail to Build Phi-3 in android #442
Comments
Facing something similar:
ld: error: C:/Users/akula/Desktop/Akul/SCHOOL cmd.exe /C "cd . && C:\Users\akula\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=x86_64-none-linux-android27 --sysroot=C:/Users/akula/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-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 "C:\Users\akula\Desktop\Akul\School Stuff\Internship\onnxruntime-inference-examples\mobile\examples\phi-3\android\app\build\intermediates\cxx\Debug\21d3o5m7\obj\x86_64\libgenai.so" CMakeFiles/genai.dir/native-lib.cpp.o -LC:/Users/akula/Desktop/Akul/SCHOOL ld: error: C:/Users/akula/Desktop/Akul/SCHOOL cmd.exe /C "cd . && C:\Users\akula\AppData\Local\Android\Sdk\ndk\25.1.8937393\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=x86_64-none-linux-android27 --sysroot=C:/Users/akula/AppData/Local/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-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 "C:\Users\akula\Desktop\Akul\School Stuff\Internship\onnxruntime-inference-examples\mobile\examples\phi-3\android\app\build\intermediates\cxx\Debug\21d3o5m7\obj\x86_64\libgenai.so" CMakeFiles/genai.dir/native-lib.cpp.o -LC:/Users/akula/Desktop/Akul/SCHOOL clang++: error: linker command failed with exit code 1 (use -v to see invocation) Execution failed for task ':app:buildCMakeDebug[x86_64]'.
C++ build system [build] failed while executing: C++ build system [build] failed while executing: BUILD FAILED in 50s |
Same error. |
Guys, I figured out the cause. The error is caused due to that the Generate() API and thus the libonnxruntime-genai.so file is not compatible with x86-64 architecture. Which is the architecture of your PC which is running android emulator. However, generally android devices use ARM architecture which is what the Generate API in this android app is compiled for. Thus due to the mismatch of the architectures, this app is expecting and the one you are running it this leads to the above error. To fix it:
Hope it helps! |
Hi Xanta, Thank you for the advice. Unfortunately I don't have a physical device to run this on. I am currently downloading an ARM system image, will try on that and see if I am successful. |
it looks like the .so libraries under the x86_64 dir are actually arm and not x86_64 this is what it should be like (ff7ee24):
this is what their
|
FAILURE: Build failed with an exception.
Execution failed for task ':app:buildCMakeDebug[x86_64]'.
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
BUILD FAILED in 1s
61 actionable tasks: 4 executed, 57 up-to-date
The text was updated successfully, but these errors were encountered: