Mac Rmagick 无法与 Xcode 4.2 一起安装

发布于 2025-01-03 12:39:53 字数 2809 浏览 2 评论 0原文

我刚买了一台新的 macbook pro 并尝试设置我的开发环境。 我从应用商店下载了 xcode 4.2 并安装了它,之后我安装了 homebrew 和 RVM。 ImageMagick、readline、ruby 1.9.3-head 都安装完美,直到我运行尝试安装 rmagick 的捆绑更新。

经过很长时间的调查,我得出的结论是它找不到 libgomp。

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.

这是我的 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 */

现在我假设 xcode 出了问题,我尝试了几件事:

  • 重新安装 xcode
  • 删除 imagemagick 并重新安装它,包括其他库,例如jpg、libpng 等
  • 安装了旧版本的 imagemagick
  • 删除了 .rvm 并重新安装了 ruby​​ 的新副本

我不知道我还可以尝试什么,有人可以帮助将我推向好的方向吗?

I just got a new macbook pro and trying to setup my dev environment.
I downloaded xcode 4.2 from the app store and installed it, after this i installed homebrew and RVM.
ImageMagick, readline, ruby 1.9.3-head all installed perfectly until i ran bundle update which tried to install rmagick.

After a long long time investigating i come down to the conclusion that it can't find libgomp.

The output is from gem install rmagick is:

$ 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:

"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:

  • Reinstall xcode
  • Remove imagemagick and reinstalled it including other libraries like jpg, libpng etc
  • Installed older version of imagemagick
  • Removed .rvm and reinstalled a fresh copy of ruby

I have no clue what's left for me to try, could anyone help to push me in the good direction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

椒妓 2025-01-10 12:39:53

我尝试了你的解决方案(充满希望),但不幸的是它对我不起作用。
最后,我设法通过使用 Homebrew 重新安装 imagemagick 来使其工作,而无需 openmp 支持(这是负责 lgomp 的库)

brew install imagemagick --disable-openmp

然后安装 rmagick 没有任何问题。

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)

using Homebrew:

brew install imagemagick --disable-openmp

then rmagick installed without any problems.

半衬遮猫 2025-01-10 12:39:53

我尝试下载并安装 lion 4.1,但它甚至没有安装(没有正确的错误消息)。
现在,一位同事给了我这个 Mac 版 GCC 的绝佳链接,它非常有用:
https://github.com/kennethreitz/osx-gcc-installer

不要忘记如果您运行于 > 则下载 v2 10.7.0

I tried to download and install 4.1 for lion and this didn't even install (without a proper error message).
Now a colleague gave me this great link to GCC for Mac which worked like a charm:
https://github.com/kennethreitz/osx-gcc-installer

Don't forget to download the v2 if you run on > 10.7.0

々眼睛长脚气 2025-01-10 12:39:53

对于想要源码安装的人,您可以下载源代码存储库并在 imagemagick 源代码目录中发出此命令。

./configure --disable-openmp

其工作方式与上面的brew版本类似,但使用源代码编译。

For people who want source installation, you can download the source code repository and issue this command in the imagemagick source code directory.

./configure --disable-openmp

It will work similar to the brew version above but with source code compilation instead.

晨与橙与城 2025-01-10 12:39:53

我使用 Macports 遇到了这个问题,但没有指南,所以我将在此处添加一个指南:

  1. uninstall ImageMagick: 'sudo port uninstall ImageMagick' // 以及任何相关人员
  2. 此处
  3. 关注指南(转录如下):
    'cd $(端口目录 ImageMagick)'
    '补丁-p0 < (下载的补丁文件)'
  4. 'sudo port install ImageMagick +no_openmp'

I ran into this problem using Macports but there are no guides so I'll add one here:

  1. uninstall ImageMagick: 'sudo port uninstall ImageMagick' // and any dependents
  2. download Portfile-ImageMagick.diff from here
  3. Follow guide (transcribed below):
    'cd $(port dir ImageMagick)'
    'patch -p0 < (downloaded patch file)'
  4. 'sudo port install ImageMagick +no_openmp'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文