Skip to content

Ort v1.15 fails to build for i686-pc-windows-msvc targets #64

Closed
@mush42

Description

Hi,

The title says it all. Under x86_64-pc-windows-msvc targets everything works perfectly, but the build fails under i686-pc-windows-msvc targets.

These are the errors I get
    Checking ort v1.15.0
error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\environment.rs:88:56
    |
88  |         let logging_function: sys::OrtLoggingFunction = Some(custom_logger);
    |                                                         ---- ^^^^^^^^^^^^^ expected "C" fn, found "stdcall" fn
    |                                                         |
    |                                                         arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, OrtLoggingLevel, _, _, _, _)`
                  found fn item `extern "stdcall" fn(_, OrtLoggingLevel, _, _, _, _) {custom_logger}`
    = note: when the arguments and return types match, functions can be coerced to function pointers
help: the type constructed contains `extern "stdcall" fn(*mut c_void, OrtLoggingLevel, *const i8, *const i8, *const i8, *const i8) {custom_logger}` due to the type of the argument passed
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\environment.rs:88:51
    |
88  |         let logging_function: sys::OrtLoggingFunction = Some(custom_logger);
    |                                                         ^^^^^-------------^
    |                                                              |
    |                                                              this argument influences the type of `Some`
note: tuple variant defined here
   --> C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:572:5
    |
572 |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     ^^^^

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\environment.rs:99:56
    |
99  |         let logging_function: sys::OrtLoggingFunction = Some(custom_logger);
    |                                                         ---- ^^^^^^^^^^^^^ expected "C" fn, found "stdcall" fn
    |                                                         |
    |                                                         arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, OrtLoggingLevel, _, _, _, _)`
                  found fn item `extern "stdcall" fn(_, OrtLoggingLevel, _, _, _, _) {custom_logger}`
    = note: when the arguments and return types match, functions can be coerced to function pointers
help: the type constructed contains `extern "stdcall" fn(*mut c_void, OrtLoggingLevel, *const i8, *const i8, *const i8, *const i8) {custom_logger}` due to the type of the argument passed
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\environment.rs:99:51
    |
99  |         let logging_function: sys::OrtLoggingFunction = Some(custom_logger);
    |                                                         ^^^^^-------------^
    |                                                              |
    |                                                              this argument influences the type of `Some`
note: tuple variant defined here
   --> C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:572:5
    |
572 |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     ^^^^

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\environment.rs:203:57
    |
203 |             let logging_function: sys::OrtLoggingFunction = Some(custom_logger);
    |                                                             ---- ^^^^^^^^^^^^^ expected "C" fn, found "stdcall" fn
    |                                                             |
    |                                                             arguments to this enum variant are incorrect
    |
    = note: expected fn pointer `unsafe extern "C" fn(_, OrtLoggingLevel, _, _, _, _)`
                  found fn item `extern "stdcall" fn(_, OrtLoggingLevel, _, _, _, _) {custom_logger}`
    = note: when the arguments and return types match, functions can be coerced to function pointers
help: the type constructed contains `extern "stdcall" fn(*mut c_void, OrtLoggingLevel, *const i8, *const i8, *const i8, *const i8) {custom_logger}` due to the type of the argument passed
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\environment.rs:203:52
    |
203 |             let logging_function: sys::OrtLoggingFunction = Some(custom_logger);
    |                                                             ^^^^^-------------^
    |                                                                  |
    |                                                                  this argument influences the type of `Some`
note: tuple variant defined here
   --> C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\option.rs:572:5
    |
572 |     Some(#[stable(feature = "rust1", since = "1.0.0")] T),
    |     ^^^^

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:778:20
    |
778 |         extract_io_count(f, session_ptr)
    |         ---------------- ^ expected "stdcall" fn, found "C" fn
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_, _) -> _`
               found fn pointer `unsafe extern "C" fn(_, _) -> _`
note: function defined here
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:786:5
    |
786 |     fn extract_io_count(
    |        ^^^^^^^^^^^^^^^^
787 |         f: extern_system_fn! { unsafe fn(*const sys::OrtSession, *mut usize) -> *mut sys::OrtStatus },
    |         ---------------------------------------------------------------------------------------------

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:783:20
    |
783 |         extract_io_count(f, session_ptr)
    |         ---------------- ^ expected "stdcall" fn, found "C" fn
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_, _) -> _`
               found fn pointer `unsafe extern "C" fn(_, _) -> _`
note: function defined here
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:786:5
    |
786 |     fn extract_io_count(
    |        ^^^^^^^^^^^^^^^^
787 |         f: extern_system_fn! { unsafe fn(*const sys::OrtSession, *mut usize) -> *mut sys::OrtStatus },
    |         ---------------------------------------------------------------------------------------------

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:802:19
    |
802 |         extract_io_name(f, session_ptr, allocator_ptr, i)
    |         --------------- ^ expected "stdcall" fn, found "C" fn
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_, _, _, _) -> _`
               found fn pointer `unsafe extern "C" fn(_, _, _, _) -> _`
note: function defined here
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:816:5
    |
816 |       fn extract_io_name(
    |          ^^^^^^^^^^^^^^^
817 | /         f: extern_system_fn! { unsafe fn(
818 | |             *const sys::OrtSession,
819 | |             size_t,
820 | |             *mut sys::OrtAllocator,
821 | |             *mut *mut c_char,
822 | |         ) -> *mut sys::OrtStatus },
    | |__________________________________-

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:807:19
    |
807 |         extract_io_name(f, session_ptr, allocator_ptr, i)
    |         --------------- ^ expected "stdcall" fn, found "C" fn
    |         |
    |         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_, _, _, _) -> _`
               found fn pointer `unsafe extern "C" fn(_, _, _, _) -> _`
note: function defined here
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:816:5
    |
816 |       fn extract_io_name(
    |          ^^^^^^^^^^^^^^^
817 | /         f: extern_system_fn! { unsafe fn(
818 | |             *const sys::OrtSession,
819 | |             size_t,
820 | |             *mut sys::OrtAllocator,
821 | |             *mut *mut c_char,
822 | |         ) -> *mut sys::OrtStatus },
    | |__________________________________-

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:839:45
    |
839 |         let (input_type, dimensions) = extract_io(f, session_ptr, i as _)?;
    |                                        ---------- ^ expected "stdcall" fn, found "C" fn
    |                                        |
    |                                        arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_, _, _) -> _`
               found fn pointer `unsafe extern "C" fn(_, _, _) -> _`
note: function defined here
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:858:5
    |
858 |       fn extract_io(
    |          ^^^^^^^^^^
859 | /         f: extern_system_fn! { unsafe fn(
860 | |             *const sys::OrtSession,
861 | |             size_t,
862 | |             *mut *mut sys::OrtTypeInfo,
863 | |         ) -> *mut sys::OrtStatus },
    | |__________________________________-

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:850:46
    |
850 |         let (output_type, dimensions) = extract_io(f, session_ptr, i as _)?;
    |                                         ---------- ^ expected "stdcall" fn, found "C" fn
    |                                         |
    |                                         arguments to this function are incorrect
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_, _, _) -> _`
               found fn pointer `unsafe extern "C" fn(_, _, _) -> _`
note: function defined here
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\session.rs:858:5
    |
858 |       fn extract_io(
    |          ^^^^^^^^^^
859 | /         f: extern_system_fn! { unsafe fn(
860 | |             *const sys::OrtSession,
861 | |             size_t,
862 | |             *mut *mut sys::OrtTypeInfo,
863 | |         ) -> *mut sys::OrtStatus },
    | |__________________________________-

error[E0308]: mismatched types
  --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\lib.rs:97:87
   |
45 | ... ($(#[$meta])* unsafe extern "stdcall" fn $($tt)*);
   |                   ------ expected due to this
...
97 | ...em_fn! { unsafe fn () -> *const ffi::c_char } = (*base).GetVersionString.unwrap();
   |                                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "stdcall" fn, found "C" fn
   |
   = note: expected fn pointer `unsafe extern "stdcall" fn() -> _`
              found fn pointer `unsafe extern "C" fn() -> _`

error[E0308]: mismatched types
   --> C:\Users\user\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ort-1.15.0\src\lib.rs:112:78
    |
45  |     ($(#[$meta:meta])* unsafe fn $($tt:tt)*) => ($(#[$meta])* unsafe extern "stdcall" fn $($tt)*);
    |                                                               ------ expected due to this
...
112 |             let get_api: extern_system_fn! { unsafe fn(u32) -> *const sys::OrtApi } = (*base).GetApi.unwrap();
    |                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^ expected "stdcall" fn, found "C" fn
    |
    = note: expected fn pointer `unsafe extern "stdcall" fn(_) -> _`
               found fn pointer `unsafe extern "C" fn(_) -> _`

For more information about this error, try `rustc --explain E0308`.
error: could not compile `ort` (lib) due to 11 previous errors
warning: build failed, waiting for other jobs to finish...

Best
Musharraf

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions