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

Cannot install on OS X #64

Closed
alexspeller opened this issue Mar 19, 2013 · 10 comments
Closed

Cannot install on OS X #64

alexspeller opened this issue Mar 19, 2013 · 10 comments

Comments

@alexspeller
Copy link

I cannot get this working on OS X.

First I tried "gem install nmatrix". This resulted in the error about gcc not being up to date. I then used the script to install a later version of gcc. After a lot of fiddling I managed to get the gem install command to use that compiler. This gave the following error:

util/math.h:72:21: fatal error: cblas.h: No such file or directory

So then in #34 I found a reference to some environment variables:

export C_INCLUDE_PATH=/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers/
export CPLUS_INCLUDE_PATH=/System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers/

Then I get these results:

compiling nmatrix.cpp
In file included from nmatrix.cpp:49:0:
util/math.h: In function ‘int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = float]’:
util/math.h:1568:47: error: ‘clapack_spotrf’ was not declared in this scope
util/math.h: In function ‘int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = double]’:
util/math.h:1573:47: error: ‘clapack_dpotrf’ was not declared in this scope
util/math.h: In function ‘int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = nm::Complex<float>]’:
util/math.h:1578:72: error: ‘clapack_cpotrf’ was not declared in this scope
util/math.h: In function ‘int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = nm::Complex<double>]’:
util/math.h:1583:72: error: ‘clapack_zpotrf’ was not declared in this scope
util/math.h: In function ‘void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, float*, int)’:
util/math.h:2093:40: error: there are no arguments to ‘clapack_slauum’ that depend on a template parameter, so a declaration of ‘clapack_slauum’ must be available [-fpermissive]
util/math.h:2093:40: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
util/math.h: In function ‘void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, double*, int)’:
util/math.h:2098:40: error: there are no arguments to ‘clapack_dlauum’ that depend on a template parameter, so a declaration of ‘clapack_dlauum’ must be available [-fpermissive]
util/math.h: In function ‘void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, nm::Complex64*, int)’:
util/math.h:2103:40: error: there are no arguments to ‘clapack_clauum’ that depend on a template parameter, so a declaration of ‘clapack_clauum’ must be available [-fpermissive]
util/math.h: In function ‘void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, nm::Complex128*, int)’:
util/math.h:2108:40: error: there are no arguments to ‘clapack_zlauum’ that depend on a template parameter, so a declaration of ‘clapack_zlauum’ must be available [-fpermissive]
util/math.h: In function ‘int nm::math::getri(CBLAS_ORDER, int, DType*, int, const int*) [with DType = float]’:
util/math.h:2220:47: error: ‘clapack_sgetri’ was not declared in this scope
util/math.h: In function ‘int nm::math::getri(CBLAS_ORDER, int, DType*, int, const int*) [with DType = double]’:
util/math.h:2225:47: error: ‘clapack_dgetri’ was not declared in this scope
util/math.h: In function ‘int nm::math::getri(CBLAS_ORDER, int, DType*, int, const int*) [with DType = nm::Complex<float>]’:
util/math.h:2230:72: error: ‘clapack_cgetri’ was not declared in this scope
util/math.h: In function ‘int nm::math::getri(CBLAS_ORDER, int, DType*, int, const int*) [with DType = nm::Complex<double>]’:
util/math.h:2235:72: error: ‘clapack_zgetri’ was not declared in this scope
util/math.h: In function ‘int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = float]’:
util/math.h:2250:47: error: ‘clapack_spotri’ was not declared in this scope
util/math.h: In function ‘int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = double]’:
util/math.h:2255:47: error: ‘clapack_dpotri’ was not declared in this scope
util/math.h: In function ‘int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = nm::Complex<float>]’:
util/math.h:2260:72: error: ‘clapack_cpotri’ was not declared in this scope
util/math.h: In function ‘int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType*, int) [with DType = nm::Complex<double>]’:
util/math.h:2265:72: error: ‘clapack_zpotri’ was not declared in this scope
nmatrix.cpp: In function ‘VALUE nm_factorize_lu(VALUE)’:
nmatrix.cpp:1555:7: error: ‘clapack_cgetrf’ was not declared in this scope
nmatrix.cpp:1555:23: error: ‘clapack_zgetrf’ was not declared in this scope
make: *** [nmatrix.o] Error 1

How do I get the gem installed?

@alexspeller
Copy link
Author

I just found these instructions on the wiki, however these do not work either. Following those instructions gives this result:

"gcc -o conftest -I/Users/alex/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/x86_64-darwin12.2.0 -I/Users/alex/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1/ruby/backward -I/Users/alex/.rbenv/versions/1.9.3-p392/include/ruby-1.9.1 -I../../../../ext/nmatrix -I'/Users/alex/.rbenv/versions/1.9.3-p392/include'  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE  -I'/Users/alex/.rbenv/versions/1.9.3-p392/include'  -Wall   -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -pipe conftest.c  -L. -L/Users/alex/.rbenv/versions/1.9.3-p392/lib -L. -L'/Users/alex/.rbenv/versions/1.9.3-p392/lib'  -L/usr/local/lib     -lruby-static  -lpthread -ldl -lobjc "
gcc: error: unrecognized command line option ‘-Wshorten-64-to-32’
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */

@alexspeller
Copy link
Author

Success! It took many hours and several reinstalls of my entire toolchain but I got there in the end. I updated the wiki with the resolution of the issues I faced.

@agarie
Copy link
Member

agarie commented Mar 20, 2013

Hey @alexspeller, sorry but I only saw the email about this issue now. Anyway, thanks for adding it to the wiki and good luck!

You can find API documentation in this link. If you find any other problems, please open more issues. :)

@robertfeldt
Copy link

I'm still running in to this same problem as alexspeller and the Wiki is NOT helping me resolving this. I'd really appreciate concrete details on how you resolved this Alex (or others). Log of problem below.

feldt:/$ export C_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers
feldt:/$ export CPLUS_INCLUDE_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers
feldt:$ cd dev/external/nmatrix/
feldt:
/dev/external/nmatrix$ bundle exec rake compile
rake/gempackagetask is deprecated. Use rubygems/package_task instead
cd tmp/x86_64-darwin12.2.1/nmatrix/2.0.0
make
compiling ../../../../ext/nmatrix/nmatrix.cpp
In file included from ../../../../ext/nmatrix/nmatrix.cpp:50:0:
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = float]':
../../../../ext/nmatrix/util/math.h:1681:47: error: 'clapack_spotrf' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = double]':
../../../../ext/nmatrix/util/math.h:1686:47: error: 'clapack_dpotrf' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = nm::Complex]':
../../../../ext/nmatrix/util/math.h:1691:72: error: 'clapack_cpotrf' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potrf(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = nm::Complex]':
../../../../ext/nmatrix/util/math.h:1696:72: error: 'clapack_zpotrf' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, float_, int)':
../../../../ext/nmatrix/util/math.h:2206:40: error: there are no arguments to 'clapack_slauum' that depend on a template parameter, so a declaration of 'clapack_slauum' must be available [-fpermissive]
../../../../ext/nmatrix/util/math.h:2206:40: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../../../../ext/nmatrix/util/math.h: In function 'void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, double_, int)':
../../../../ext/nmatrix/util/math.h:2211:40: error: there are no arguments to 'clapack_dlauum' that depend on a template parameter, so a declaration of 'clapack_dlauum' must be available [-fpermissive]
../../../../ext/nmatrix/util/math.h: In function 'void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, nm::Complex64_, int)':
../../../../ext/nmatrix/util/math.h:2216:40: error: there are no arguments to 'clapack_clauum' that depend on a template parameter, so a declaration of 'clapack_clauum' must be available [-fpermissive]
../../../../ext/nmatrix/util/math.h: In function 'void nm::math::lauum(CBLAS_ORDER, CBLAS_UPLO, int, nm::Complex128_, int)':
../../../../ext/nmatrix/util/math.h:2221:40: error: there are no arguments to 'clapack_zlauum' that depend on a template parameter, so a declaration of 'clapack_zlauum' must be available [-fpermissive]
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::getri(CBLAS_ORDER, int, DType_, int, const int_) [with DType = float]':
../../../../ext/nmatrix/util/math.h:2333:47: error: 'clapack_sgetri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::getri(CBLAS_ORDER, int, DType_, int, const int_) [with DType = double]':
../../../../ext/nmatrix/util/math.h:2338:47: error: 'clapack_dgetri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::getri(CBLAS_ORDER, int, DType_, int, const int_) [with DType = nm::Complex]':
../../../../ext/nmatrix/util/math.h:2343:72: error: 'clapack_cgetri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::getri(CBLAS_ORDER, int, DType_, int, const int_) [with DType = nm::Complex]':
../../../../ext/nmatrix/util/math.h:2348:72: error: 'clapack_zgetri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = float]':
../../../../ext/nmatrix/util/math.h:2363:47: error: 'clapack_spotri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = double]':
../../../../ext/nmatrix/util/math.h:2368:47: error: 'clapack_dpotri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = nm::Complex]':
../../../../ext/nmatrix/util/math.h:2373:72: error: 'clapack_cpotri' was not declared in this scope
../../../../ext/nmatrix/util/math.h: In function 'int nm::math::potri(CBLAS_ORDER, CBLAS_UPLO, int, DType_, int) [with DType = nm::Complex]':
../../../../ext/nmatrix/util/math.h:2378:72: error: 'clapack_zpotri' was not declared in this scope
../../../../ext/nmatrix/nmatrix.cpp: In function 'VALUE nm_factorize_lu(VALUE)':
../../../../ext/nmatrix/nmatrix.cpp:1570:7: error: 'clapack_cgetrf' was not declared in this scope
../../../../ext/nmatrix/nmatrix.cpp:1570:23: error: 'clapack_zgetrf' was not declared in this scope
../../../../ext/nmatrix/nmatrix.cpp: In function 'VALUE nm_xslice(int, VALUE_, void_ ()(STORAGE, SLICE_), void ()(NMATRIX), VALUE)':
../../../../ext/nmatrix/nmatrix.cpp:1672:31: warning: unused variable 'orient' [-Wunused-variable]
make: *_* [nmatrix.o] Error 1
rake aborted!
Command failed with status (2): [make...]
/Users/feldt/.rvm/gems/ruby-2.0.0-p0/gems/rake-compiler-0.8.3/lib/rake/extensiontask.rb:112:in block (2 levels) in define_compile_tasks' /Users/feldt/.rvm/gems/ruby-2.0.0-p0/gems/rake-compiler-0.8.3/lib/rake/extensiontask.rb:111:inblock in define_compile_tasks'
Tasks: TOP => compile => compile:x86_64-darwin12.2.1 => compile:nmatrix:x86_64-darwin12.2.1 => copy:nmatrix:x86_64-darwin12.2.1:2.0.0 => tmp/x86_64-darwin12.2.1/nmatrix/2.0.0/nmatrix.bundle
(See full trace by running task with --trace)
feldt:/dev/external/nmatrix$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.1]
feldt:
/dev/external/nmatrix$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc47/4.7.3/gcc/libexec/gcc/x86_64-apple-darwin12.4.0/4.7.3/lto-wrapper
Target: x86_64-apple-darwin12.4.0
Configured with: ../configure --build=x86_64-apple-darwin12.4.0 --prefix=/usr/local/Cellar/gcc47/4.7.3/gcc --datarootdir=/usr/local/Cellar/gcc47/4.7.3/share --bindir=/usr/local/Cellar/gcc47/4.7.3/bin --enable-languages=c --program-suffix=-4.7 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-ppl=/usr/local/opt/ppl011 --with-cloog=/usr/local/opt/cloog-ppl015 --with-system-zlib --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-plugin --enable-lto --disable-werror --disable-nls --disable-multilib
Thread model: posix
gcc version 4.7.3 (GCC)

@alexspeller
Copy link
Author

@robertfeldt I put the exact steps I followed on the wiki. If those aren't working for you then I can't help.

@robertfeldt
Copy link

Sorry, I must have missed that page then. Can you please link to it here? Thanks. 

Sent from Mailbox for iPhone

On Wed, Jun 26, 2013 at 4:19 PM, Alex Speller [email protected]
wrote:

@robertfeldt I put the exact steps I followed on the wiki. If those aren't working for you then I can't help.

Reply to this email directly or view it on GitHub:
#64 (comment)

@agarie
Copy link
Member

agarie commented Jun 26, 2013

Hey @robertfeldt, you can find installation procedures for Linux and OSX in Installation page of the wiki. If it still doesn't work, please post about the problem here.

@robertfeldt
Copy link

Thanks, I got much farther now and could build and install the gem. But when I require it from Ruby there seems to be a conflict with NArray:

Successfully installed nmatrix-0.0.5
Parsing documentation for nmatrix-0.0.5
Done installing documentation for nmatrix after 0 seconds
Done installing documentation for nmatrix (0 sec).
1 gem installed
feldt:~/dev/external/nmatrix$ irb
2.0.0-p0 :001 > require 'nmatrix'
NameError: uninitialized constant NArray
from /Users/feldt/.rvm/gems/ruby-2.0.0-p0/gems/narray-0.6.0.8/nmatrix.rb:8:in <top (required)>' from /Users/feldt/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:inrequire'
from /Users/feldt/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:110:in rescue in require' from /Users/feldt/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:35:inrequire'
from (irb):1
from /Users/feldt/.rvm/rubies/ruby-2.0.0-p0/bin/irb:16:in `

'
2.0.0-p0 :002 >

Any advice? This was with the latest git version i.e. including commits up to:

commit 12f7ca1
Merge: 27e1594 22c4ff8
Author: John Woods [email protected]
Date: Tue Jun 25 10:58:48 2013 -0700

Merge pull request #102 from cjfuller/lapack-spec-precision-fix

lapack getrf precision fix

@robertfeldt
Copy link

Ok, forget my previous comment. I just had to uninstall narray and problem solved. Thanks for all help.

@lazywei
Copy link

lazywei commented Mar 15, 2014

I ran into this problem. I followed the wiki page for installation instruction.
My gcc version is 4.9

I got this when compile

mkdir -p tmp/x86_64-darwin13.0/nmatrix/2.1.0
cd tmp/x86_64-darwin13.0/nmatrix/2.1.0
/Users/lazywei/.rbenv/versions/2.1.0/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb
using C++ standard... c++11
g++ reports version... 4.9.0
checking for main() in -lclapack... yes
checking for main() in -llapack... yes
checking for main() in -lcblas... yes
checking for main() in -latlas... no
checking for atlas/cblas.h... no
checking for cblas.h... yes
checking for clapack.h... yes
checking for clapack_dgetrf() in cblas.h,clapack.h... no
checking for clapack_dgetri() in cblas.h,clapack.h... no
checking for dgesvd_() in clapack.h... yes
checking for cblas_dgemm() in cblas.h... yes

I check my clapack.h, its version is 4.2.1 (the latest is 4.5.0). Is the problem because my clapack too old?

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

No branches or pull requests

4 participants