Installing opencv GEM - extconf.rb error - ruby

I have been stuck on this for a couple of days now, so PLEASE help!
I run MAC OS X(10.7.5), with Xcode(4.5.2) and Command Line Tools installed. Ruby 1.9.3-p362, RVM 1.17.8. apple-gcc42 has also been installed. I use Homebrew for installations.
When I try to install the Opencv gem, I get the following error:
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/samanthacabral/.rvm/rubies/ruby-1.9.3-p362/bin/ruby
--with-opencv-dir
--without-opencv-dir
--with-opencv-include
--without-opencv-include=${opencv-dir}/include
--with-opencv-lib
--without-opencv-lib=${opencv-dir}/lib
--with-ffcall-dir
--without-ffcall-dir
--with-ffcall-include
--without-ffcall-include=${ffcall-dir}/include
--with-ffcall-lib
--without-ffcall-lib=${ffcall-dir}/lib
--with-cxcorelib
--without-cxcorelib
extconf.rb:32:in `block in <main>': libcxcore not found. (RuntimeError)
from extconf.rb:31:in `each'
from extconf.rb:31:in `<main>'
I have tried reinstalling RVM a couple of times and making some of the other changes recommended in similar questions.
My gem file compiles just fine without the opencv gem, but I am having similar issues with RMagick (showing an extconf.rb error).
What should I do?
Thanks!!!

In case anyone else experiences this, I had better similar problems on OS X and had better luck with the ruby-opencv gem.

Related

rbczmq error when installing iruby

Am trying to install iruby on a windows machine and this error keeps appearing. Am currently doing some deep learning and I need to use sciruby and iruby to perform the actions required
PS C:\> gem install iruby
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing iruby:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby2.1.0/bin/ruby.exe -r ./siteconf20150710-76680-1u0zekx.rb extconf.rb
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/RailsInstaller/Ruby2.1.0/bin/ruby
--with-kernel32lib
--without-kernel32lib
--with-rpcrt4lib
--without-rpcrt4lib
--with-gdi32lib
--without-gdi32lib
extconf.rb:49:in `<main>': uninitialized constant GNU_CHAIN (NameError)
extconf failed, exit code 1
Gem files will remain installed in C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rbczmq-1.7.9 for inspection.
Results logged to C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/rbczmq-1.7.9/gem_make.out
Please assist solving this problem
I am new to python and know nothing about ruby, but I find ipython notebook so amazing that I want give it a try for another kernel,
so I just installed ruby and end up with the same problem, and google failed to help me,,,
but I am really good at patching things, after one hour of ##$#%&%#%!(#!, I found a way:
edit C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\rbczmq-1.7.9\ext\rbczmq\extconf.rb
add statement GNU_CHAIN = 1 on the top
cd C:\Ruby22-x64\lib\ruby\gems\2.2.0\gems\rbczmq-1.7.9
gem spec ....\cache\rbczmq-1.7.9.gem --ruby > ....\specifications\rbczmq-1.7.9.gem.gemspec
gem build ....\specifications\rbczmq-1.7.9.gem.gemspec
now, gem list shows "rbczmq (1.7.9)"
I knew nothing about ruby, so I dont know whether rbczmq really works or not
"iruby notebook" starts succ and new kernel "ruby 2.2.2" added, but it also says "kernel error" when I choose it
the Track back says: "OSError: [WinError 193]"
That's all I can help for now, so maybe you can figure it out now and tell me how to make the new kernel do its trick

Unable to install cucumber gem

I'm trying to setup ruby/cucumber tool on my windows 7 PC, I've installed Ruby 2.1.5 and devkit and got installed all the gems except Cucumber.
I'm getting the following error while install cucumber gem.Please help me on this.
ERROR:
Following gems were not installed:
cucumber (2.0.0.rc.4): Error installing cucumber:
ERROR: Failed to build gem native extension. C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150308-6692-1kwvlbm.rb extconf.rb checking for main() in -lc... * extconf.rb failed * Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Temporarily enhancing PATH to include DevKit... Provided configuration options: Building native extensions. This could take a while... --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME) --with-gherkin_lexer_ar-dir --without-gherkin_lexer_ar-dir --with-gherkin_lexer_ar-include --without-gherkin_lexer_ar-include=${gherkin_lexer_ar-dir}/include --with-gherkin_lexer_ar-lib --without-gherkin_lexer_ar-lib=${gherkin_lexer_ar-dir}/lib --with-clib --without-clib C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:456:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:541:intry_link0' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:556:in try_link' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:735:intry_func' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:966:in block in have_library' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:911:inblock in checking_for' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:351:in block (2 levels) in postpone' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:321:inopen' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:351:in block in postpone' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:321:inopen' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:347:in postpone' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:910:inchecking_for' from C:/Ruby22-x64/lib/ruby/2.2.0/mkmf.rb:961:in have_library' from extconf.rb:5:in' extconf failed, exit code 1 Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/gherkin-2.12.2 for inspection. Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/gherkin-2.12.2/gem_make.out
Are you able to try using the current HEAD?
You can specify gem 'cucumber', github: 'cucumber/cucumber' in a Gemfile and try bundle installl

Debugger cannot compile on Ruby 2.0

Originally posted here: "How to use the debugger with Ruby 2.0?"
I keep ending up back here, but I have a different problem. I don't have the option to change to Byebug right now. We are currently stuck on "debugger" for now, and I cannot install it.
Building native extensions. This could take a while...
ERROR: Error installing debugger:
ERROR: Failed to build gem native extension.
/Users/mbridges/.rbenv/versions/2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/mbridges/.rbenv/versions/2.0.0-p247/bin/ruby
/Users/mbridges/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require': cannot load such file -- debugger/ruby_core_source (LoadError)
from /Users/mbridges/.rbenv/versions/2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:51:in `require'
from extconf.rb:16:in `<main>'
Anyone have any ideas?
Update: Now Ruby 2.1+ should using byebug instead of debugger.
clone the debugger-ruby_core_source to local folder, e.g. C:\git\debugger-ruby_core_source
copy C:\git\debugger-ruby_core_source\lib to C:\Ruby200\lib\ruby\gems\2.0.0\gems\debugger-ruby_core_source-1.3.2
run the gem install debugger again.
I'm now sure why the gems debugger-ruby_core_source didn't copy the lib to that folder, but certainly the debugger need it.

Not Able To Install Stanford-Core-NLP Gem

I am trying to install the Stanford-Core-NLP gem, which is one of the major projects on github for natural language processing using Ruby. It provides Ruby bindings for the Stanford-Core-NLP pakage, which where written in Java. When I try following the first step of the the installation instructions, which is:
gem install stanford-core-nlp
I get the following error:
ERROR: Error installing stanford-core-nlp:
ERROR: Failed to build gem native extension.
/home/user/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/user/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
extconf.rb:53:in `<main>': JAVA_HOME is not set. (RuntimeError)
I am running Ruby 1.9.2, which according to the repo, is the latest version the gem has been tested on and Java 1.7.0_40. I also tried looking for the mkmf.log file, but was unable to locate it.
This is because JAVA_HOME is getting reset in the sudo mode. To fix it, open your /etc/sudoers file add the following line and save it.
Defaults env_keep += "JAVA_HOME"
now reopen the terminal and install the gem.
I've been wrestling with this on Ubuntu. The thing that works reliably (though it is a sledgehammer) is:
JAVA_HOME=/usr/lib/whatever gem install stanford-core-nlp
The installation script is sensitive to the format of JAVA_HOME - it shouldn't end in a slash character.

Error installing rmagick: ERROR: Failed to build gem native extension

I am trying to install RmMagic using the below command:
gem install rmagick -v=2.12.2
After running this command i get some error :
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
D:/ruby/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
Invalid drive specification.
Unable to get ImageMagick version
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=D:/ruby/bin/ruby
Gem files will remain installed in D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2
.12.2 for inspection.
Results logged to D:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.12.2/ext/RMagick
/gem_make.out
Please help me in this regard. Thanks in advance.
I had same problem with rmagick to solve this add System Environment Variable
CLASSPATH .;C:\ImageMagick-6.5.6-Q8\include
lib C:\ImageMagick-6.5.6-Q8\lib
Then do
gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.5.6-Q8\lib --with-opt-include=C:\ImageMagick-6.5.6-Q8\include
What a pain this was... I definitely needed to do both the System Environment Variables AND the specific syntax of the command as suggested by Mukesh
To clarify the two steps:(for other novices like me)
Click properties from context menu of "Computer, click "Advanced System Settings",
click "Environment Variables", click "New" under System Variables,
use CLASSPATH for the variable name and for the value use:
.;C:\ImageMagick-6.9.0-Q16\include;lib C:\ImageMagick-6.9.0-Q16\lib
Then Run As Administrator the Command Prompt with Ruby terminal and execute:
gem install rmagick -v '2.13.4' -- --with-opt-lib=C:\ImageMagick-6.9.0-Q16\lib --with-opt-include=C:\ImageMagick-6.9.0-Q16\include
(***Make sure to update the versions number in both the Variable and gem command if necessary)

Resources