Ruby on rails 在Mac OS 10.6上安装RMagick时出错

Ruby on rails 在Mac OS 10.6上安装RMagick时出错,ruby-on-rails,ruby,macos,macports,rmagick,Ruby On Rails,Ruby,Macos,Macports,Rmagick,我正在尝试安装RMagick,以便在Rails应用程序中使用它,但遇到了一些问题 我使用的是使用rvm安装的带有Ruby 2.3.1的Rails 5。操作系统是OSX 10.6,我已经用macports安装了ImageMagick 当Bundler尝试安装RMagick gem时,我可以看到安装失败,在日志中我可以看到以下结果: find_executable: checking for clang... -------------------- yes find_executable: che

我正在尝试安装RMagick,以便在Rails应用程序中使用它,但遇到了一些问题

我使用的是使用rvm安装的带有Ruby 2.3.1的Rails 5。操作系统是OSX 10.6,我已经用macports安装了ImageMagick

当Bundler尝试安装RMagick gem时,我可以看到安装失败,在日志中我可以看到以下结果:

find_executable: checking for clang... -------------------- yes
find_executable: checking for Magick-config... -------------------- yes
configure_compile_options: checking for outdated ImageMagick version (<= 6.4.9)... no
Detected ImageMagick version: 6.9.5
configure_compile_options: checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
Detected 6.9+ version, using MagickWand API
assert_minimum_ruby_version!: checking for Ruby version >= 1.8.5...  yes
"clang -o conftest -I/Users/jonny/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin10.0 
-I/Users/jonny/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward 
-I/Users/jonny/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0 -I.  
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 
-fopenmp -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 
-I/opt/local/include/ImageMagick-6  -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 
-DMAGICKCORE_QUANTUM_DEPTH=16 -fopenmp -DMAGICKCORE_HDRI_ENABLE=0 
-DMAGICKCORE_QUANTUM_DEPTH=16 
-I/opt/local/include/ImageMagick-6 conftest.c  -L. 
-L/Users/jonny/.rvm/rubies/ruby-2.3.1/lib -L/opt/local/lib  
-L/opt/local/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16    
-L/opt/local/lib -lMagickWand-6.Q16 -lMagickCore-6.Q16  
-lruby.2.3.0  -lpthread -lgmp -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(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */
find_可执行文件:检查是否有叮当声…------------对
查找\u可执行文件:正在检查Magick配置…------------对
配置编译选项:检查过时的ImageMagick版本(=6.9.0)。。。不
使用MagickWand API检测到6.9+版本
断言\u最小\u ruby\u版本!:正在检查Ruby版本>=1.8.5。。。对
“clang-o conftest-I/Users/jonny/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/x86_64-darwin10.0
-I/Users/jonny/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0/ruby/backward
-I/Users/jonny/.rvm/rubies/ruby-2.3.1/include/ruby-2.3.0-I。
-fopenmp-DMAGICKCORE\u HDRI\u ENABLE=0-DMAGICKCORE\u QUANTUM\u DEPTH=16
-fopenmp-DMAGICKCORE\u HDRI\u ENABLE=0-DMAGICKCORE\u QUANTUM\u DEPTH=16
-I/opt/local/include/ImageMagick-6-fopenmp-DMAGICKCORE\u HDRI\u ENABLE=0
-DMAGICKCORE\u QUANTUM\u DEPTH=16-fopenmp-DMAGICKCORE\u HDRI\u ENABLE=0
-DMAGICKCORE\u量子\u深度=16
-I/opt/local/include/ImageMagick-6 conftest.c-L。
-L/Users/jonny/.rvm/rubies/ruby-2.3.1/lib-L/opt/local/lib
-L/opt/local/lib-lMagickWand-6.Q16-lMagickCore-6.Q16
-L/opt/local/lib-lMagickWand-6.Q16-lMagickCore-6.Q16
-lruby.2.3.0-lpthread-lgmp-ldl-lobjc“
ld:找不到-lgomp的库
叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用)
检查的程序是:
/*开始*/
1:#包括“ruby.h”
2: 
3:int main(int argc,字符**argv)
4: {
5:返回0;
6: }
/*结束*/

有人有办法解决这个问题吗?

我自己解决了这个问题。出现问题的原因是较旧版本的clang不支持openmp,因此我们必须安装较新版本

使用macports我安装了另一个版本的clang启用openmp版本

在安装之后,我已经检查了使用命令安装的clang的名称

sudo port select --list clang
新的clang安装名称是mp-clang-3.7,因此在控制台中键入

sudo port select --set clang mp-clang-3.7
选择正确的版本


完成后,我可以使用bundle正确安装RMagick。

我自己解决了这个问题。出现问题的原因是较旧版本的clang不支持openmp,因此我们必须安装较新版本

使用macports我安装了另一个版本的clang启用openmp版本

在安装之后,我已经检查了使用命令安装的clang的名称

sudo port select --list clang
新的clang安装名称是mp-clang-3.7,因此在控制台中键入

sudo port select --set clang mp-clang-3.7
选择正确的版本

完成后,我可以使用bundle正确安装RMagick