Skip to content

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

Open
@abroy77

Description

@abroy77

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions