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

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)

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

Error in uuid4r gem installation in linux

I am getting this error
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-opt-include=/usr/local/opt/ossp-uuid/include --with-opt-lib=/home/kiwitech/Documents/ossp-uuid
checking for uuid_export() in -luuid... no
*** 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=${opt-dir}/include
--with-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/kiwitech/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
--with-uuidlib
--without-uuidlib
OSSP uuid library 'uuid' required -- not found.
extconf failed, exit code 1
Gem files will remain installed in /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/gems/uuid4r-0.2.0 for inspection.
Results logged to /home/kiwitech/.rvm/gems/ruby-1.9.3-p547/extensions/x86-linux/1.9.1/uuid4r-0.2.0/gem_make.out
Please someone help me
You need to install libossp-uuid and it's dev headers.
Probably something like:
sudo apt-get install libossp-uuid-dev
And then the gem installs.
Are you sure you need to use that gem anyway? In ruby 1.9+ there's already the module SecureRandom in standard library which provides UUID and also lots of pure ruby gems like uuidtools and uuid. If you need to parse the UUID's, there's ruby-uuid.
If you're running OS X Yosemite do the following:
gem install uuid
brew install ossp-uuid
(You need to have brew already installed. If you don't you can get it from here: http://brew.sh)
If you're using rvm, check that your session state is correct. If you cd around a lot, reset your terminal, or your environment variables get corrupted, you can end up with your commands trying to work with the system Ruby. A quick way to reset rvm-related stuff is just doing cd . in a project directory.
$ cd .
$ gem install uuid

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.

Installing opencv GEM - extconf.rb error

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.

Resources