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 years ago
  • Comments: 20 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Yes, sorry. Metadata filtering - specifically date filtering. I know I could implement it myself, but I couldn’t think of an efficient way to do so!

No problem though, Usearch works great for some tasks.

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:

Regardless of whether exclude or include is specified, the following files are always excluded: Any sub-packages will be skipped (any subdirectory that contains a Cargo.toml file).

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:

$ tar xvf ~/.cargo/registry/cache/index.crates.io-6f17d22bba15001f/usearch-2.11.0.crate
usearch-2.11.0/.cargo_vcs_info.json
usearch-2.11.0/Cargo.toml
usearch-2.11.0/Cargo.toml.orig
usearch-2.11.0/README.md
usearch-2.11.0/fp16/include/fp16/__init__.py
usearch-2.11.0/fp16/include/fp16/avx.py
usearch-2.11.0/fp16/include/fp16/avx2.py
usearch-2.11.0/fp16/include/fp16/bitcasts.h
usearch-2.11.0/fp16/include/fp16/fp16.h
usearch-2.11.0/fp16/include/fp16/psimd.h
usearch-2.11.0/fp16/include/fp16.h
usearch-2.11.0/include/usearch/index.hpp
usearch-2.11.0/include/usearch/index_dense.hpp
usearch-2.11.0/include/usearch/index_plugins.hpp
usearch-2.11.0/rust/README.md
usearch-2.11.0/rust/lib.cpp
usearch-2.11.0/rust/lib.hpp
usearch-2.11.0/rust/lib.rs

(it probably needs to be added to package.include inside Cargo.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.