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

后端 未结 19 2893
眼角桃花
眼角桃花 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: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.

提交回复
热议问题