Programing

RMagick 설치 : MagickWand.h를 찾을 수 없습니다

crosscheck 2020. 6. 10. 08:24
반응형

RMagick 설치 : MagickWand.h를 찾을 수 없습니다


RMagickImagemagick 업데이트 는 고통스러운 경험입니다. Ruby 2.3에서 하나의 프로젝트에 대해 homebrew로 Mac의 Imagemagick 버전 (MacOS El Capitan 버전 10.11.5)을 업데이트했습니다.6.9.5-9

$ convert --version
Version: ImageMagick 6.9.5-9 Q16 x86_64 2016-09-09

이제 Ruby 1.8.7의 이전 프로젝트는 "이 RMagick 설치는 ImageMagick 6.8.9로 구성되었지만 ImageMagick 6.9.5-9가 사용 중입니다"라는 오류 메시지와 함께 작동하지 않습니다. 따라서 "rmagick"를 제거했지만 다시 설치할 수 없습니다

$ gem install rmagick -v 2.16.0
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
ERROR: Failed to build gem native extension.

checking for /usr/local/opt/gcc46/bin/gcc-4.6... yes
checking for Magick-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no

Can't install RMagick 2.16.0. Can't find MagickWand.h. 

그리고 설치할 수 없으면 전체 응용 프로그램을 시작할 수 없습니다. 나는 모든 대답하려고 여기를 , 그리고 그들 중 누구도 맥 OS에서 작동하지 않습니다 :-( 나는 사제와 ImageMagick이와 PKG-설정을 다시 설치하고, 성공하지 RMagick의 다양한 버전을 시도했다. 2.16.0이 최신 버전입니다 RMagick 현재.

MagicWand는 ImageMagick 버전> 6.9에서 사용되는 것으로 보이며 컴퓨터에서 찾을 수 있습니다.

find /usr/local -name MagickWand.h
=> /usr/local/Cellar/imagemagick/6.9.5-9_1/include/ImageMagick-6/wand/MagickWand.h

find /usr/local -name MagickWand.pc
=> /usr/local/Cellar/imagemagick/6.9.5-9_1/lib/pkgconfig/MagickCore.pc

gem 설치 중에 이러한 경로를 지정해도 작동하지 않습니다 (위와 동일한 오류) :-(

C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/6.9.5-9_1/include/ImageMagick-6 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig gem install rmagick

최신 정보:

Ruby 1.8.7에서만 오류가 발생하며 Ruby 2.0 및 Ruby 2.3 용 RMagick을 설치할 수 있습니다. Ruby 1.8.7 및 ImageMagick 6.9.5는 호환되지 않는 것 같습니다.

  • 루비 1.8.7 x
  • 루비 2.0.0 ✓
  • 루비 2.3.1 ✓

Mac OSX Sierra, High Sierra, El Capitan 및 Mojave 의 문제를 해결하려면 다음을 수행하십시오.

brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force

imagemagick@6입니다 keg-only. 따라서 강제로 연결해야합니다.


ImageMagick 7.0.4-4 와 동일한 문제가 있었습니다 . 올바른 수정 방법은 설치하는 것 imagemagick@6입니다. 실수로 삭제 하거나 처음 설치하지 않은 경우 https://github.com/Homebrew/homebrew-core/pull/8756이 유용하다는 것을 알았 imagemagick@6습니다.


macOs 시에라 :

brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force

우선 최신 mac high sierra에 제대로 설치되지 않은 설치된 imagemagick의 연결을 해제하십시오.

brew unlink imagemagick

그런 다음 아래 명령을 사용하여 최신 imagemagic6을 설치하십시오.

brew install imagemagick@6 && brew link imagemagick@6 --force

그런 다음 아래 명령을 사용하여 gem rmagick을 설치하십시오.

gem install rmagick 

완벽하게 작동합니다.


이 문제는 내 문제를 해결합니다.

맥 OS X 시에라 :

brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force

많은 것들이이 경로 같은 ImageMagick를 7 변경되었습니다 include/.../wand, 그리고 wand/MagickWand.h순간에 rmagic 보석에 내장 돼있다. 제 경우에는 프로젝트가 오래되어 보석을 업데이트 할 수 없었습니다. 그래서 나는 이전 버전의 ImageMagic을 설치하게되었습니다.

6.xx에서 최신 버전을 설치할 수 있습니다.

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6f014f2b7f1f9e618fd5c0ae9c93befea671f8be/Formula/imagemagick.rb

나중에 사용하기 위해 고정 할 수도 있습니다. brew pin imagemagick


ImageMagick 7.0.4-4 에서 변경되었습니다 . wand/MagickWand.h더 이상 찾을 수 없습니다 :

% brew unlink imagemagick && brew link imagemagick
Unlinking /usr/local/Cellar/imagemagick/7.0.4-4... 71 symlinks removed
Linking /usr/local/Cellar/imagemagick/7.0.4-4... 71 symlinks created
% gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

    /Users/holger/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20170116-21103-1aikaka.rb extconf.rb
checking for clang... yes
checking for Magick-config... no
checking for pkg-config... yes
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
checking for Ruby version >= 1.8.5... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... no

Can't install RMagick 2.16.0. Can't find MagickWand.h.

나는 여전히 내 시스템에 ImageMagick 6.9.7-3을 가지고 있었고

% brew switch imagemagick 6.9.7-3
Cleaning /usr/local/Cellar/imagemagick/6.9.6-6
Cleaning /usr/local/Cellar/imagemagick/6.9.7-0
Cleaning /usr/local/Cellar/imagemagick/6.9.7-1
Cleaning /usr/local/Cellar/imagemagick/6.9.7-3
Cleaning /usr/local/Cellar/imagemagick/7.0.4-4
75 links created for /usr/local/Cellar/imagemagick/6.9.7-3

나중에 rmagick문제없이 설치할 수 있습니다 .

% gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.16.0
1 gem installed

$ brew remove imagemagick && brew install imagemagick

$ brew uninstall pkg-config && brew install pkg-config
$ brew unlink pkg-config && brew link pkg-config

$ gem install rmagick

I don't have the reputation yet to leave this as a comment improving another answer, but @Evgeniy28's answer worked for me on Sierra only after also installing pkg-config, which doesn't come installed by default on a fresh Sierra machine.

So:

brew install pkg-config
brew uninstall imagemagick
brew install imagemagick@6
brew link imagemagick@6 --force

Success:

$ gem install rmagick
Building native extensions.  This could take a while...
Successfully installed rmagick-2.16.0
Parsing documentation for rmagick-2.16.0
Installing ri documentation for rmagick-2.16.0
Done installing documentation for rmagick after 4 seconds
1 gem installed

Please follow below and change some part according to your need.

brew unlink imagemagick
brew install imagemagick@6 && brew link imagemagick@6 --force
export PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.9-24/lib/pkgconfig
gem install rmagick -v '2.15.4'

RMagick depends on an outdated version of imagemagick, version 6.(see below) Homebrew offers this as a keg-only package, which you can install with:

brew install imagemagick@6

The build output will include a Caveats section (also available from brew info imagemagick@6 if you cleared the output):

==> Caveats
imagemagick@6 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have imagemagick@6 first in your PATH run:
  echo 'export PATH="/usr/local/opt/imagemagick@6/bin:$PATH"' >> ~/.zshrc

For compilers to find imagemagick@6 you may need to set:
  export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib"
  export CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"

For pkg-config to find imagemagick@6 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"

Rather than force-linking, which has the potential to cause problems with other software that does support newer versions of imagemagick, you can use the suggested exports to make the RMagick gem pick up the old version while it builds:

export LDFLAGS="-L/usr/local/opt/imagemagick@6/lib"
export CPPFLAGS="-I/usr/local/opt/imagemagick@6/include"
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig"
gem install rmagick

  1. Go help contribute to the upgrade effort if you know Ruby and C!

Install imagemagick version 6 because version 7 is not compatible:

$ brew install imagemagick@6

Should not link --force the older version because this will change the binaries in your path and the good brew doctor will complain.

Reference the headers and libraries from version 6 that was installed when building the native extension of the gem:

$ PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick@6/6.9.10-14/lib/pkgconfig/ gem install rmagick -v '2.16.0'

Note: Worked for me without indicating the lib and include folder because the pkgconfig is responsible for this.

Note: 6.9.10-14 is the latest version of imagemagick@6, but feel free to change it if you need to use a different version


Here is how I solved (after lots of tries and fail) on macOS High Sierra 10.13.3 with Homebrew:

  1. it seems that RMagick 2.16.0 is not compatible with the newest version of ImageMagick (Version 7): http://wordsandmagic.com/2017/09/01/RMagick-2-16-0-Error-MagickWand
  2. I uninstalled imagemagick: brew uninstall imagemagick
  3. Then I installed Imagemagick with this formula: https://gist.github.com/JagdeepSingh/4b03cbeab16cc0bc729bbc6d275402d3
  4. gem install rmagick

If you have already installed an old version Imagemagick, this should work: https://stackoverflow.com/a/41674363


at version 7.0.7-1 you can create an symbolic link, but it compilation will fail latter.

cd /usr/local/Cellar/imagemagick/7.0.7-1/include/ImageMagick-7
ln -s MagickWand/ wand
ln -s MagicCore/ magick

There's no need to link or unlink anything, following the instructions from the brew install script helps:

brew install imagemagick@6
LDFLAGS="-L/usr/local/opt/imagemagick@6/lib" CPPFLAGS="-I/usr/local/opt/imagemagick@6/include" PKG_CONFIG_PATH="/usr/local/opt/imagemagick@6/lib/pkgconfig" gem install rmagick

Something was severely wrong on my system, so badly that it was completely f*d up, but I was finally to able to install RMagick for Ruby 1.8.7 again after I installed

The installation of a new Ruby version with RVM rvm install 1.8.7 also installed a new GCC compiler: it removed an older GCC version 4.6 and installed GCC version 4.9. Apparently GCC was not able to find the right headers despite pkg-config.


I fully explain the installation process in ImageMagick install in centos .

anyway ...
after install Install Imagick & ImageMagick-devel & ImageMagick PHP library like below:

# yum install ImageMagick
# yum install ImageMagick-devel
# pecl install Imagick

go to /usr/include

cd /usr/include

Important: copy ImageMagick folder from "/usr/include" to "/usr/local/include" for ImageMagick find "MagickWand.h"

I tested this change on imagick-3.4.3(ImageMagick-7) and centos 6.5 and php56 and works perfectly ...

If you have already installed "ImageMagick" several times, first remove all of them and find "ImageMagick" & "imagick" folders and clean all of them and continue the installation process with this change.

Use the following command to find a file or folder:

find / -name 'ImageMagick*'
find / -name 'imagick*'

and continue your installation
before below lines don't forget: go to "php.ini" find "disable_functions" and clean "proc_open,popen,proc_close" becuase make imagick needs these functions, after complete installation you can add this functions to your "disable_functions" on "php.ini" file.

# phpize
# ./configure --with-php-config=/usr/local/php56/bin/php-config 
...

Good luck...


For Ubuntu version > 12 and not using homebrew,

wget http://www.imagemagick.org/download/<required_imagemagick_version>
tar -xvf <path_to_your_downloaded_file>.tar.gz

If you are getting '7z' files instead of 'tar.gz' files in the wget link, then

7z x <path_to_your_downloaded_file>.7z
cd <path_to_your_downloaded_file>/
make
./configure
sudo make install
sudo ldconfig /usr/local/lib

Then you can resume your bundler for RMagick.


Got same error for alpine 3.9 image build. It comes with ImageMagick 7.0.8.38-r0

To fix that you either use alpine 3.5 with ImageMagick 6.9.6.8-r1:

FROM alpine:3.5

Or install ImageMagick 6.9.6.8-r1 with package repository for 3.5:

RUN apk add imagemagick-dev=6.9.6.8-r1 --repository http://dl-3.alpinelinux.org/alpine/v3.5/main/

There is an open issue in rmagick repo regarding failed builds for ImageMagick 7.0.x. so hopefully it will be fixed soon.


First, you don't need to uninstall imagemagick if it has a 6.x installed, like shown below. You can see the current "main" is 7.0.7-8 but 6.9.1-10 is still there.

$ brew info imagemagick                                                            
imagemagick: stable 7.0.7-8 (bottled), HEAD
Tools and libraries to manipulate images in many formats
https://www.imagemagick.org/
/usr/local/Cellar/imagemagick/6.9.1-10 (1,450 files, 17.5MB)
  Poured from bottle on 2015-07-26 at 09:10:58
/usr/local/Cellar/imagemagick/7.0.6-9 (1,522 files, 22.8MB)
  Poured from bottle on 2017-08-21 at 14:44:16
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula

If you don't have an old 6.x version, then install imagemagick@6.

Second, do not force link imagemagick, especially not 6. EDIT: See ¹
You need to set PKG_CONFIG_PATH in addition to the --with-opt-* flags.

This works for me on High Sierra with aforementioned brew setup on Ruby 1.9.3-p551:

PKG_CONFIG_PATH=/usr/local/Cellar/imagemagick/6.9.1-10/lib/pkgconfig  \
  gem install rmagick -v '2.16.0' -- \
  --with-opt-lib=/usr/local/Cellar/imagemagick/6.9.1-10/lib/ \
  --with-opt-include=/usr/local/Cellar/imagemagick/6.9.1-10/include/ImageMagick-6/

Building ri docs fails, but those are inconsequential.

¹: Building works, the dylib path RMagick is searching is wrong though. Raised Issue #278 to clarify if this can be fixed. Otherwise manual symlinking of libMagickWand etc is necessary. Might still be safer to manually link the specific libraries than a brew link --force though.

참고URL : https://stackoverflow.com/questions/39494672/rmagick-installation-cant-find-magickwand-h

반응형