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

Install fails with ruby 2.3.0 on OSX 10.11.2 #426

Closed
holidayworking opened this issue Dec 29, 2015 · 30 comments
Closed

Install fails with ruby 2.3.0 on OSX 10.11.2 #426

holidayworking opened this issue Dec 29, 2015 · 30 comments
Labels
Milestone

Comments

@holidayworking
Copy link

NMatrix fails to install with ruby 2.3.0 on OSX 10.11.2

$ gem install nmatrix
Fetching: backports-3.6.7.gem (100%)
Successfully installed backports-3.6.7
Fetching: packable-1.3.6.gem (100%)
Successfully installed packable-1.3.6
Fetching: nmatrix-0.2.0.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing nmatrix:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/Cellar/rbenv/1.0.0/versions/2.3.0/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.0/ext/nmatrix
/usr/local/opt/rbenv/versions/2.3.0/bin/ruby -r ./siteconf20151229-45255-7ajcsu.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... 4.8
using C++ standard... c++11
g++ reports version... gcc48
creating nmatrix_config.h
creating Makefile

current directory: /usr/local/Cellar/rbenv/1.0.0/versions/2.3.0/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.0/ext/nmatrix
make "DESTDIR=" clean

current directory: /usr/local/Cellar/rbenv/1.0.0/versions/2.3.0/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.0/ext/nmatrix
make "DESTDIR="
compiling nmatrix.cpp
g++-4.8: error: unrecognized command line option '-Wdivision-by-zero'
g++-4.8: error: unrecognized command line option '-Wextra-tokens'
make: *** [nmatrix.o] Error 1

make failed, exit code 2

Gem files will remain installed in /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/nmatrix-0.2.0 for inspection.
Results logged to /usr/local/opt/rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-darwin-15/2.3.0-static/nmatrix-0.2.0/gem_make.out
@mrkn
Copy link

mrkn commented Jan 6, 2016

I think your ruby was built by clang.
Check it:

ruby -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CC"]'

And if your ruby was built by clang, you should use clang++ for nmatrix.
Please try github version.

@v0dro
Copy link
Member

v0dro commented Jan 14, 2016

@holidayworking could you verify if your build is passing?

@translunar
Copy link
Member

I assume this is no longer a problem and will close it. Please re-open if it arises again.

@translunar translunar added the bug label Jan 26, 2016
@translunar translunar added this to the v0.1.2 milestone Jan 26, 2016
@georgeu2000
Copy link

georgeu2000 commented Apr 20, 2016

I am having this issue on Ruby 2.3.0 as well. OSX 10.11.4.

ruby -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CC"]'
clang

And if your ruby was built by clang, you should use clang++ for nmatrix.
Please try github version.

What do you mean "try github version"? The github version of nmatrix? How?

FWIW, no issues with Ruby 2.2.4.

@translunar
Copy link
Member

You can use the current development version as described in the README:

git clone https://github.com/SciRuby/nmatrix.git
cd nmatrix/
gem install bundler
bundle install
bundle exec rake compile
bundle exec rake spec

@translunar translunar reopened this Apr 20, 2016
@georgeu2000
Copy link

Got it. Thanks.

@reisner
Copy link

reisner commented Apr 21, 2016

I'm getting this error with nmatrix in my gemfile:

make "DESTDIR="
compiling nmatrix.cpp
g++-4.8: error: unrecognized command line option '-Wdivision-by-zero'
g++-4.8: error: unrecognized command line option '-Wextra-tokens'
make: *** [nmatrix.o] Error 1

I also checked this:

$ ruby -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CC"]'
gcc

I'm not using clang...so now what? I also tried this:

gem 'nmatrix', :github => 'SciRuby/nmatrix'

Which didnt help.

@mrkn
Copy link

mrkn commented Apr 22, 2016

@georgeu2000 how do you install ruby 2.3.0?

Also, please check the following output:

$ ruby -v -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CXX"]'
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
clang++

@mrkn
Copy link

mrkn commented Apr 22, 2016

@reisner tell me ruby -v

@reisner
Copy link

reisner commented Apr 22, 2016

$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]

@georgeu2000
Copy link

georgeu2000 commented Apr 27, 2016

@georgeu2000 how do you install ruby 2.3.0?

You can download it and install it from https://www.ruby-lang.org/en/.

I prefer to use rbenv. See https://github.com/rbenv/rbenv#installing-ruby-versions

@translunar
Copy link
Member

@reisner Are you still having problems or can this ticket be closed?

@gillien
Copy link

gillien commented May 10, 2016

I had the exact same problem than @reisner. but with the configuration below :

$ ruby -v -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CXX"]'
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
g++

I was previously using Nmatrix with ruby 2.2.4 and I did not have any problems.

I try to use the development version, as @MohawkJohn described, and it was also working.

So to get it working on my project with the version 0.2.1, I edited the file /Users/../.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/x86_64-darwin15/rbconfig.rb and replace manually the CXX from g++ to clang++ and it works now...

I am not sure if it was a good idea to follow those steps. Would be happy to have your feedbacks.

@mrkn
Copy link

mrkn commented May 10, 2016

@gillien How do you install your ruby?
Please check the value of CC, too.
If CC is clang, it's a wrong combination of clang and g++.

@gillien
Copy link

gillien commented May 10, 2016

@mrkn ruby is installed with rvm and CC is gcc

@yegor256
Copy link

yegor256 commented Jan 10, 2017

@MohawkJohn the problem is still there. Tried with Ruby 2.2.2 and 2.3.3, the same result. What is the solution? My OSX version is 10.12.2.

$ ruby -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CC"]'
gcc
$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin16]

Installation log:

$ gem install nmatrix
Building native extensions.  This could take a while...
ERROR:  Error installing nmatrix:
	ERROR: Failed to build gem native extension.

    current directory: /Users/yegor/.rvm/gems/ruby-2.3.3/gems/nmatrix-0.2.3/ext/nmatrix
/Users/yegor/.rvm/rubies/ruby-2.3.3/bin/ruby -r ./siteconf20170110-45337-l2psrs.rb extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... 4.8
using C++ standard... c++11
g++ reports version... gcc48
checking for rb_array_const_ptr() in ruby.h... yes
checking for FIX_CONST_VALUE_PTR in ruby.h... yes
checking for RARRAY_CONST_PTR in ruby.h... yes
checking for RARRAY_AREF in ruby.h... yes
creating nmatrix_config.h
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Users/yegor/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/nmatrix-0.2.3/mkmf.log

current directory: /Users/yegor/.rvm/gems/ruby-2.3.3/gems/nmatrix-0.2.3/ext/nmatrix
make "DESTDIR=" clean

current directory: /Users/yegor/.rvm/gems/ruby-2.3.3/gems/nmatrix-0.2.3/ext/nmatrix
make "DESTDIR="
compiling nmatrix.cpp
g++-4.8: error: unrecognized command line option '-Wdivision-by-zero'
g++-4.8: error: unrecognized command line option '-Wextra-tokens'
make: *** [nmatrix.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/yegor/.rvm/gems/ruby-2.3.3/gems/nmatrix-0.2.3 for inspection.
Results logged to /Users/yegor/.rvm/gems/ruby-2.3.3/extensions/x86_64-darwin-16/2.3.0/nmatrix-0.2.3/gem_make.out

@mrkn
Copy link

mrkn commented Jan 11, 2017

I'll try to make a pull-request to treat the above case.

@yegor256
Copy link

@mrkn thanks, it's really a blocker!

@Shekharrajak
Copy link
Member

Shekharrajak commented Jan 28, 2017

I am getting same problem during installation. Any one found solution for this :

compiling nmatrix.cpp
g++-4.8: error: unrecognized command line option '-Wdivision-by-zero'
g++-4.8: error: unrecognized command line option '-Wextra-tokens'
make: *** [nmatrix.o] Error 1

In my system :

$ ruby -v -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CXX"]'
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
g++

$ ruby -v -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CC"]'
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
gcc

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

@translunar
Copy link
Member

@mrkn You seem to have an idea as to the cause of this — care to enlighten us? :P

@astudnev
Copy link

Have the same issue:

bundle exec rake compile
mkdir -p tmp/x86_64-darwin16/nmatrix/2.3.3
cd tmp/x86_64-darwin16/nmatrix/2.3.3
/Users/studnev/.rvm/rubies/ruby-2.3.3/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb
checking for apparent GNU g++ binary with C++0x/C++11 support... 4.9
using C++ standard... c++11
g++ reports version... gcc49
checking for rb_array_const_ptr() in ruby.h... yes
checking for FIX_CONST_VALUE_PTR in ruby.h... yes
checking for RARRAY_CONST_PTR in ruby.h... yes
checking for RARRAY_AREF in ruby.h... yes
creating nmatrix_config.h
creating Makefile
cd -
cd tmp/x86_64-darwin16/nmatrix/2.3.3
/usr/bin/make
compiling ../../../../ext/nmatrix/nmatrix.cpp
g++-4.9: error: unrecognized command line option '-Wdivision-by-zero'
g++-4.9: error: unrecognized command line option '-Wextra-tokens'
make: *** [nmatrix.o] Error 1
rake aborted!
Command failed with status (2): [/usr/bin/make...]
/Users/studnev/.rvm/gems/ruby-2.3.3/gems/rake-compiler-0.9.9/lib/rake/extensiontask.rb:157:in block (2 levels) in define_compile_tasks' /Users/studnev/.rvm/gems/ruby-2.3.3/gems/rake-compiler-0.9.9/lib/rake/extensiontask.rb:156:in block in define_compile_tasks'
/Users/studnev/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in eval' /Users/studnev/.rvm/gems/ruby-2.3.3/bin/ruby_executable_hooks:15:in

'
Tasks: TOP => compile => compile:x86_64-darwin16 => compile:nmatrix:x86_64-darwin16 => copy:nmatrix:x86_64-darwin16:2.3.3 => tmp/x86_64-darwin16/nmatrix/2.3.3/nmatrix.bundle
(See full trace by running task with --trace)

@translunar
Copy link
Member

translunar commented Mar 13, 2017

@astudnev Try with rbenv instead of rvm. There's a post about this in the Google Group. Also, can you answer @mrkn's questions above?

@achung-miovision
Copy link

@Shekharrajak @astudnev Were you able to resolve the issue? I'm having the same installation errors as you on ruby 2.4.1.

$ ruby -v -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CXX"]'
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]
g++
$ ruby -v -rrbconfig -e 'puts RbConfig::MAKEFILE_CONFIG["CC"]'
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]
gcc
$  ruby -v
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin15]

@Shekharrajak
Copy link
Member

@achung-miovision , I uninstalled the rvm and now using rbenv. So I followed all the steps again and it is working fine now.

@astudnev
Copy link

@achung-miovision, i switched to python for this project :)

@mrkn
Copy link

mrkn commented Mar 31, 2017

@achung-miovision Why do you use gcc/g++ instead of clang/clang++ on OSX?

@achung-miovision
Copy link

achung-miovision commented Mar 31, 2017

@mrkn That seemed to be the default on my system when I installed ruby a while ago. I was able to get my issue resolved by updating rvm, then reinstalling ruby with rvm install 2.4.1 --with-gcc=clang --with-cxx=clang++.

Thanks for the help.

@sivagollapalli
Copy link

@achung-miovision thanks it worked.

@zixu-zhao
Copy link

@achung-miovision Thanks Adrian! You made my day! 😄

@santigolucass
Copy link

@achung-miovision Thanks man!

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