edit:[FIXED]
The problem was that I had it installed already, but didn't know, and tried to install from source. This created two versions and the gem didn't know which to use. I fixed it by going to the downloaded source and running
sudo make uninstall
Then I ran gem install rmagick again and it worked!
[ORIGINAL PROBLEM]
I'm trying to install the rmagick gem like in this railscast. Here's a snippet of what I put in my gemfile:
gem 'rmagick'
gem 'carrierwave'
And when I run bundle install I get the following output:
Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/home/techusb/.rbenv/versions/1.9.3-p125/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for cc... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/usr/local/bin/Magick-config reports version 6.8.0 Q16 is installed in /usr/local
/usr/bin/Magick-config reports version 1.3.12 is installed in /usr
Using 6.8.0 Q16 from /usr/local.
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/techusb/.rbenv/versions/1.9.3-p125/bin/ruby
/home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1 for inspection.
Results logged to /home/techusb/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
Regarding this line:
The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
I think I've exhausted all the information on how to fix this error via google/stackoverflow. I already tried installing the development packages and such. Not sure where to go from here. Any help greatly appreciated.
=> https://stackoverflow.com/a/10647962/1420038;
"The new correct way is to install libmagickwand-dev:
sudo apt-get install libmagickwand-dev
Then you should be able to install rmagick no problem."
works on debian 6.0.6
Related
I have installed Ruby and in my project file i have rmagick gem.
gem "rmagick", "2.13.2", require: "RMagick"
Ruby Version
gem "rmagick", "2.13.2", require: "RMagick"
I am getting an error while installing rmagick.
g native extensions. This could take a while...
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/home/suganya/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160916-13775-z6z2nl.rb extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/suganya/.rvm/rubies/ruby-2.2.5/bin/$(RUBY_BASE_NAME)
/home/suganya/.rvm/rubies/ruby-2.2.5/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 /home/suganya/.rvm/rubies/ruby- 2.2.5/lib/ruby/2.2.0/mkmf.rb:587:in `try_cpp'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:1060:in `block in have_header'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /home/suganya/.rvm/rubies/ruby-2.2.5/lib/ruby/2.2.0/mkmf.rb:1059:in `have_header'
from extconf.rb:194:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /home/suganya/.rvm/gems/ruby-2.2.5/gems/rmagick-2.13.2 for inspection.
Results logged to /home/suganya/.rvm/gems/ruby-2.2.5/extensions/x86_64-linux/2.2.0/rmagick-2.13.2/gem_make.out.
i have been working on this for past two days and I tried a lot of work arounds.
sudo apt-get install libmagickwand-dev imagemagick
But if I run just
gem install rmagick
It runs perfect installs rmagick-2.16.0
You need to run the following commands for ubuntu
sudo apt-get install libmagick++-dev
sudo apt-get install imagemagick
Then try to install
gem install rmagick
I'd like to install RMagic gem, I got “Can't find Magick-config” so I installed
$ sudo apt-get install libmagickwand-dev
but now I get following output:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.5/bin/ruby -r
./siteconf20150526-12203-xr9xf7.rb extconf.rb checking for Ruby
version >= 1.8.5... yes checking for gcc... yes checking for
Magick-config... yes checking for ImageMagick version >= 6.4.9... *
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=/usr/local/rvm/rubies/ruby-2.1.5/bin/ruby extconf.rb:154:in ``': No such file or directory - convert
(Errno::ENOENT)
from extconf.rb:154:in block in <main>'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:918:inblock
in checking_for'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:351:in block
(2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:321:inopen'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:351:in block
in postpone'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:321:inopen'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:347:in
postpone'
from /usr/local/rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/mkmf.rb:917:in
checking_for'
from extconf.rb:151:in `'
extconf failed, exit code 1
Gem files will remain installed in
/usr/local/rvm/gems/ruby-2.1.5#rails4/gems/rmagick-2.13.4 for
inspection. Results logged to
/usr/local/rvm/gems/ruby-2.1.5#rails4/extensions/x86_64-linux/2.1.0/rmagick-2.13.4/gem_make.out
Could someone help me solve it?
Look at where it fails (which was hard to work out because your newlines got swallowed somewhere):
checking for ImageMagick version >= 6.4.9... * extconf.rb failed *
This check didn't get a "yes", which suggests that the libmagickwand-dev package you installed did not provide a version of ImageMagic >= 6.4.9 which is apparently the version that the rmagick gem version 2.13.4 requires.
Either get a newer ImageMagick or an older rmagick gem.
Make sure you install ImageMagick. Usually, not having the right dependencies is the culprit.
http://www.imagemagick.org/script/install-source.php
After trying the above solutions and still not working .. i tried this one
sudo apt-get install graphicsmagick-libmagick-dev-compat
did the trick for me
The last two days I am fighting with configuration of ImageMagick and rmagick gem. I found several topics on SO, but none of them helped me out with this issue.
Recently, I've tried update also rvm, but it didn't help me neither. When I run now bundle update, the output is:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/adam/.rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/clang... yes
checking for Magick-config... yes
Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
/usr/local/bin/Magick-config reports version 6.8.6 Q8 is installed in /usr/local
/opt/ImageMagick/bin/Magick-config reports version 6.8.8 Q16 is installed in /opt/ImageMagick
Using 6.8.6 Q8 from /usr/local.
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/adam/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
/Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /Users/adam/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:194:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/adam/.rvm/gems/ruby-2.0.0-p353/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/adam/.rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-13/2.0.0/rmagick-2.13.2/gem_make.out
An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
How to proceed now - which ImageMagick to remove? Or, is there something else what am I overlooking?
The error hints at the problem:
Warning: Found more than one ImageMagick installation. This could
cause problems at runtime.
/usr/local/bin/Magick-config reports version 6.8.6 Q8 is installed in /usr/local
/opt/ImageMagick/bin/Magick-config reports version 6.8.8 Q16 is installed in /opt/ImageMagick Using 6.8.6 Q8 from /usr/local.
And also:
You have to install development tools first.
You can do this by entering the command xcode-select --install and clicking Install
This installs gcc among other things you need to compile ImageMagick and other sources.
Now remove one of your current installations of ImageMagick. Or remove both and install ImageMagick with homebrew:
brew update
brew install imagemagick
If that doesn't work here's some links I found that might help:
ImageMagick Installer: http://cactuslab.com/imagemagick/
Link
I'm on windows and I downloaded and installed rmagick-win32 RMagick-2.12.0-ImageMagick-6.5.6-8-Q8 from here (http://rubyforge.org/frs/?group_id=12&release_id=42049) which I unzipped and installed using 'gem install rmagick'
When I try to run rails s, I get this error message
C:\Users\Me\Desktop\sample_app>rails s
←[31mCould not find gem 'rmagick (>= 0) x86-mingw32' in any of the gem sources l
isted in your Gemfile.←[0m
←[33mRun `bundle install` to install missing gems.←[0m
So I try to bundle install or bundle update then I get this (I took out the full list of gems to save space):
C:\Users\Me\Desktop\sample_app>bundle update
Fetching source index for https://rubygems.org/
Installing rmagick (2.13.2) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension
.
C:/RailsInstaller/Ruby1.9.3/bin/ruby.exe extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... *** 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/Ruby1.9.3/bin/ruby
C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler
failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:931:in `block in
have_header'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:790:in `block in
checking_for'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block (2
levels) in postpone'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:284:in `block in
postpone'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:280:in `postpone
'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:789:in `checking
_for'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/mkmf.rb:930:in `have_hea
der'
from extconf.rb:194:in `<main>'
Gem files will remain installed in C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9
.1/gems/rmagick-2.13.2 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rmagick-2
.13.2/ext/RMagick/gem_make.out
An error occured while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling.
Then I downloaded rmagick 2.13.2 and put it into the same folder and ran "gem install rmagick -v '2.13.2' but I'm getting a failed ERROR: Failed to build gem native extension again
I am trying to get 2.13.2 installed but I can't find any information on this. Anyone know if that's the issue and how this can be fixed?
On Windows, you need the DevKit for Ruby to compile native C extensions (which some gems have included).
I am trying to install an RoR app from Github and while running bundle install, I get this error:
Installing rmagick (2.13.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/adam/.rvm/rubies/ruby-1.9.3-p327/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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/adam/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
/Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/adam/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
from extconf.rb:193:in `<main>'
Gem files will remain installed in /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1 for inspection.
Results logged to /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/ext/RMagick/gem_make.out
An error occurred while installing rmagick (2.13.1), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.1'` succeeds before bundling.
I've tried to run gem install rmagick -v '2.13.1', but I got the same error.
I am running on Mac OS X Lion. What am I missing?
Thank you in advance.
Try to run:
brew link imagemagick
Make sure you have a compiler. XCODE command line tools, or just install gcc.
I could not install the rmagick gem either...
To get Imagemagick installed correctly I first
brew remove libtool
brew install libtool --universal
Then I was able to install Imagemagick using this command:
brew install imagemagick --build-from-source
Then the rmagick gem installed correctly
The error message I was getting when rmagick would not install looked like:
linking shared-object RMagick2.bundle
ld: file not found: /usr/local/lib/libltdl.7.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [RMagick2.bundle] Error 1
make failed, exit code 2
This was for Imagemagick 6.8.9-8 and rmagick 2.13.2