Can’t link to C library despite explicit command in build.rs

I am trying to link a library against a local build of arpack. I have compiled arpack itself and I have it as a static binary. I then make this build.rs

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>use std::env;
use std::path::Path;
fn main() {
// Get the path to the directory containing the Cargo.toml file (workspace root)
let workspace_root =
env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
// Define the path to the directory containing the native libraries relative to the workspace root
let lib_path = Path::new(&workspace_root).join("arpack-ng/build/");
println!("cargo:warning={}", lib_path.display());
// Print the instructions for Cargo to find the native libraries
println!("cargo:rustc-link-search=native={}", lib_path.display());
println!("cargo:rustc-link-lib=static=arpack");
}
</code>
<code>use std::env; use std::path::Path; fn main() { // Get the path to the directory containing the Cargo.toml file (workspace root) let workspace_root = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"); // Define the path to the directory containing the native libraries relative to the workspace root let lib_path = Path::new(&workspace_root).join("arpack-ng/build/"); println!("cargo:warning={}", lib_path.display()); // Print the instructions for Cargo to find the native libraries println!("cargo:rustc-link-search=native={}", lib_path.display()); println!("cargo:rustc-link-lib=static=arpack"); } </code>
use std::env;
use std::path::Path;

fn main() {
    // Get the path to the directory containing the Cargo.toml file (workspace root)
    let workspace_root =
        env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");

    // Define the path to the directory containing the native libraries relative to the workspace root
    let lib_path = Path::new(&workspace_root).join("arpack-ng/build/");

    println!("cargo:warning={}", lib_path.display());

    // Print the instructions for Cargo to find the native libraries
    println!("cargo:rustc-link-search=native={}", lib_path.display());
    println!("cargo:rustc-link-lib=static=arpack");
}

This fails with this error:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code> = note: /usr/bin/ld: /home/makogan/rust_never_engine/crates/algebra/target/debug/deps/algebra-8ab0fc9a1c48e81c.8q7c32k90oqy6djs87syi3nmg.rcgu.o: in function `algebra::eigen_decomposition::faer_arpack_symmetric_f64':
/home/makogan/rust_never_engine/crates/algebra/src/eigen_decomposition.rs:150:(.text._ZN7algebra19eigen_decomposition25faer_arpack_symmetric_f6417h42c779a97fe8f680E+0xa27): undefined reference to `dsaupd_c'
/usr/bin/ld: /home/makogan/rust_never_engine/crates/algebra/src/eigen_decomposition.rs:199:(.text._ZN7algebra19eigen_decomposition25faer_arpack_symmetric_f6417h42c779a97fe8f680E+0x2b7d): undefined reference to `dseupd_c'
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)
The following warnings were emitted during compilation:
warning: [email protected]: /home/makogan/rust_never_engine/crates/algebra/arpack-ng/build/
</code>
<code> = note: /usr/bin/ld: /home/makogan/rust_never_engine/crates/algebra/target/debug/deps/algebra-8ab0fc9a1c48e81c.8q7c32k90oqy6djs87syi3nmg.rcgu.o: in function `algebra::eigen_decomposition::faer_arpack_symmetric_f64': /home/makogan/rust_never_engine/crates/algebra/src/eigen_decomposition.rs:150:(.text._ZN7algebra19eigen_decomposition25faer_arpack_symmetric_f6417h42c779a97fe8f680E+0xa27): undefined reference to `dsaupd_c' /usr/bin/ld: /home/makogan/rust_never_engine/crates/algebra/src/eigen_decomposition.rs:199:(.text._ZN7algebra19eigen_decomposition25faer_arpack_symmetric_f6417h42c779a97fe8f680E+0x2b7d): undefined reference to `dseupd_c' 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) The following warnings were emitted during compilation: warning: [email protected]: /home/makogan/rust_never_engine/crates/algebra/arpack-ng/build/ </code>
 = note: /usr/bin/ld: /home/makogan/rust_never_engine/crates/algebra/target/debug/deps/algebra-8ab0fc9a1c48e81c.8q7c32k90oqy6djs87syi3nmg.rcgu.o: in function `algebra::eigen_decomposition::faer_arpack_symmetric_f64':
          /home/makogan/rust_never_engine/crates/algebra/src/eigen_decomposition.rs:150:(.text._ZN7algebra19eigen_decomposition25faer_arpack_symmetric_f6417h42c779a97fe8f680E+0xa27): undefined reference to `dsaupd_c'
          /usr/bin/ld: /home/makogan/rust_never_engine/crates/algebra/src/eigen_decomposition.rs:199:(.text._ZN7algebra19eigen_decomposition25faer_arpack_symmetric_f6417h42c779a97fe8f680E+0x2b7d): undefined reference to `dseupd_c'
          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)

The following warnings were emitted during compilation:

warning: [email protected]: /home/makogan/rust_never_engine/crates/algebra/arpack-ng/build/

I have compiled arpack, the file libarpack.a exists under the path /home/makogan/rust_never_engine/crates/algebra/arpack-ng/build/. So the library exists, and the build.rs is pointing to the correct location, why is cargo not linking it?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật