简体   繁体   English

rvm install 1.9.3导致ImageMagick安装问题

[英]rvm install 1.9.3 leading to ImageMagick installation issue

I was using Ruby 1.9.2 for my RoR 3.2.11 project 我使用Ruby 1.9.2作为我的RoR 3.2.11项目

All worked fine until I had to upgrade to Ruby 1.9.3 because a gem required it. 一切正常,直到我不得不升级到Ruby 1.9.3,因为宝石需要它。 By the same occasion I tried to make good use of RVM. 在同一场合,我试图充分利用RVM。

Installed ruby 1.9.3 安装红宝石1.9.3

rvm install 1.9.3 -C --with-openssl-dir=$HOME/.rvm/usr

Created .rvmrc 创建.rvmrc

cd ./my_project/
rvm --create --rvmrc 1.9.3@project

Cleaned up my global gemset 清理了我的全球宝石

rvm gemset empty

cd into my project and run installed gems cd进入我的项目并运行已安装的gem

bundle

Error log 错误日志

Installing rmagick (2.13.2) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
checking for /opt/local/bin/gcc-apple-4.2... yes
checking for Magick-config... yes

Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
         /usr/local/ImageMagick/bin/Magick-config reports version 6.7.3 Q16 is installed in 
         /usr/local/bin/Magick-config reports version 6.7.1 Q16 is installed in /usr/local/Cellar/imagemagick/6.7.1-1
Using 6.7.3 Q16 from .

checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... *** 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
    --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=/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
/Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:931:in `block in have_header'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /Users/joel/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:930:in `have_header'
    from extconf.rb:194:in `<main>'


Gem files will remain installed in /Users/joel/.rvm/gems/ruby-1.9.3-p429@creativebank/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/joel/.rvm/gems/ruby-1.9.3-p429@my_project/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

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.

At first sight, it looks like I have 2 installations of ImageMagick and that I could spare one. 乍一看,看起来我有两个ImageMagick安装,我可以省一个。

So my first question would be how to uninstall clean ImageMagick version 6.7.1 Q16? 所以我的第一个问题是如何卸载干净的ImageMagick版本6.7.1 Q16?

and of course if there is something else I could try to solve this issue. 当然,如果还有别的东西,我可以尝试解决这个问题。

ADDITIONAL INFO about packages installed 关于安装的软件包的附加信息

I know that MacPort and Brew don't work well together but I always been worried about removing MacPort in its entirety. 我知道MacPort和Brew不能很好地协同工作,但我一直担心完全删除MacPort。 Could that be the problem? 这可能是问题吗?

port list | grep magick

p5-perlmagick                  @6.8.6-0        perl/p5-perlmagick
p5.8-perlmagick                @6.8.6-0        perl/p5-perlmagick
p5.10-perlmagick               @6.8.6-0        perl/p5-perlmagick
p5.12-perlmagick               @6.8.6-0        perl/p5-perlmagick
p5.14-perlmagick               @6.8.6-0        perl/p5-perlmagick
p5.16-perlmagick               @6.8.6-0        perl/p5-perlmagick
php-gmagick                    @1.1.2RC1       php/php-gmagick
php53-gmagick                  @1.1.2RC1       php/php-gmagick
php54-gmagick                  @1.1.2RC1       php/php-gmagick
php55-gmagick                  @1.1.2RC1       php/php-gmagick
php-imagick                    @3.1.0RC2       php/php-imagick
php53-imagick                  @3.1.0RC2       php/php-imagick
php54-imagick                  @3.1.0RC2       php/php-imagick
php55-imagick                  @3.1.0RC2       php/php-imagick
php-magickwand                 @1.0.9-2        php/php-magickwand
php53-magickwand               @1.0.9-2        php/php-magickwand
php54-magickwand               @1.0.9-2        php/php-magickwand
php55-magickwand               @1.0.9-2        php/php-magickwand
php5-gmagick                   @1.1.2RC1       php/php5-gmagick
php5-imagick                   @3.0.1          php/php5-imagick
php5-magickwand                @1.0.9-2        php/php5-magickwand
rb-rmagick                     @2.13.2         ruby/rb-rmagick


brew list

faac        grc     jasper      lame        libtiff     libvpx      pkg-config  wget        xvid
ffmpeg      imagemagick jpeg        libogg      libvorbis   little-cms  theora      x264        yasm

UPDATE UPDATE

Remove MacPorts 删除MacPorts

sudo port -f uninstall installed

Uninstalled brew ImageMagick and installed it again with brew 卸载brew ImageMagick并再次使用brew安装它

Installed XCode latest version 安装了XCode最新版本

and ran bundle, I do get a different message, C compiler missing ... argh, what should I do next, I am trying installing gcc with brew, but not sure that I am heading the right direction, please help: 然后运行bundle,我确实得到了一个不同的消息,C编译器丢失了......唉,接下来该怎么办,我正在尝试用brew安装gcc,但不确定我是朝着正确的方向前进,请帮助:

Installing rmagick (2.13.2) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb 
checking for Ruby version >= 1.8.5... yes
checking for /opt/local/bin/gcc-apple-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** 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
    --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=/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby


Gem files will remain installed in /Users/joel/.rvm/gems/ruby-1.9.3-p429@creativebank/gems/rmagick-2.13.2 for inspection.
Results logged to /Users/joel/.rvm/gems/ruby-1.9.3-p429@creativebank/gems/rmagick-2.13.2/ext/RMagick/gem_make.out

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.

GCC 4.2 GCC 4.2

which gcc => /usr/bin/gcc

gcc -v gcc -v

Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

echo $PATH echo $ PATH

   /bin;/usr/bin;/usr/sbin;/sbin;/usr/local/ImageMagick/bin:/usr/local/heroku/bin:/Applications/Postgres.app/Contents/MacOS/bin:/Users/joel/.rvm/gems/ruby-1.9.3-p429@biowatts/bin:/Users/joel/.rvm/gems/ruby-1.9.3-p429@global/bin:/Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin:/Users/joel/.rvm/bin:/usr/bin;usr/local/ImageMagick/bin:/usr/local/heroku/bin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/ImageMagick/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/joel

NEW ERROR MESSAGE: 新错误消息:

Installing json (1.8.0) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /Users/joel/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb 
creating Makefile

make
compiling generator.c
make: /opt/local/bin/gcc-apple-4.2: No such file or directory
make: *** [generator.o] Error 1


Gem files will remain installed in /Users/joel/.rvm/gems/ruby-1.9.3-p429@biowatts/gems/json-1.8.0 for inspection.
Results logged to /Users/joel/.rvm/gems/ruby-1.9.3-p429@biowatts/gems/json-1.8.0/ext/json/ext/generator/gem_make.out

It obviously looking for /opt/local/bin/gcc-apple-4.2 which I deleted recklessly while following these instructions to move from Macportd to homebrew :( 它显然正在寻找/opt/local/bin/gcc-apple-4.2,我按照这些说明从Macportd转移到自制软件时鲁莽地删除了:(

NOW INSTALLING MISSING PACKAGES with homebrew 现在用自制软件安装丢失的包装

brew install apple-gcc42 brew install libxml2 brew安装apple-gcc42 brew安装libxml2

Couple things: 情侣:

  1. Remove MacPorts (you may list all things you installed with them and reinstall those with brew) 删除MacPorts(您可以列出随它们安装的所有内容并重新安装brew)
  2. Remove imagemagick from homebrew 从自制软件中删除imagemagick
  3. Install imagemagick again with brew 使用brew再次安装imagemagick

You're getting this error You have to install development tools first. 您收到此错误You have to install development tools first. which (I guess) means you need to install XCode command line tools. (我猜)意味着您需要安装XCode命令行工具。

Then bundle install should work! 然后bundle install应该工作!

删除用于安装它的软件包管理器后,您需要重新安装ruby,最简单的方法是:

rvm reinstall 1.9.3-p429

In combination to the 2 first answers 结合2个第一个答案

brew uninstall imagemagick

and used http://cactuslab.com/imagemagick/ 并使用了http://cactuslab.com/imagemagick/

Then in my .bash_profile I set 然后在我的.bash_profile中设置

PKG_CONFIG_PATH=/opt/ImageMagick/lib/pkgconfig 
C_INCLUDE_PATH=/opt/ImageMagick/include/ImageMagick-6 

and finally 最后

bundle

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

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