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

匿名 (未验证) 提交于 2019-12-03 01:51:02

问题:

I am trying to run one project on my local machine. I installed Ruby and Rails on my Mac OS system. It is working properly. I can create a new project and can run it properly without any error, but when I try to run the existing project it says that we have to bundle install. When I run that command I get the following error:

"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." 

When I run gem install rmagick -v '2.13.2' it gives me the following error:

ERROR:  Error installing rmagick: ERROR: Failed to build gem native extension.  /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb checking for Ruby version >= 1.8.5... yes checking for gcc-4.2... yes checking for Magick-config... no Can't install RMagick 2.13.2. Can't find Magick-config in /usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin  *** 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-1.9.3-p392/bin/ruby   Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2 for inspection. Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2/ext/RMagick/gem_make.out 

I have searched and did not find an answer anywhere.

回答1:

For Ubuntu, I used the ff. based on this link:

$ sudo apt-get install libmagick++-dev 


回答2:

On a mac (the below code works on OSX Mavericks):

brew install imagemagick gem install rmagick 


回答3:

I have solved this problem by installing imagemagic:

sudo apt-get install imagemagick 

and then install libmagick package:

sudo apt-get install libmagick++-dev 


回答4:

For linux fedora, i got same error and fixed with below two commands:

yum install ImageMagick  gem install rmagick  

For Centos install ImageMagick-devel package. using below commands:

yum install ImageMagick-devel  gem install rmagick 

Thanks.



回答5:

First, make sure you've installed Imagemagick :

$ sudo apt-get install imagemagick 

Now, it can build the gem native extension.

Then, install the Rmagick gem :

$ sudo gem install rmagick 


回答6:

On Mac you can try this:

$ brew unlink imagemagick $ brew install imagemagick@6 && brew link imagemagick@6 --force $ gem install rmagick  


回答7:

here's what i did on 16.04,

sudo apt-get install libmagickwand-dev sudo apt-get install graphicsmagick-imagemagick-compat 

and then install gem like that

PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2' 


回答8:

As per the error log it looks like "Magick-config" is missing. You need to install ImageMagik or GraphicsMagick. These are the commands you should follow which is taken from RMagik Documentation:

1) Go to http://www.imagemagick.org or http://www.graphicsmagick.org and download the latest version of the software to a temporary directory. the extract them :  - tar xvzf ImageMagick.tar.gz - cd ImageMagick-x.x.x  - ./configure --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8  - make - sudo make install  - sudo gem install rmagick 


回答9:

Just install ImageMagick-devel package and everything should be fine :)



回答10:

Solution for Ubuntu:

sudo apt-get install imagemagick

ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config



回答11:

May be you are installing ImageMagick version 7.x.x which will generate different folder names in your usr/lib/local/include/ImageMagick7.x.x folder. E.g.

In ImageMagick6.x.x version we have magick, wand named folders, where in ImageMagick7.x.x version have named this MagickCore , MagickWand . So this updation is causing the problem in some gem installation like here. Which is using magick/some_header.h or wand/some_header.h (Means they are not updated with the new 7.x.x ImageMagick version).That's why we are getting this error :

```

checking for outdated ImageMagick version (= 6.9.0)... no  ....  checking for wand/MagickWand.h... no 

```

and in log file something like this :

error: 'MagickCore/method-attribute.h' file not found #include "MagickCore/method-attribute.h"          ^ 

Solution

Install the ImageMagick6.x.x version in your system from the official site : https://www.imagemagick.org/download/ and install it using this commands(after extract zip/tar) :

./configure make  make install 

Then do

gem install rmagick

It will work.



回答12:

If you are using openSUSE, then first check if the ImageMagick installed or not. If it is installed, then do install it development header file.

[arup@sztukajedzenia]$ sudo zypper se imagemagic root\'s password:  Loading repository data... Reading installed packages...  S | Name              | Summary                                               | Type --+-------------------+-------------------------------------------------------+----------- i | ImageMagick       | Viewer and Converter for Images                       | package   | ImageMagick       | Viewer and Converter for Images                       | srcpackage   | ImageMagick-devel | Include Files and Libraries Mandatory for Development | package   | ImageMagick-doc   | Document Files for ImageMagick Library                | package   | ImageMagick-extra | Viewer and Converter for Images - extra codecs        | package [arup@sztukajedzenia]$ sudo zypper in ImageMagick-devel root\'s password: Loading repository data... Reading installed packages... Resolving package dependencies...  The following 2 NEW packages are going to be installed:   ImageMagick-devel libbz2-devel   ........ 


回答13:

You need to run both the command for ubuntu

sudo apt-get install libmagick++-dev sudo apt-get install imagemagick 

Then try to install

gem install rmagick 


回答14:

For Ubuntu Server, I installed it by doing this:

sudo apt-get install imagemagick  sudo apt-get install libmagick++-dev  sudo gem install rmagick -v '2.15.4' 


回答15:

For mac users, install imagemagick 6 since the newest version 7 isn't compatible.

brew install imagemagick@6 gem install rmagick 

The above should work after you uninstall what you already have.



回答16:

For Fedora 27 I resolved this problem:

sudo dnf install ImageMagick-devel ImageMagick gem install rmagick 


回答17:

first run this: sudo apt-get install imagemagick

then: sudo apt-get install libmagick++-dev

now install rmagick: gem install rmagick



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!