Closed RoberTnf closed 5 years ago
Try and add extern crate openblas_src;
to the top of your main.rs
.
Reason is that cargo needs to explicitly link openblas with your library.
See the wiki of the rust blas GitHub organization.
On Wed, Jan 23, 2019, 17:13 Roberto Díaz Pérez <notifications@github.com wrote:
After trying various solutions, I can't get BLAS to work on ndarray 0.12.1. I keep getting the error: undefined reference to "cblas_ddot" cargo.toml
[dependencies] ndarray = { version = "0.12.1", features = ["blas"] } blas-src = { version = "*", default-features = false, features = ["openblas"] } openblas-src = { version = "0.6.1", default-features = false, features = ["cblas", "system"] }
main.rs
[macro_use]
extern crate ndarray;
fn main() { let p1 = array![1., 0., 0.]; let p2 = array![0., 0., 1.]; println!("{}", p1.dot(&p2)) }
Using the solution from: #251 (comment) https://github.com/rust-ndarray/ndarray/issues/251#issuecomment-292751938 works, but gives the same error when bumping ndarray to 0.12.1
I hope I didn't miss any obvious documentation!
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rust-ndarray/ndarray/issues/586, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqy-Z-ZCDpVMDs6KLIA1fyjX9eSRmzuks5vGIofgaJpZM4aPHkC .
With:
extern crate openblas_src;
#[macro_use]
extern crate ndarray;
fn main() {
let p1 = array![1., 0., 0.];
let p2 = array![0., 0., 1.];
println!("{}", p1.dot(&p2))
}
It's still not working, same error. You mean this page: https://github.com/blas-lapack-rs/blas-lapack-rs.github.io/wiki ? Thank you for your time!
I checked it on my end and everything works.
Since you explicitly configure and set "system"
as a feature of openblas_src
, are you sure you have it installed and available in your LD_LIBRARY_PATH
?
I'm on Arch Linux, with this packages:
cblas 3.8.0-2
openblas 0.3.5-1
LD_LIBRARY_PATH
was not set up, but after making it point to /usr/lib
, the command $ ls $LD_LIBRARY_PATH | grep blas
outputs:
libblas.so
libblas.so.3
libcblas.so
libcblas.so.3
libcblas.so.3.8.0
libgslcblas.so
libgslcblas.so.0
libgslcblas.so.0.0.0
libopenblasp-r0.3.5.so
libopenblas.so
libopenblas.so.3
But the error still persists.
I see. It might not be compatible, because openblas_src
right now assumes 0.3.4
.
With that said, this is not necessarily the problem and the solution might be something else.
I recommend removing "system"
. openblas_src
will then build openblas from scratch. The initial compilation takes some time, but once built it won't be recompiled.
This also makes you more independent from the particular system you want to run your executable from.
Thank you, that does work!
In Arch Linux the package community/openblas
somehow does not include the cblas_*
functions, which is why we get link errors on Arch Linux.
Currently I have to call gcc -lopenblas -lcblas
to correctly link the cblas_*
functions. It was mentioned that the aur/openblas-lapack
works fine I did not test that yet and used openblas in ndarray without the "system"
feature.
In the future mdeff is proposing to correct this miss behavior in https://bugs.archlinux.org/task/66092
Source: https://bugs.archlinux.org/task/59046?project=5&string=openblas
Thanks, @matzebond! On Arch, I installed the aur/openblas-lapack
package and everything is linking up great now. I did use the "system"
feature.
@sethmnielsen Thank you the other version did also not work for me (using Arch Linux WSL on Win10) and only the installation of aur/openblas-lapack
and uninstall of previous lapack
and openblas
worked.
I also used the features = ["openblas-system"]
in the Cargo.toml
for ndarray-linalg
.
After trying various solutions, I can't get BLAS to work on ndarray 0.12.1. I keep getting the error:
undefined reference to "cblas_ddot"
cargo.toml
main.rs
Using the solution from: https://github.com/rust-ndarray/ndarray/issues/251#issuecomment-292751938 works, but gives the same error when bumping ndarray to 0.12.1
I hope I didn't miss any obvious documentation!