Lion OSX: How to install libfreetype.6.dylib?

2020-07-03 07:35发布

I am trying to install a ruby gem, but the installation process is stopped, because:

ld: file not found: /usr/local/lib/libfreetype.6.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

How can I install this library? I checked the /usr/local/lib/ and the library is missing there.

EDIT:

I ran locate libfreetype.6.dylib and got:

/Applications/MAMP/Library/lib/libfreetype.6.dylib
/Applications/VLC.app/Contents/MacOS/lib/libfreetype.6.dylib
/Applications/XAMPP/xamppfiles/lib/libfreetype.6.dylib
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/X11/lib/libfreetype.6.dylib
/Applications/calibre.app/Contents/Frameworks/libfreetype.6.dylib
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Info.plist
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF
/Users/xxxxx/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF/libfreetype.6.dylib
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Info.plist
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources
/Users/xxxxx/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF
/Users/v/rubydev/sharelock-staging/magick-installer/freetype-2.4.3/objs/.libs/libfreetype.6.dylib.dSYM/Contents/Resources/DWARF/libfreetype.6.dylib
/opt/X11/lib/libfreetype.6.dylib
/usr/local/Cellar/freetype/2.4.10/lib/libfreetype.6.dylib

But why system doen't find the library?

4条回答
够拽才男人
2楼-- · 2020-07-03 07:41

What library are you trying to install? Could it by chance be ImageMagick? Also, if it's a RubyGem, why is the post tagged with homebrew?

Anyways, I got this error when installing ImageMagick, you need to symlink /opt/X11/lib/libfreetype.6.dylib to /usr/local/lib.

do this:

ln -s /opt/X11/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.6.dylib

查看更多
beautiful°
3楼-- · 2020-07-03 07:42

Your compiler is trying to link to an lib at a location that doesn't have the lib, however it seems that you have installed it with homebrew. Try running ln -s /usr/local/Cellar/freetype/2.4.10/lib/libfreetype.6.dylib /usr/local/lib/libfreetype.6.dylib to create one, or you can just use the without-freetype flag to skip it.

查看更多
The star\"
4楼-- · 2020-07-03 07:48

If you're using brew, you can:

brew link --overwrite freetype

查看更多
兄弟一词,经得起流年.
5楼-- · 2020-07-03 07:55

Gabriel F. Engel's answer almost worked for me. I had to do the following change:

brew install freetype
brew link --overwrite freetype
查看更多
登录 后发表回答