Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run examples - linker errors to blas #54

Closed
Ploppz opened this issue Mar 12, 2019 · 3 comments
Closed

Can't run examples - linker errors to blas #54

Ploppz opened this issue Mar 12, 2019 · 3 comments

Comments

@Ploppz
Copy link

Ploppz commented Mar 12, 2019

cargo run --example a2c
-> note: /usr/bin/ld: cannot find -lopenblas

Then I installed openblas instead of blas (Arch Linux). Now it says:

  = note: /usr/bin/ld: /tmp/rsrl/target/debug/deps/liblfa-9d758421e5e2d7cc.rlib(lfa-9d758421e5e2d7cc.lfa.9q6n3def-cgu.1.rcgu.o): in function `ndarray::linalg::impl_linalg::<impl ndarray::ArrayBase<S, ndarray::dimension::dim::Dim<[usize; _]>>>::dot_impl':
          /home/ploppz/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/linalg/impl_linalg.rs:115: undefined reference to `cblas_sdot'
          /usr/bin/ld: /home/ploppz/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/linalg/impl_linalg.rs:115: undefined reference to `cblas_ddot'
          /usr/bin/ld: /tmp/rsrl/target/debug/deps/liblfa-9d758421e5e2d7cc.rlib(lfa-9d758421e5e2d7cc.lfa.9q6n3def-cgu.1.rcgu.o): in function `ndarray::linalg::impl_linalg::<impl ndarray::ArrayBase<S, ndarray::dimension::dim::Dim<[usize; _]>>>::dot_impl':
          /home/ploppz/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/linalg/impl_linalg.rs:115: undefined reference to `cblas_sdot'
          /usr/bin/ld: /home/ploppz/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/linalg/impl_linalg.rs:115: undefined reference to `cblas_ddot'
          /usr/bin/ld: /tmp/rsrl/target/debug/deps/liblfa-9d758421e5e2d7cc.rlib(lfa-9d758421e5e2d7cc.lfa.9q6n3def-cgu.12.rcgu.o): in function `ndarray::linalg::impl_linalg::mat_mul_impl':
          /home/ploppz/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/linalg/impl_linalg.rs:422: undefined reference to `cblas_sgemm'
          /usr/bin/ld: /home/ploppz/.cargo/registry/src/github.com-1ecc6299db9ec823/ndarray-0.12.1/src/linalg/impl_linalg.rs:422: undefined reference to `cblas_dgemm'
          collect2: error: ld returned 1 exit status

I tried to disable anything related to blas in Cargo.toml, changed lines look like:

ndarray = { version = "0.12", features = ["serde-1"] }
# ...
blas-src = { version = "0.2", default-features = false, features = [] }
openblas-src = { version = "0.6", default-features = false, features = ["system"] }

But that did not help at all.

@tspooner
Copy link
Owner

Hey,

So I have also had problems in the past with BLAS. I need to come up with a more robust solution for the end user as it will invariably be a problem in cases.

The specific issues you outline above have not cropped up for me before so I'm a little unsure how to debug. In the past it has been issues around where exactly the BLAS libraries are located on your system. As I typically work on either Ubuntu or Mac OS X, I would be lying if I said I knew how to solve this. Sorry I couldn't be more help but I will do what I can to solve this locally too and let you know. If you find a solution for it in the meantime, please do let me know and I will do what I can to document it and/or come up with a robust solution.

I'd start with looking up errors like this: "undefined reference to `cblas_sgemm'". These are the main issue.

Cheers,
Tom

@Ploppz
Copy link
Author

Ploppz commented Mar 12, 2019

It's a dependency that uses blas, right? Would it be possible to make all dependencies not use blas?

@tspooner
Copy link
Owner

See #66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants