简体   繁体   English

Mac Rmagick不会与Xcode 4.2一起安装

[英]Mac Rmagick won't install with Xcode 4.2

I just got a new macbook pro and trying to setup my dev environment. 我刚得到一个新的Macbook Pro,并尝试设置我的开发环境。 I downloaded xcode 4.2 from the app store and installed it, after this i installed homebrew and RVM. 在安装自制软件和RVM之后,我从应用程序商店下载并安装了xcode 4.2。 ImageMagick, readline, ruby 1.9.3-head all installed perfectly until i ran bundle update which tried to install rmagick. ImageMagick,readline,ruby 1.9.3-head都已完美安装,直到我运行试图安装rmagick的捆绑包更新。

After a long long time investigating i come down to the conclusion that it can't find libgomp. 经过长时间的调查,我得出结论,它找不到libgomp。

The output is from gem install rmagick is: 来自gem install rmagick的输出是:

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

        /Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
extconf.rb:128: Use RbConfig instead of obsolete and deprecated Config.
checking for clang... yes
checking for Magick-config... yes
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
        --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=/Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/bin/ruby
/Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/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.

Here is my mkmf.log file: 这是我的mkmf.log文件:

"clang -o conftest -I/Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/include/ruby-1.9.1/x86_64-darwin11.2.0 -I/Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/include/ruby-1.9.1/ruby/backward -I/Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/include/ruby-1.9.1 -I.  -I/usr/local/Cellar/imagemagick/6.7.1-1/include/ImageMagick  -I/usr/local/Cellar/imagemagick/6.7.1-1/include/ImageMagick -fopenmp conftest.c  -L. -L/Users/dhiemstra/.rvm/rubies/ruby-1.9.3-head/lib  -L/usr/local/Cellar/imagemagick/6.7.1-1/lib -L/usr/X11/lib    -L/usr/local/Cellar/imagemagick/6.7.1-1/lib -lMagickCore -llcms -ltiff -lfreetype -ljpeg -L/usr/X11/lib -lfontconfig -lXext -lSM -lICE -lX11 -lXt -lbz2 -lz -lm -lgomp -lpthread -lltdl  -lruby.1.9.1  -lpthread -ldl -lobjc "
ld: library not found for -lgomp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main() {return 0;}
/* end */

Now i assumed here that something was wrong with xcode i tried several things: 现在我在这里假设xcode出了点问题,我尝试了几件事:

  • Reinstall xcode 重新安装xcode
  • Remove imagemagick and reinstalled it including other libraries like jpg, libpng etc 删除imagemagick并重新安装它,包括其他库,例如jpg,libpng等
  • Installed older version of imagemagick 已安装旧版本的imagemagick
  • Removed .rvm and reinstalled a fresh copy of ruby 删除.rvm并重新安装红宝石的新副本

I have no clue what's left for me to try, could anyone help to push me in the good direction? 我不知道还有什么可以尝试的,有人可以帮助我朝好的方向发展吗?

I tried your solution (full of hope) but It did not work for me unfortunately. 我尝试了您的解决方案(充满希望),但不幸的是,它对我没有用。 Finally I managed to make it work by reinstalling imagemagick without openmp support (this is the library responsible for lgomp) 最终,我设法通过在没有openmp支持的情况下重新安装imagemagick使其工作(这是负责lgomp的库)

using Homebrew: 使用自制软件:

brew install imagemagick --disable-openmp

then rmagick installed without any problems. 然后rmagick安装没有任何问题。

For people who want source installation, you can download the source code repository and issue this command in the imagemagick source code directory. 对于需要源代码安装的人,可以下载源代码存储库,然后在imagemagick源代码目录中发出此命令。

./configure --disable-openmp ./configure --disable-openmp

It will work similar to the brew version above but with source code compilation instead. 它的工作方式与上面的brew版本类似,但是具有源代码编译功能。

I tried to download and install 4.1 for lion and this didn't even install (without a proper error message). 我试图为狮子下载并安装4.1,但甚至没有安装(没有正确的错误消息)。 Now a colleague gave me this great link to GCC for Mac which worked like a charm: https://github.com/kennethreitz/osx-gcc-installer 现在,一位同事给了我这个指向Mac的GCC的很棒的链接,就像一个魅力一样工作: https : //github.com/kennethreitz/osx-gcc-installer

Don't forget to download the v2 if you run on > 10.7.0 如果您在> 10.7.0上运行,请不要忘记下载v2

I ran into this problem using Macports but there are no guides so I'll add one here: 我在使用Macports时遇到了这个问题,但是没有指南,因此我将在此处添加一个:

  1. uninstall ImageMagick: 'sudo port uninstall ImageMagick' // and any dependents 卸载ImageMagick:'sudo port卸载ImageMagick'//和所有依赖项
  2. download Portfile-ImageMagick.diff from here 这里下载Portfile-ImageMagick.diff
  3. Follow guide (transcribed below): 'cd $(port dir ImageMagick)' 'patch -p0 < (downloaded patch file)' 遵循指南 (转录如下):'cd $ {port dir ImageMagick)''patch -p0 <(下载的补丁文件)'
  4. 'sudo port install ImageMagick +no_openmp' 'sudo端口安装ImageMagick + no_openmp'

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

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