Skip to content

Bug: error: linking with cc failed: exit status: 1 in rust crate #378

@ShelbyJenkins

Description

@ShelbyJenkins

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is neededreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions