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

Installing on Mavericks #223

Closed
akchan opened this issue Mar 29, 2014 · 3 comments
Closed

Installing on Mavericks #223

akchan opened this issue Mar 29, 2014 · 3 comments
Labels

Comments

@akchan
Copy link

akchan commented Mar 29, 2014

Hi, thank you developing NMatrix :)

I have a problem with installing nmatrix on my macbook air(2012, Mavericks installed).

First, I have installed gcc4.9 with Homebrew like this:

$ brew tap homebrew/versions
$ brew install gcc49

recompiling Ruby with new gcc-4.9

$ rbenv uninstall 2.1.1
$ ln -s /usr/local/bin/gcc-4.9 /usr/bin/gcc
$ ln -s /usr/local/bin/g++-4.9 /usr/bin/g++
$ CONFIGURE_OPTS="--with-openssl-dir=`brew --prefix openssl`" rbenv install 2.1.1

then I challanged compile nmatrix. But I got an error.

$ cd ~/nmatrix
$ bundle
$ bundle exec rake clean
$ sudo ln -s /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers/cblas.h /usr/include/cblas.h
$ unset C_INCLUDE_PATH
$ unset CPLUS_INCLUDE_PATH
$ bundle exec rake compile

mkdir -p tmp/x86_64-darwin13.0/nmatrix/2.1.1
cd tmp/x86_64-darwin13.0/nmatrix/2.1.1
/Users/funayamasatoshi/.rbenv/versions/2.1.1/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
creating nmatrix_config.h
creating Makefile
cd -
cd tmp/x86_64-darwin13.0/nmatrix/2.1.1
make
compiling ../../../../ext/nmatrix/nmatrix.cpp
In file included from ../../../../ext/nmatrix/nmatrix.cpp:297:0:
../../../../ext/nmatrix/ruby_nmatrix.c: In function 'VALUE nm_reshape_bang(VALUE, VALUE)':
../../../../ext/nmatrix/ruby_nmatrix.c:1046:11: warning: unused variable 'elem' [-Wunused-variable]
     void* elem = s->elements;
           ^
../../../../ext/nmatrix/ruby_nmatrix.c: In function 'SLICE* get_slice(size_t, int, VALUE*, size_t*)':
../../../../ext/nmatrix/ruby_nmatrix.c:2648:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     VALUE v = t == argc ? Qnil : arg[t];
                 ^
../../../../ext/nmatrix/ruby_nmatrix.c: In function 'VALUE nm_init_new_version(int, VALUE*, VALUE)':
../../../../ext/nmatrix/ruby_nmatrix.c:559:9: warning: 'init' may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (curr->val == values) {
         ^
../../../../ext/nmatrix/ruby_nmatrix.c:1120:11: note: 'init' was declared here
   void*   init;
           ^
compiling ../../../../ext/nmatrix/ruby_constants.cpp
compiling ../../../../ext/nmatrix/data/data.cpp
compiling ../../../../ext/nmatrix/util/io.cpp
../../../../ext/nmatrix/util/io.cpp: In function 'VALUE nm_rbstring_merge(VALUE, VALUE, VALUE, VALUE)':
../../../../ext/nmatrix/util/io.cpp:254:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (size_t i = 0; i < RSTRING_LEN(rb_real); i += len) {
                        ^
compiling ../../../../ext/nmatrix/math.cpp
In file included from ../../../../ext/nmatrix/math.cpp:124:0:
../../../../ext/nmatrix/math/swap.h:52:3: warning: "/*" within comment [-Wcomment]
 } /* dswap */
 ^
compiling ../../../../ext/nmatrix/util/sl_list.cpp
compiling ../../../../ext/nmatrix/storage/common.cpp
compiling ../../../../ext/nmatrix/storage/storage.cpp
compiling ../../../../ext/nmatrix/storage/dense/dense.cpp
compiling ../../../../ext/nmatrix/storage/yale/yale.cpp
../../../../ext/nmatrix/storage/yale/yale.cpp:1220:15: warning: 'size_t yale_count_slice_copy_ndnz(const YALE_STORAGE*, size_t*, size_t*)' defined but not used [-Wunused-function]
 static size_t yale_count_slice_copy_ndnz(const YALE_STORAGE* s, size_t* offset, size_t* shape) {
               ^
../../../../ext/nmatrix/storage/yale/yale.cpp:733:29: warning: 'std::array<long unsigned int, 2ul> nm::yale_storage::get_offsets(YALE_STORAGE*)' defined but not used [-Wunused-function]
 static std::array<size_t,2> get_offsets(YALE_STORAGE* x) {
                             ^
../../../../ext/nmatrix/storage/yale/yale.cpp:893:14: warning: 'VALUE nm::yale_storage::nm_yale_stored_enumerator_length(VALUE)' defined but not used [-Wunused-function]
 static VALUE nm_yale_stored_enumerator_length(VALUE nmatrix) {
              ^
../../../../ext/nmatrix/storage/yale/yale.cpp:907:14: warning: 'VALUE nm::yale_storage::nm_yale_stored_nondiagonal_enumerator_length(VALUE)' defined but not used [-Wunused-function]
 static VALUE nm_yale_stored_nondiagonal_enumerator_length(VALUE nmatrix) {
              ^
../../../../ext/nmatrix/storage/yale/yale.cpp:919:14: warning: 'VALUE nm::yale_storage::nm_yale_stored_diagonal_enumerator_length(VALUE)' defined but not used [-Wunused-function]
 static VALUE nm_yale_stored_diagonal_enumerator_length(VALUE nmatrix) {
              ^
../../../../ext/nmatrix/storage/yale/yale.cpp:929:14: warning: 'VALUE nm::yale_storage::nm_yale_enumerator_length(VALUE)' defined but not used [-Wunused-function]
 static VALUE nm_yale_enumerator_length(VALUE nmatrix) {
              ^
compiling ../../../../ext/nmatrix/storage/list/list.cpp
../../../../ext/nmatrix/storage/list/list.cpp: In function 'void each_empty_with_indices_r(nm::list_storage::RecurseData&, size_t, VALUE&)':
../../../../ext/nmatrix/storage/list/list.cpp:801:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (long index = 0; index < s.ref_shape(rec); ++index) {
                                ^
../../../../ext/nmatrix/storage/list/list.cpp:809:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (long index = 0; index < s.ref_shape(rec); ++index) {
                                ^
../../../../ext/nmatrix/storage/list/list.cpp: In function 'void each_with_indices_r(nm::list_storage::RecurseData&, const LIST*, size_t, VALUE&)':
../../../../ext/nmatrix/storage/list/list.cpp:836:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (long index = 0; index < shape; ++index) { // index in reference
                                ^
../../../../ext/nmatrix/storage/list/list.cpp:838:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (!curr || index < curr->key - offset) {
                          ^
../../../../ext/nmatrix/storage/list/list.cpp:847:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (long index = 0; index < shape; ++index) {
                                ^
../../../../ext/nmatrix/storage/list/list.cpp:851:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       if (!curr || index < curr->key - offset) {
                          ^
../../../../ext/nmatrix/storage/list/list.cpp: In function 'VALUE nm_list_map_stored(VALUE, VALUE)':
../../../../ext/nmatrix/storage/list/list.cpp:954:8: warning: unused variable 'scalar' [-Wunused-variable]
   bool scalar = false;
        ^
../../../../ext/nmatrix/storage/list/list.cpp:961:9: warning: unused variable 'scalar_init' [-Wunused-variable]
   void* scalar_init = NULL;
         ^
../../../../ext/nmatrix/storage/list/list.cpp: In function 'void* nm_list_storage_get(const STORAGE*, SLICE*)':
../../../../ext/nmatrix/storage/list/list.cpp:1132:40: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return (n ? n->val : s->default_val);
                                        ^
../../../../ext/nmatrix/storage/list/list.cpp: In function 'void* nm_list_storage_ref(const STORAGE*, SLICE*)':
../../../../ext/nmatrix/storage/list/list.cpp:1168:40: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return (n ? n->val : s->default_val);
                                        ^
linking shared-object nmatrix.bundle
ld: library not found for -latlas
collect2: error: ld returned 1 exit status
make: *** [nmatrix.bundle] Error 1
rake aborted!
Command failed with status (2): [make...]

Tasks: TOP => compile => compile:x86_64-darwin13.0 => compile:nmatrix:x86_64-darwin13.0 => copy:nmatrix:x86_64-darwin13.0:2.1.1 => tmp/x86_64-darwin13.0/nmatrix/2.1.1/nmatrix.bundle
(See full trace by running task with --trace)

Though I have installed atlas using MacPorts, this error occurs.
How can I solve it?

@translunar
Copy link
Member

ATLAS should already be installed on your system; you shouldn't need MacPorts to do it. Moreover, it may be hazardous to have both port and brew installed on the same system.

It looks like it's not finding libatlas.dylib. For me, this is a static link:

ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/lib/libatlas.dylib /usr/lib/libatlas.dylib

@akchan
Copy link
Author

akchan commented Apr 2, 2014

After I made a symbolic link according to your code, the installation have been done successfully!

Now, I can use the NMatrix in my pry.

Thank you! :)

@translunar
Copy link
Member

Thank you for asking. I've updated the Mavericks install instructions to include this.

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

No branches or pull requests

2 participants