Open wesrer opened 4 years ago
You need to install BLAS and LAPACK libraries first. You need to install corresponding libraries to libopenblas
and liblapack
for OSX. Install steps for debian based systems is at:
https://github.com/SciRuby/numruby/blob/e52b49394fa0aaf575284ff6278cbb68602ad48c/travis.sh#L26
Try the answers in this link https://stackoverflow.com/questions/38114201/installing-lapack-and-blas-libraries-for-c-on-mac-os and post output logs here please.
For OSx Catalina, I have installed libopenblasp
with
brew install openblas
and for libblapack
with
brew install lapack
but this doesn't works for me, I think I should add some symbolic link but I'm not sure 🤔 , @wesrer have you solved this problem?
Sources:
@developerfab is correct. Both openblas
and lapack
and not properly symlinked to /usr/local
. If you do brew info openblas
, you get something like this:
openblas: stable 0.3.0 (bottled), HEAD [keg-only]
Optimized BLAS library
https://www.openblas.net/
/usr/local/Cellar/openblas/0.3.0 (22 files, 139MB)
Poured from bottle on 2018-05-31 at 20:42:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openblas.rb
==> Dependencies
Required: gcc ✔
==> Options
--with-openmp
Enable parallel computations with OpenMP
--HEAD
Install HEAD version
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BLAS and LAPACK in the Accelerate framework.
So, one way is to either forcefully link openblas
and lapack
to /usr/local
and other is to just add /usr/opt/
paths of openblas
and lapack
to compilation step, so that they can be linked through that.
I've made a PR which does this and can be found here at https://github.com/SciRuby/numruby/pull/40.
@wesrer @developerfab please try this fix and let me know if it fixes the issue on your machine. I got it to work on a friend's mac.
I added this in my ~/.bash_profile
I'm not sure if it is necessary :thinking: :
export LDFLAGS="-L/usr/local/opt/lapack/lib"
export LDFLAGS="$LDFLAGS:-L/usr/local/opt/openblas/lib"
export CPPFLAGS="-I/usr/local/opt/lapack/include"
export CPPFLAGS="$CPPFLAGS:-I/usr/local/opt/openblas/include"
export PKG_CONFIG_PATH="/usr/local/opt/lapack/lib/pkgconfig"
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openblas/lib/pkgconfig"
The output when I ran the rake compile
was:
64 warnings generated.
linking shared-object nmatrix.bundle
ld: warning: directory not found for option '-L/opt/local/lib'
cd -
mkdir -p tmp/x86_64-darwin19/stage/lib/
install -c tmp/x86_64-darwin19/nmatrix/2.6.5/nmatrix.bundle lib//nmatrix.bundle
cp tmp/x86_64-darwin19/nmatrix/2.6.5/nmatrix.bundle tmp/x86_64-darwin19/stage/lib//nmatrix.bundle
I think that this ran perfectly.
@developerfab this pretty much does the same thing as the PR I submitted. Both provide location for openBLAS and LAPACK so that the compiler can link them. But this approach requires user to manually add the path and is also on system level and not project level. So, I believe the PR solution should be a better one.
Also, let me know if it works only with the change done in PR and without changing the ‘ ~/.bash_profile’.
@wesrer Have you solved this issue? I am getting this error when I run rake test
➜ numruby git:(master) rake test
/Users/rajivranjansingh/Desktop/numruby/lib/numruby/lapack.rb:12: warning: assigned but unused variable - m
/Users/rajivranjansingh/Desktop/numruby/lib/numruby/lapack.rb:12: warning: assigned but unused variable - n
/Users/rajivranjansingh/Desktop/numruby/lib/numruby/lapack.rb:81: warning: assigned but unused variable - lu
/Users/rajivranjansingh/Desktop/numruby/lib/numruby/lapack.rb:81: warning: assigned but unused variable - ipiv
File does not exist: /Users/rajivranjansingh/Desktop/numruby/lib/numruby.so
rake aborted!
Command failed with status (1)
/Library/Ruby/Gems/2.6.0/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
Tasks: TOP => test
(See full trace by running task with --trace)
Hi, I am trying to compile from source, but I get a bunch of errors for seemingly missing files. Here's my output for
rake compile --trace
and here's my output for
rake test --trace