简体   繁体   English

Rails + Mac OS X:libMagickCore-Q16.7.dylib不起作用

[英]Rails + Mac OS X: libMagickCore-Q16.7.dylib doesn't work

If I run some kind of rake command, I get this error message: 如果我运行某种rake命令,我收到此错误消息:

rake aborted!
dlopen(/Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libfreetype.6.dylib
  Referenced from: /usr/local/lib/libMagickCore-Q16.7.dylib
  Reason: Incompatible library version: libMagickCore-Q16.7.dylib requires version 16.0.0 or later, but libfreetype.6.dylib provides version 13.0.0 - /Users/adam/.rvm/gems/ruby-1.9.3-p327/gems/rmagick-2.13.1/lib/RMagick2.bundle
...

I am running on RoR 3.2, OSX Lion. 我在RoR 3.2,OSX Lion上运行。

Could anyone help me, please, how to fix this issue? 任何人都可以帮助我,如何解决这个问题? I spent 2 days of googling, reading discussions, but unfortunately with zero success... 我花了2天的谷歌搜索,阅读讨论,但遗憾的是没有成功...

Thank you so much! 非常感谢!

Using Homebrew I was able to solve it using the following commands: 使用Homebrew我能够使用以下命令解决它:

brew uninstall freetype
brew update
brew install freetype

Update step might be unnecessary. 更新步骤可能是不必要的。 The installation succeeded but with the following warning: 安装成功但出现以下警告:

Warning: Could not link freetype. Unlinking...

So one final command: 所以最后一个命令:

brew link --overwrite freetype

I have an amazing how-to-install-rmagick that have been working beautifully for me, try to re-install ImageMagick following these steps: 我有一个令人惊奇的安装方法,它对我来说很漂亮,尝试按照以下步骤重新安装ImageMagick:

  1. yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel -y (I use CentOS, you can translate the commands to your distro) yum install tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel -y (我使用CentOS,你可以将命令翻译成你的发行版)
  2. Download ImageMagick. 下载ImageMagick。 Write wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz and press Enter. wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz并按Enter键。 ImageMagick.tar.gz is created in the current directory. ImageMagick.tar.gz在当前目录中创建。
  3. Unpack the ImageMagick archive. 解压缩ImageMagick存档。 Write tar xczf ImageMagick.tar.gz and press Enter. tar xczf ImageMagick.tar.gz并按Enter键。 A new directory, ImageMagick-version, where version is the ImageMagick version number, is created. 创建一个新目录ImageMagick-version,其中version是ImageMagick版本号。
  4. Switch to the ImageMagick directory. 切换到ImageMagick目录。 Write cd ImageMagick-version and press Enter. 写cd ImageMagick-version并按Enter键。
  5. Configure the ImageMagick build. 配置ImageMagick构建。 Write ./configure --prefix=/usr/local --without-perl and press Enter. ./configure --prefix=/usr/local --without-perl并按Enter键。
  6. Compile ImageMagick. 编译ImageMagick。 Write make and press Enter. make并按Enter键。 ImageMagick compiles. ImageMagick编译。 This step may take several minutes. 此步骤可能需要几分钟。
  7. Install ImageMagick to your home directory. 将ImageMagick安装到您的主目录。 Write make install and press Enter. 编写make install并按Enter键。
  8. Remove the installation files. 删除安装文件。 Write rm -r ImageMagick.tar.gz and press Enter. rm -r ImageMagick.tar.gz然后按Enter键。
  9. Add /usr/local/bin to your PATH. 将/ usr / local / bin添加到PATH。
    • Write echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile and press Enter. 写入echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile并按Enter键。
    • Reload your .bash_profile. 重新加载.bash_profile。 Write source ~/.bash_profile and press Enter. source ~/.bash_profile并按Enter键。
  10. Install the RMagick gem. 安装RMagick gem。
    • Write export LD_LIBRARY_PATH=/usr/local/lib and press Enter. export LD_LIBRARY_PATH=/usr/local/lib并按Enter键。
    • Write export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ and press Enter. 写入export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/并按Enter键。
    • Install the RMagick gem in your Ruby on Rails application. 在Ruby on Rails应用程序中安装RMagick gem。

Tell me later how it goes. 稍后告诉我它是怎么回事。

Do you use something like Homebrew or MacPorts to manage external library dependencies? 您是否使用HomebrewMacPorts类的东西来管理外部库依赖项?

Installing the imagemagick library from there and then install rmagick. 从那里安装imagemagick库,然后安装rmagick。

I found the answer in another post: 我在另一篇文章中找到了答案:

Rails 3 - RMagick doesn't find libfreetype.6.dylib using Paperclip Rails 3 - RMagick使用Paperclip找不到libfreetype.6.dylib

I performed the search and found that there was an older version of libfreetype that was being referenced and newer versions hidden elsewhere. 我执行了搜索,发现有一个旧版本的libfreetype被引用,而较新版本隐藏在其他地方。 By copying/linking the newer versions into the appropriate directory (/usr/local/lib in my case) the problem was resolved. 通过将较新版本复制/链接到相应的目录(在我的情况下为/ usr / local / lib),问题得以解决。

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

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