microsoft / onnxruntime

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

[Build] #18617

Open Souliloquy opened 9 months ago

Souliloquy commented 9 months ago

Describe the issue

Unity iOS builds are not compatible with any of the provided Microsoft.ML.OnnxRuntime.Managed dlls, I have tried:

netstandard2.0

net6.0-ios16.1 xamarinios10
netcoreapp3.1

Urgency

I'm currently using OpenCV to run the models but I'd like the performance boost from OnnxRuntime.

Target platform

iOS

Build script

Using Unity

Error / output

"Dll not found" - I suspect this error is happening due to compatibility issues with .Net 2.0 and the Unity build for iOS. I get a "Dll not found error" on runtime even though the Dll is only used during Unity build time...

Visual Studio Version

No response

GCC / Compiler Version

No response

Souliloquy commented 9 months ago

This was tested with OnnxRuntime 1.16.1 and 1.16.3

skottmckay commented 9 months ago

This may be of help: https://www.hanachiru-blog.com/entry/2022/06/30/120000

Based on that post it seems like Unity potentially changes how the managed code is used, especially around defining the DllName for importing the native dll, leading to issues.