-
Notifications
You must be signed in to change notification settings - Fork 724
Description
🐛 Describe the bug
I am following the guide here: https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/ExecuTorchDemo/README.md
cmake . -DCMAKE_INSTALL_PREFIX=cmake-android-out \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" \
-DANDROID_ABI="${ANDROID_ABI}" \
-DANDROID_PLATFORM=android-24 \
-DEXECUTORCH_BUILD_XNNPACK=ON \
-DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON \
-DEXECUTORCH_BUILD_EXTENSION_MODULE=ON \
-DEXECUTORCH_BUILD_EXTENSION_RUNNER_UTIL=ON \
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
-Bcmake-android-out
cmake --build cmake-android-out -j16 --target installcmake extension/android \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}"/build/cmake/android.toolchain.cmake \
-DANDROID_ABI="${ANDROID_ABI}" \
-DCMAKE_INSTALL_PREFIX=cmake-android-out \
-Bcmake-android-out/extension/android
cmake --build cmake-android-out/extension/android -j16Everything works until:
cmake --build cmake-android-out/extension/android -j16[ 5%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/ByteBuffer.cpp.o
[ 11%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/detail/Hybrid.cpp.o
[ 17%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/detail/utf8.cpp.o
[ 23%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/detail/Meta.cpp.o
[ 29%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/ReadableByteChannel.cpp.o
[ 35%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/detail/Environment.cpp.o
[ 41%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/lyra/cxa_throw.cpp.o
[ 47%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/lyra/lyra_breakpad.cpp.o
[ 52%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/fbjni.cpp.o
[ 58%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/detail/References.cpp.o
[ 64%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/lyra/lyra.cpp.o
[ 70%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/OnLoad.cpp.o
[ 76%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/lyra/lyra_exceptions.cpp.o
[ 82%] Building CXX object third-party/fbjni/CMakeFiles/fbjni.dir/cxx/fbjni/detail/Exceptions.cpp.o
[ 88%] Linking CXX shared library libfbjni.so
[ 88%] Built target fbjni
[ 94%] Building CXX object CMakeFiles/executorch_jni.dir/jni/jni_layer.cpp.o
[100%] Linking CXX shared library libexecutorch_jni.so
ld: error: undefined symbol: __pread_chk
>>> referenced by unistd.h:128 (/Users/lpatmore/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/bits/fortify/unistd.h:128)
>>> file_data_loader.cpp.o:(executorch::extension::FileDataLoader::load_into(unsigned long, unsigned long, executorch::runtime::DataLoader::SegmentInfo const&, void*) const) in archive /Users/lpatmore/Development/executorch/cmake-android-out/lib/libextension_data_loader.a
>>> did you mean: __read_chk
>>> defined in: /Users/lpatmore/Library/Android/sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/aarch64-linux-android/21/libc.so
ld: error: undefined symbol: stderr
>>> referenced by posix.cpp:101 (/Users/lpatmore/Development/executorch/runtime/platform/default/posix.cpp:101)
>>> posix.cpp.o:(et_pal_current_ticks) in archive /Users/lpatmore/Development/executorch/cmake-android-out/lib/libexecutorch_core.a
>>> referenced by posix.cpp:101 (/Users/lpatmore/Development/executorch/runtime/platform/default/posix.cpp:101)
>>> posix.cpp.o:(et_pal_current_ticks) in archive /Users/lpatmore/Development/executorch/cmake-android-out/lib/libexecutorch_core.a
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libexecutorch_jni.so] Error 1
make[1]: *** [CMakeFiles/executorch_jni.dir/all] Error 2
make: *** [all] Error 2I have set my exports properly using both NDK 25.1.8937393 and 28.0.12433566 but both cause the same issue. I also tried android-33 instead of android-24, as well as not setting it and it defaulted to android-21, and sadly still the same issue.
Followed this other issue and it seems to have worked for them, but not sure what their NDK version was: #5387
Not sure where to go from here?
Versions
PyTorch version: 2.6.0.dev20240927
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 14.6.1 (arm64)
GCC version: Could not collect
Clang version: 15.0.0 (clang-1500.3.9.4)
CMake version: version 3.30.4
Libc version: N/A
Python version: 3.10.0 (default, Mar 3 2022, 03:54:28) [Clang 12.0.0 ] (64-bit runtime)
Python platform: macOS-14.6.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Apple M3 Max
Versions of relevant libraries:
[pip3] executorch==0.5.0a0+70aee72
[pip3] numpy==1.21.3
[pip3] torch==2.6.0.dev20240927
[pip3] torchaudio==2.5.0.dev20240927
[pip3] torchsr==1.0.4
[pip3] torchvision==0.20.0.dev20240927
[conda] executorch 0.5.0a0+70aee72 pypi_0 pypi
[conda] numpy 1.21.3 pypi_0 pypi
[conda] torch 2.6.0.dev20240927 pypi_0 pypi
[conda] torchaudio 2.5.0.dev20240927 pypi_0 pypi
[conda] torchsr 1.0.4 pypi_0 pypi
[conda] torchvision 0.20.0.dev20240927 pypi_0 pypi