Apple silicon compile error: "ld: Undefined symbols"

Open
#373 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
macos, rust

Research direction

Start with the example script from the documentation, its Cargo.toml dependencies, and the attached output.txt from cargo build -v. Investigate the _dgetrf_ and _dgetrs_ linker failures on the reported Apple silicon environment. Done means the documented example builds successfully on the reported macOS and Rust versions.

Written by the indexing model from the issue text.

Description

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

Dominant language
Rust
Stars
452
Forks
95
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-ndarray/ndarray-linalg

All issues in rust-ndarray/ndarray-linalg

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.