usearch: Bug: error: linking with `cc` failed: exit status: 1 in rust crate
Describe the bug
It builds, but upon running it errors.
note: /usr/bin/ld: /workspaces/test/target/debug/deps/libusearch-82cbab353a3106f1.rlib(usearch-82cbab353a3106f1.usearch.8bd6f700c2917180-cgu.0.rcgu.o): in function `usearch::ffi::new_native_index':
/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/usearch-2.10.3/rust/lib.rs:55: undefined reference to `cxxbridge1$new_native_index'
/usr/bin/ld: /workspaces/test/target/debug/deps/libusearch-82cbab353a3106f1.rlib(usearch-82cbab353a3106f1.usearch.8bd6f700c2917180-cgu.0.rcgu.o): in function `usearch::ffi::NativeIndex::load':
/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/usearch-2.10.3/rust/lib.rs:84: undefined reference to `cxxbridge1$NativeIndex$load'
/usr/bin/ld: /workspaces/test/target/debug/deps/libusearch-82cbab353a3106f1.rlib(usearch-82cbab353a3106f1.usearch.8bd6f700c2917180-cgu.0.rcgu.o): in function `<usearch::ffi::NativeIndex as cxx::unique_ptr::UniquePtrTarget>::__raw':
/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/usearch-2.10.3/rust/lib.rs:55: undefined reference to `cxxbridge1$unique_ptr$NativeIndex$raw'
/usr/bin/ld: /workspaces/test/target/debug/deps/libusearch-82cbab353a3106f1.rlib(usearch-82cbab353a3106f1.usearch.8bd6f700c2917180-cgu.0.rcgu.o): in function `<usearch::ffi::NativeIndex as cxx::unique_ptr::UniquePtrTarget>::__get':
/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/usearch-2.10.3/rust/lib.rs:55: undefined reference to `cxxbridge1$unique_ptr$NativeIndex$get'
/usr/bin/ld: /workspaces/test/target/debug/deps/libusearch-82cbab353a3106f1.rlib(usearch-82cbab353a3106f1.usearch.8bd6f700c2917180-cgu.0.rcgu.o): in function `<usearch::ffi::NativeIndex as cxx::unique_ptr::UniquePtrTarget>::__drop':
/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/usearch-2.10.3/rust/lib.rs:55: undefined reference to `cxxbridge1$unique_ptr$NativeIndex$drop'
collect2: error: ld returned 1 exit status
= note: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the `-l` flag to specify native libraries to link
= note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-link-lib)
Steps to reproduce
Running in a container.
pub async fn new(opt: &ContentIndexSettings) -> Self {
let db_path = db_check_path(&opt.context_index_name, "usearch")
.await
.unwrap();
let usearch_filename = format!("{}/index.usearch", db_path);
let options = IndexOptions {
dimensions: 1024,
metric: MetricKind::Cos,
quantization: ScalarKind::F32,
connectivity: 0,
expansion_add: 0,
expansion_search: 0,
multi: false,
};
let index = new_index(&options);
let index = match index {
Ok(index) => index,
Err(e) => panic!("Failed to create index: {}", e),
};
index.load(&usearch_filename).unwrap();
Self {
index,
usearch_filename,
}
}
Expected behavior
To run.
USearch version
2.10.3
Operating System
Ubuntu 22.04
Hardware architecture
x86
Which interface are you using?
Other bindings
Contact Details
No response
Is there an existing issue for this?
- I have searched the existing issues
Code of Conduct
- I agree to follow this projectโs Code of Conduct
About this issue
- Original URL
- State: closed
- Created 3 months ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Make: Configure Rust compilation options Closes #378 — committed to unum-cloud/usearch by ashvardanian 3 months ago
- Build: Released 2.11.0 [skip ci] # [2.11.0](https://github.com/unum-cloud/usearch/compare/v2.10.5...v2.11.0) (2024-04-08) ### Add * `b1x8` for Rust ([540fc75](https://github.com/unum-cloud/usearch/... — committed to unum-cloud/usearch by semantic-release-bot 3 months ago
- Make: Add submodules to Crates Relates to #378. but doesn't fix it — committed to unum-cloud/usearch by ashvardanian 3 months ago
- Make: Package submodules without `Cargo.toml` This is not the cleanest solution, but it is the simplest one. Using Cargo workspaces didn't work, nor did Cargo-deps, and "include" and "exclude" comman... — committed to unum-cloud/usearch by ashvardanian 3 months ago
- Build: Released 2.11.2 [skip ci] ## [2.11.2](https://github.com/unum-cloud/usearch/compare/v2.11.1...v2.11.2) (2024-04-10) ### Make * Add submodules to Crates ([86a8d8c](https://github.com/unum-clo... — committed to unum-cloud/usearch by semantic-release-bot 3 months ago
Iโll try it in the morning if itโs pushed to crates registry!
๐ This issue has been resolved in version 2.11.2 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐
To quote the docs:
You should depend on those other crates instead of inlining them in this one. That will also help prevent weird symbol mismatches.
One new problem is that
build.rs
is now completely missing from the crate:(it probably needs to be added to
package.include
insideCargo.toml
)Also, note that
stdsimd
is still not included in the crateโฆ๐ This issue has been resolved in version 2.11.0 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐
@ashvardanian sorry, I donโt have the build logs from trying to build with the repos cloned.
No PR from me. This is WAY above my pay grade ๐
FWIW, I tried with both the latest clang and g++ libs.