rust-ndarray / ndarray-linalg

Linear algebra package for rust-ndarray using LAPACK binding
Other
376 stars 74 forks source link

Apple silicon compile error: "ld: Undefined symbols" #373

Open abroy77 opened 8 months ago

abroy77 commented 8 months ago

Failing to compile the example script from the docs:

use ndarray::prelude::*;
use ndarray_linalg::Solve;

  fn main() {

      let a: Array2<f64> = array![[3., 2., -1.], [2., -2., 4.], [-2., 1., -2.]];
      let b: Array1<f64> = array![1., -2., 0.];
      let x = a.solve_into(b).unwrap();
      assert!(x.abs_diff_eq(&array![1., -2., -2.], 1e-9));

  }

MacOS version: 14.3.1 Device: Apple Macbook Pro M3 Pro Rust version:

rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: aarch64-apple-darwin
release: 1.76.0
LLVM version: 17.0.6

Cargo.toml dependencies:

[dependencies]
ndarray = "0.15.6"
ndarray-linalg = "0.16.0"

Main Error message:

note: ld: Undefined symbols:
            _dgetrf_, referenced from:
                lapack::dgetrf::h0fc923a6c9987636 in liblax-f78efd393904881d.rlib[10](lax-f78efd393904881d.lax.c010234ea3c8cc9-cgu.7.rcgu.o)
            _dgetrs_, referenced from:
                lapack::dgetrs::h997874d0f9aec842 in liblax-f78efd393904881d.rlib[10](lax-f78efd393904881d.lax.c010234ea3c8cc9-cgu.7.rcgu.o)
          clang: error: linker command failed with exit code 1 (use -v to see invocation)

Output for cargo build -v output.txt

ivnsch commented 4 months ago

Same error here. Mac book pro m1, 14.5, rust 1.81.0-nightly,

ndarray = "0.15.6"
ndarray-linalg = "0.16.0"