pykeio / ort

Fast ML inference & training for Rust with ONNX Runtime
https://ort.pyke.io/
Apache License 2.0
910 stars 102 forks source link

Failed to resolve: could not find `size_t` in `ort_sys` #320

Closed mikeparisstuff closed 5 days ago

mikeparisstuff commented 5 days ago

I use the fastembed-rs library and as of ~an hour ago, I started seeing these errors when trying to build a docker container that has, until now, built successfully.

I'm not sure where the issue originates but wanted to post here in case anyone knows how to resolve the issue? Let me know if you need more details?

#25 41.91    Compiling ort v2.0.0-rc.8
#25 42.05    Compiling hf-hub v0.3.2
#25 42.19 error[E0433]: failed to resolve: could not find `size_t` in `ort_sys`
#25 42.19   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/execution_providers/rocm.rs:32:28
#25 42.19    |
#25 42.19 32 |             gpu_mem_limit: ort_sys::size_t::MAX,
#25 42.19    |                                     ^^^^^^ could not find `size_t` in `ort_sys`
#25 42.19 
#25 42.21 error[E0433]: failed to resolve: could not find `size_t` in `ort_sys`
#25 42.21    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:130:27
#25 42.21     |
#25 42.21 130 |         let mut size = ort_sys::size_t::default();
#25 42.21     |                                 ^^^^^^ could not find `size_t` in `ort_sys`
#25 42.21 
#25 42.21 error[E0433]: failed to resolve: could not find `size_t` in `ort_sys`
#25 42.21    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:143:27
#25 42.21     |
#25 42.21 143 |         let mut size = ort_sys::size_t::default();
#25 42.21     |                                 ^^^^^^ could not find `size_t` in `ort_sys`
#25 42.21 
#25 42.21 error[E0433]: failed to resolve: could not find `size_t` in `ort_sys`
#25 42.22    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:156:27
#25 42.22     |
#25 42.22 156 |         let mut size = ort_sys::size_t::default();
#25 42.22     |                                 ^^^^^^ could not find `size_t` in `ort_sys`
#25 42.22 
#25 42.24 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.24   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/execution_providers/openvino.rs:13:24
#25 42.24    |
#25 42.24 13 |     num_threads: ort_sys::size_t,
#25 42.24    |                           ^^^^^^ not found in `ort_sys`
#25 42.24 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/execution_providers/rocm.rs:13:26
#25 42.25    |
#25 42.25 13 |     gpu_mem_limit: ort_sys::size_t,
#25 42.25    |                             ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/execution_providers/mod.rs:203:32
#25 42.25     |
#25 42.25 203 |     pub fn len(&self) -> ort_sys::size_t {
#25 42.25     |                                   ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/io_binding.rs:215:55
#25 42.25     |
#25 42.25 215 |         let mut count = self.output_names.len() as ort_sys::size_t;
#25 42.25     |                                                             ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:122:91
#25 42.25     |
#25 42.25 122 |         pub(crate) unsafe fn GetInputMemoryType(_: *const ort_sys::OrtCustomOp, index: ort_sys::size_t) -> ort_sys::OrtMemType {
#25 42.25     |                                                                                                 ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:127:95
#25 42.25     |
#25 42.25 127 | ...   pub(crate) unsafe fn GetInputCharacteristic(_: *const ort_sys::OrtCustomOp, index: ort_sys::size_t) -> ort_sys::OrtCustomOpInputOut...
#25 42.25     |                                                                                                   ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:132:96
#25 42.25     |
#25 42.25 132 | ...   pub(crate) unsafe fn GetOutputCharacteristic(_: *const ort_sys::OrtCustomOp, index: ort_sys::size_t) -> ort_sys::OrtCustomOpInputOu...
#25 42.25     |                                                                                                    ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:137:86
#25 42.25     |
#25 42.25 137 |         pub(crate) unsafe fn GetInputTypeCount(_: *const ort_sys::OrtCustomOp) -> ort_sys::size_t {
#25 42.25     |                                                                                            ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:142:87
#25 42.25     |
#25 42.25 142 |         pub(crate) unsafe fn GetOutputTypeCount(_: *const ort_sys::OrtCustomOp) -> ort_sys::size_t {
#25 42.25     |                                                                                             ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:147:85
#25 42.25     |
#25 42.25 147 |         pub(crate) unsafe fn GetInputType(_: *const ort_sys::OrtCustomOp, index: ort_sys::size_t) -> ort_sys::ONNXTensorElementDataType {
#25 42.25     |                                                                                           ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/bound.rs:155:86
#25 42.25     |
#25 42.25 155 |         pub(crate) unsafe fn GetOutputType(_: *const ort_sys::OrtCustomOp, index: ort_sys::size_t) -> ort_sys::ONNXTensorElementDataType {
#25 42.25     |                                                                                            ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:41:32
#25 42.25    |
#25 42.25 41 |         let mut num_inputs: ort_sys::size_t = 0;
#25 42.25    |                                      ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:46:31
#25 42.25    |
#25 42.25 46 |             let mut name_len: ort_sys::size_t = 0;
#25 42.25    |                                        ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:63:33
#25 42.25    |
#25 42.25 63 |         let mut num_outputs: ort_sys::size_t = 0;
#25 42.25    |                                       ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:68:31
#25 42.25    |
#25 42.25 68 |             let mut name_len: ort_sys::size_t = 0;
#25 42.25    |                                        ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:85:30
#25 42.25    |
#25 42.25 85 |         let mut name_len: ort_sys::size_t = 0;
#25 42.25    |                                    ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:221:76
#25 42.25     |
#25 42.25 221 |         ortsys![unsafe KernelContext_GetInput(self.ptr.as_ptr(), idx as ort_sys::size_t, &mut value_ptr)?];
#25 42.25     |                                                                                  ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:228:77
#25 42.25     |
#25 42.25 228 |         ortsys![unsafe KernelContext_GetOutput(self.ptr.as_ptr(), idx as ort_sys::size_t, shape.as_ptr(), shape.len() as _, &mut valu...
#25 42.25     |                                                                                   ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:233:25
#25 42.25     |
#25 42.25 233 |         let mut num: ort_sys::size_t = 0;
#25 42.25     |                               ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:239:25
#25 42.25     |
#25 42.25 239 |         let mut num: ort_sys::size_t = 0;
#25 42.25     |                               ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/operator/kernel.rs:301:74
#25 42.25     |
#25 42.25 301 | extern "C" fn parallel_for_cb(user_data: *mut c_void, iterator: ort_sys::size_t) {
#25 42.25     |                                                                          ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/async.rs:137:99
#25 42.25     |
#25 42.25 137 |     pub(crate) fn async_callback(user_data: *mut c_void, _: *mut *mut ort_sys::OrtValue, _: ort_sys::size_t, status: *mut OrtStatus) {
#25 42.25     |                                                                                                      ^^^^^^ not found in `ort_sys`
#25 42.25 
#25 42.25 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.25    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/builder/impl_options.rs:161:41
#25 42.25     |
#25 42.26 161 |         let sizes = [buffer.len() as ort_sys::size_t];
#25 42.26     |                                               ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:518:78
#25 42.26     |
#25 42.26 518 |         f: extern_system_fn! { unsafe fn(*const ort_sys::OrtSession, *mut ort_sys::size_t) -> *mut ort_sys::OrtStatus },
#25 42.26     |                                                                                    ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:527:102
#25 42.26     |
#25 42.26 527 |     fn extract_input_name(session_ptr: NonNull<ort_sys::OrtSession>, allocator: &Allocator, i: ort_sys::size_t) -> Result<String> {
#25 42.26     |                                                                                                         ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:532:103
#25 42.26     |
#25 42.26 532 |     fn extract_output_name(session_ptr: NonNull<ort_sys::OrtSession>, allocator: &Allocator, i: ort_sys::size_t) -> Result<String> {
#25 42.26     |                                                                                                          ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:552:13
#25 42.26     |
#25 42.26 552 |             ort_sys::size_t,
#25 42.26     |                      ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:558:15
#25 42.26     |
#25 42.26 558 |         i: ort_sys::size_t
#25 42.26     |                     ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:586:13
#25 42.26     |
#25 42.26 586 |             ort_sys::size_t,
#25 42.26     |                      ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/session/mod.rs:590:15
#25 42.26     |
#25 42.26 590 |         i: ort_sys::size_t
#25 42.26     |                     ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26   --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/value/impl_sequence.rs:61:27
#25 42.26    |
#25 42.26 61 |                 let mut len: ort_sys::size_t = 0;
#25 42.26    |                                       ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/value/impl_tensor/extract.rs:306:37
#25 42.26     |
#25 42.26 306 |                     let mut total_length: ort_sys::size_t = 0;
#25 42.26     |                                                    ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.26 error[E0412]: cannot find type `size_t` in crate `ort_sys`
#25 42.26    --> /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ort-2.0.0-rc.8/src/value/impl_tensor/extract.rs:373:37
#25 42.26     |
#25 42.26 373 |                     let mut total_length: ort_sys::size_t = 0;
#25 42.26     |                                                    ^^^^^^ not found in `ort_sys`
#25 42.26 
#25 42.76    Compiling image v0.25.5
#25 43.28 Some errors have detailed explanations: E0412, E0433.
#25 43.28 For more information about an error, try `rustc --explain E0412`.
#25 43.29 error: could not compile `ort` (lib) due to 37 previous errors
#25 43.29 warning: build failed, waiting for other jobs to finish...
decahedron1 commented 5 days ago

Until fastembed-rs updates ort to rc.9 (cc @Anush008), pinning ort-sys to 2.0.0-rc.8 in your Cargo.toml should resolve this:

[dependencies]
ort-sys = "=2.0.0-rc.8"
mikeparisstuff commented 5 days ago

🦸 Hero!

That worked. Thank you for the help.

Anush008 commented 4 days ago

Hey. I'm running into https://github.com/Anush008/fastembed-rs/actions/runs/11966739911/job/33362853838?pr=125 while bumping to v2.0.0-rc.9. Any ideas on this issue?

decahedron1 commented 4 days ago

MS released ONNX Runtime v1.20.1 an hour after I released rc.9, with https://github.com/microsoft/onnxruntime/pull/22719 which I believe fixes the issue you're running into (since the problematic node is also SkipLayerNormalization). I have builds for that version running now which you could use w/ custom linking, but unfortunately due to the timing they probably won't land in another rc any time soon.

(btw, https://github.com/Anush008/fastembed-rs/pull/124 can be reverted if you like 🙂)

Anush008 commented 4 days ago

Thank you. Custom linking fixed it. https://github.com/Anush008/fastembed-rs/commit/2180f1a60de764d659e6dcc5e320ba09fc66324d

(btw, https://github.com/Anush008/fastembed-rs/pull/124 can be reverted if you like 🙂)

~You mean the half feature is not needed?~ Yup. Not needed anymore.