HaoboGu / ors

onnxruntime bindings for rust
Apache License 2.0
10 stars 2 forks source link

Can not build for target aarch64-unknown-linux-gnu #30

Open sainteckes opened 1 year ago

sainteckes commented 1 year ago

The target aarch64-unknown-linux-gnu is available as download from the onnxruntime github repo. The build script is not prepared for that, but when modifying the script or using ORT_ENV_STRATEGY=system a lot of names can't be found, for example:

error[E0412]: cannot find type `OrtApi` in this scope
  --> libs/ors/ors/src/api.rs:14:41
   |
14 |     static ref API: Arc<Mutex<AtomicPtr<OrtApi>>> =
   |                                         ^^^^^^ not found in this scope

error[E0412]: cannot find type `onnxruntime` in this scope
  --> libs/ors/ors/src/api.rs:16:54
   |
16 |     static ref LIB: Arc<Mutex<AtomicPtr<ManuallyDrop<onnxruntime>>>> =
   |                                                      ^^^^^^^^^^^ not found in this scope

Do you know the reason for that?

Would be really nice to use the library with Raspberry Pi :)

HaoboGu commented 1 year ago

Did you generated bindings, aka ors-sys by yourself? If you do, add your bindings here to make it available to ors package: https://github.com/HaoboGu/ors/blob/main/ors-sys/src/bindings/bindings.rs

sainteckes commented 1 year ago

No thanks for the hint I will try that!

sainteckes commented 1 year ago

Okay that worked fine, I generated Bindings from the c api and included the file in bindings.rs. Now it is complaining about the pointer types. It is expecting u8 but found i8. Do you know where this could be coming from?

HaoboGu commented 1 year ago

you can set here: https://github.com/HaoboGu/ors/blob/main/ors-sys/src/lib.rs

sainteckes commented 1 year ago

The lines complaining are those: https://github.com/HaoboGu/ors/blob/7a156f7218d9066411ecb34a7c046f8aadc6e802/ors/src/log.rs#L84

so e.g. category that is fixed to i8 is expected to be u8..

HaoboGu commented 1 year ago

try to convert category to u8 directly using as?