onnxruntime: [Mobile] onnxruntime-c and onnxruntime-extensions-c pod conflict with DocumentReader pod
Describe the issue
My app already contains the DocumentReader pod from Regula(https://github.com/regulaforensics/DocumentReader-iOS) then add “pod ‘onnxruntime-objc’, ‘1.14.0’” and App runs fine.
When I have tried to create
auto m_envPtr = Ort::Env();
It gives EXC_BAD_ACCESS error.
For testing purposes I have removed the DocumentReader pod then It is working fine.
Please check the screenshot given.

Please help me how to fix this issue. Thanks!
To reproduce
Download the project from this repo(https://github.com/microsoft/onnxruntime-inference-examples/tree/main/mobile/examples/super_resolution/ios/ORTSuperResolution) and just add the following pod in the Podfile.
pod 'DocumentReader', '~> 6.1'
Then just run the app on the device or simulator you will get the same error as mentioned above.
Urgency
No response
Platform
iOS
OS Version
16.3.1
ONNX Runtime Installation
Built from Source
Compiler Version (if ‘Built from Source’)
No response
Package Name (if ‘Released Package’)
None
ONNX Runtime Version or Commit ID
1.14.0
ONNX Runtime API
C++/C
Architecture
X64
Execution Provider
Default CPU
Execution Provider Library Version
No response
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 17 (12 by maintainers)
Looks like there is a shared library, DocumentReaderCore:
which exports symbol _OrtGetApiBase.
The static library in onnxruntime-c also has a symbol with the same name.
I’m able to reproduce the issue with a build on main.
This line in the output window provides a clue:
The given version [15] is not supported, only version 1 to 10 is supported in this build.Upon closer inspection, I noticed a similar line appears in your screenshot too.
The message is kind of cryptic. It comes from here: https://github.com/microsoft/onnxruntime/blob/c57cf374b67f72575546d7b4c69a1af4972e2b54/onnxruntime/core/session/onnxruntime_c_api.cc#L2677-L2685
Used by the C++ API here: https://github.com/microsoft/onnxruntime/blob/c57cf374b67f72575546d7b4c69a1af4972e2b54/include/onnxruntime/core/session/onnxruntime_cxx_api.h#L114-L121
This message means there is a mismatch between the
ORT_API_VERSIONvalue defined in the header file and the one in the ORT library, with the former being too new. Moreover, the result ofGetApi(ORT_API_VERSION)will benullptr, which is probably why we see the BAD_ACCESS error. There’s no check forGetApi(ORT_API_VERSION)'s result being null beforeGetApi()dereferences it and the Env constructor tries to use the result ofGetApi(): https://github.com/microsoft/onnxruntime/blob/c57cf374b67f72575546d7b4c69a1af4972e2b54/include/onnxruntime/core/session/onnxruntime_cxx_inline.h#L410-L411It seems that after adding the DocumentReaderFullRFID pod, the app starts using an older version of ORT. If you don’t require ORT 1.14, you could try using an older version like 1.10 (where ORT_API_VERSION == 10) or earlier.
I think we can also make this message clearer.