Closed ruqqq closed 1 year ago
It seems it could be c_ulonglong see rustdoc to have a chance to run as it needs to be a 64 bit integer
Make sense, made the change. Will be testing the integration with my app to confirm it works.
Hello All,
I have exactly the same problem with cross compiling using cargo-xwin:
error[E0308]: mismatched types --> /Users/jianshuzhao/Github/hnswlib-rs/src/libext.rs:439:39 | 439 | let c_dist = DistCFFI:: |
-------------------- ^^^^^^ expected u32 , found u64 |
---|---|---|---|
arguments to this function are incorrect | |||
= note: expected fn pointer `extern "C" fn(_, _, u32) -> _`
found fn pointer `extern "C" fn(_, _, u64) -> _`
note: associated function defined here
--> /Users/jianshuzhao/Github/hnswlib-rs/src/dist.rs:990:12
|
990 | pub fn new(f:DistCFnPtr
error[E0308]: mismatched types --> /Users/jianshuzhao/Github/hnswlib-rs/src/libext.rs:570:39 | 570 | let c_dist = DistCFFI:: |
-------------------- ^^^^^^ expected u32 , found u64 |
---|---|---|---|
arguments to this function are incorrect | |||
= note: expected fn pointer `extern "C" fn(_, _, u32) -> _`
found fn pointer `extern "C" fn(_, _, u64) -> _`
note: associated function defined here
--> /Users/jianshuzhao/Github/hnswlib-rs/src/dist.rs:990:12
|
990 | pub fn new(f:DistCFnPtr
error[E0308]: mismatched types --> /Users/jianshuzhao/Github/hnswlib-rs/src/libext.rs:629:39 | 629 | let c_dist = DistCFFI:: |
-------------------- ^^^^^^ expected u32 , found u64 |
---|---|---|---|
arguments to this function are incorrect | |||
= note: expected fn pointer `extern "C" fn(_, _, u32) -> _`
found fn pointer `extern "C" fn(_, _, u64) -> _`
note: associated function defined here
--> /Users/jianshuzhao/Github/hnswlib-rs/src/dist.rs:990:12
|
990 | pub fn new(f:DistCFnPtr
error[E0308]: mismatched types --> /Users/jianshuzhao/Github/hnswlib-rs/src/libext.rs:729:39 | 729 | let c_dist = DistCFFI:: |
-------------------- ^^^^^^ expected u32 , found u64 |
---|---|---|---|
arguments to this function are incorrect | |||
= note: expected fn pointer `extern "C" fn(_, _, u32) -> _`
found fn pointer `extern "C" fn(_, _, u64) -> _`
note: associated function defined here
--> /Users/jianshuzhao/Github/hnswlib-rs/src/dist.rs:990:12
|
990 | pub fn new(f:DistCFnPtr
error[E0308]: mismatched types --> /Users/jianshuzhao/Github/hnswlib-rs/src/libext.rs:786:38 | 786 | let c_dist = DistCFFI:: |
------------------- ^^^^^^ expected u32 , found u64 |
---|---|---|---|
arguments to this function are incorrect | |||
= note: expected fn pointer `extern "C" fn(_, _, u32) -> _`
found fn pointer `extern "C" fn(_, _, u64) -> _`
note: associated function defined here
--> /Users/jianshuzhao/Github/hnswlib-rs/src/dist.rs:990:12
|
990 | pub fn new(f:DistCFnPtr
For more information about this error, try rustc --explain E0308
.
error: could not compile hnsw_rs
(lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
I think this commit solved the problem, at least for cross compiling. I can now provide windows exe binary files for rust programs!!
Thanks,
Jianshu
merged
While building on x64 windows 11, with x86_64 stable rust, met with an error related to trying to fit a u64 into u32. Fixed by changing the types to use
c_ulong
instead of u64.