microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.83k stars 2.94k forks source link

[Mobile] after build and install miss some file #22531

Open WangHHY19931001 opened 1 month ago

WangHHY19931001 commented 1 month ago

Describe the issue

after build and install miss "nnapi_provider_factory.h"

env: os: Windows 10 pro version 22H2 os version: 19045.5011 Windows Feature Experience Pack 1000.19060.1000.0

android studio: Android Studio Ladybug | 2024.2.1 Patch 1 Build #AI-242.23339.11.2421.12483815, built on October 11, 2024 Runtime version: 21.0.3+-12282718-b509.11 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Toolkit: sun.awt.windows.WToolkit Windows 10.0 GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation Memory: 4096M Cores: 12 Registry: ide.instant.shutdown=false ide.experimental.ui=true i18n.locale= Non-Bundled Plugins: com.jetbrains.plugins.ini4idea (242.23339.18) com.developerphil.adbidea (1.6.18) com.github.tuchg.nonasciicodecompletionhelper (1.0.1)

android sdk path: C:\Users\dell\AppData\Local\Android\Sdk

installed sdk platforms: Android 15.0 api:35 revision:1 Android 14.0 api:34 revision:3 Android 10.0 api:29 revision:5 Android 8.1 api:27 revision:3

android ndk path: C:\Users\dell\AppData\Local\Android\Sdk\ndk\27.2.12479018

To reproduce

git clone this project and checkout v1.19.2, use cmd to build:

.\build.bat --config Release --android --skip_tests --android_sdk_path "C:\Users\dell\AppData\Local\Android\Sdk" --android_ndk_path "C:\Users\dell\AppData\Local\Android\Sdk\ndk\27.2.12479018" --android_abi arm64-v8a --android_api 29 --cmake_generator Ninja --use_nnapi

and into build/Windows/Release use cmd to install:

cmake --install .

into "C:\Program Files (x86)\onnxruntime\include\onnxruntime" cant't fund "nnapi_provider_factory.h" only see "cpu_provider_factory.h", and into "C:\Program Files (x86)\onnxruntime\lib" fund "libonnxruntime_providers_nnapi.a"

Urgency

No response

Platform

Android

OS Version

windows

ONNX Runtime Installation

Built from Source

Compiler Version (if 'Built from Source')

1.19.2

Package Name (if 'Released Package')

None

ONNX Runtime Version or Commit ID

ffceed9d44f2f3efb9dd69fa75fea51163c91d91

ONNX Runtime API

C++/C

Architecture

ARM64

Execution Provider

NNAPI

Execution Provider Library Version

No response

snnn commented 1 month ago

In https://github.com/microsoft/onnxruntime/blob/main/cmake/onnxruntime_providers_nnapi.cmake , we need something like:

install(FILES ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/cpu/cpu_provider_factory.h  DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/)

See: https://github.com/microsoft/onnxruntime/blob/main/cmake/onnxruntime_providers_cpu.cmake#L211

skottmckay commented 1 month ago

If you're building for Android it would be more typical to build an AAR and use that in an Android app than to use cmake --install.

https://onnxruntime.ai/docs/build/custom.html#android

If you don't want to build an AAR that the header can simply be copied from https://github.com/microsoft/onnxruntime/tree/main/include/onnxruntime/core/providers/nnapi to wherever you need it.

WangHHY19931001 commented 1 month ago

If you're building for Android it would be more typical to build an AAR and use that in an Android app than to use cmake --install.

https://onnxruntime.ai/docs/build/custom.html#android

If you don't want to build an AAR that the header can simply be copied from https://github.com/microsoft/onnxruntime/tree/main/include/onnxruntime/core/providers/nnapi to wherever you need it.

i want build native only lib, but it not work, see lib/pc need a lib which been named "libonnxruntime.a", but not have, need some help

skottmckay commented 1 month ago

All the individual static libraries required are copied to the lib directory. You should be able to link against those. We don't explicitly create a libonnxruntime.a that combines them.

WangHHY19931001 commented 1 month ago

All the individual static libraries required are copied to the lib directory. You should be able to link against those. We don't explicitly create a libonnxruntime.a that combines them.

copy all static lib and libc libm link success, but not work