lee670523
lee670523

Reputation: 21

How to generate C API for onnxruntime on Linux

I am trying to build onnxruntime from source on Linux. According to this instruction I have successfully built python wheels and shared libs. But I have not seen headers for C API.

There is a build option --build_csharp which seems to enable C#/C packages. I tried to add this option but got following errors.

CMake Warning at CMakeLists.txt:137 (message):
Language Csharp is not found in the system

I installed dotnet-sdk-3.1 but still got this error. Can I ask how to properly generate onnxruntime C API on Linux? Thanks!

Upvotes: 1

Views: 2605

Answers (1)

Kumar Arnav
Kumar Arnav

Reputation: 335

Please try the following steps:

- Steps to build ONNX from source code:
1. git clone --recursive https://github.com/Microsoft/onnxruntime
2. Get the commit ID of the version you want to build (In case you want older version)
3. git checkout "your commitID"
4. Install the required version of Cmake on your system
6. Run: <path>\build.sh --config Release --build_shared_lib --parallel
7. A build folder will be created in the onnxruntime.
5. Get the onnxruntime.dll from the dir: \onnxruntime\build\Windows\Release\Release
6. Get the required headers (onnxruntime_c_api.h, onnxruntime_cxx_api.h, onnxruntime_cxx_inline.h)
from the dir: \onnxruntime\include\onnxruntime\core\session and put it in the unit location.

Upvotes: 3

Related Questions