简体   繁体   English

ImageMagick:错误:无法构建gem本机扩展

[英]ImageMagick : ERROR: Failed to build gem native extension

i have a error installing the gem called rmagick. 我在安装名为rmagick的gem时出错。 I have seen other Stack Over flow websites regarding the same issue. 我见过其他关于相同问题的Stack Over Flow网站。 but din't work. 但是没用

Error: 错误:

Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rmagick-2.16.0/ext/RMagick
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20170403-8836-1ebgkj8.rb extconf.rb
*** 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:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in ``': No such file or directory - identify -version (Errno::ENOENT)
        from extconf.rb:141:in `configure_compile_options'
        from extconf.rb:16:in `initialize'
        from extconf.rb:548:in `new'
        from extconf.rb:548:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rmagick-2.16.0 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/rmagick-2.16.0/gem_make.out

C:\Users\suresh>gem install rmagick
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
        ERROR: Failed to build gem native extension.

    current directory: C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rmagick-2.16.0/ext/RMagick
C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20170403-7540-1x6tan0.rb extconf.rb
*** 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:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
extconf.rb:141:in ``': No such file or directory - identify -version (Errno::ENOENT)
        from extconf.rb:141:in `configure_compile_options'
        from extconf.rb:16:in `initialize'
        from extconf.rb:548:in `new'
        from extconf.rb:548:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in C:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/rmagick-2.16.0 for inspection.
Results logged to C:/Ruby22-x64/lib/ruby/gems/2.2.0/extensions/x64-mingw32/2.2.0/rmagick-2.16.0/gem_make.out

What i actually did, step 3 and step 4 output the same error above. 我实际上所做的是,第3步和第4步在上面输出了相同的错误。

    1.Downloaded ImageMagick-7.0.5-4-Q16-x64-dll
    2.Set my Path to C:\Program Files (x86)\ImageMagick-7.0.5-Q16\include 
    set
    3.Install the gem using this command:
      gem install rmagick --platform=ruby -- --with-opt-lib=C:\ImageMagick-7.0.5-Q16\lib --with-opt-include=C:\ImageMagick-7.0.5-Q16\include
    4. or gem install rmagick
    5. Using Windows 10 machine

RMagick doesn't seem to support ImageMagick 7 yet. RMagick似乎还不支持ImageMagick 7。 Try to install rmagick with the latest build of ImageMagick 6.9. 尝试使用最新版本的ImageMagick 6.9安装rmagick。

OK GUYS I MANAGED TO INSTALL IT. 好的,我已设法安装它。

Please follow this guide. 请遵循本指南。

Step 1: Download and install this 步骤1:下载并安装

 ImageMagick-6.9.8-3-Q16-HDRI-x64-dl

Step 2: Set and create a new Environment variable called CLASSPATH and the value set it to 步骤2:设置并创建一个名为CLASSPATH的新环境变量,并将其值设置为

.;C:\ImageMagick-6.9.8-Q16-HDRI\include;lib C:\ImageMagick-6.9.8-Q16-HDRI\lib

Step 3: gem install it 步骤3:安装gem

 gem install rmagick  --platform=ruby -- --with-opt-lib=C:\ImageMagick-6.9.8-Q16-HDRI\lib --with-opt-include=C:\ImageMagick-6.9.8-Q16-HDRI\include

IMPORTANT TAKE NOTE!!! 重要提示!!!

when you download and install ImageMagick make sure you type the version number exactly when setting your path and gem install. 当您下载并安装ImageMagick时,请确保在设置路径和gem安装时准确键入版本号。

Example like ImageMagic-6.9.8-3-Q16-HDRI, follow exactly. 完全遵循ImageMagic-6.9.8-3-Q16-HDRI之类的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM