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

后端 未结 19 2713
眼角桃花
眼角桃花 2020-12-04 15:09

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 properl

相关标签:
19条回答
  • 2020-12-04 15:42

    I have solved this problem by installing imagemagic:

    sudo apt-get install imagemagick
    

    and then install libmagick package:

    sudo apt-get install libmagick++-dev
    
    0 讨论(0)
  • 2020-12-04 15:42

    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
      ........
    
    0 讨论(0)
  • 2020-12-04 15:43

    first run this: sudo apt-get install imagemagick

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

    now install rmagick: gem install rmagick

    0 讨论(0)
  • 2020-12-04 15:46

    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.4.9)... no
    checking for presence of MagickWand API (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.

    0 讨论(0)
  • 2020-12-04 15:47

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

    $ sudo apt-get install libmagick++-dev
    
    0 讨论(0)
  • 2020-12-04 15:47

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

    brew install imagemagick
    gem install rmagick
    
    0 讨论(0)
提交回复
热议问题