简体   繁体   中英

brew link error libpng and libtiff

I tried installing elixir using homebrew and I got the following errors

==> Pouring libtiff-4.0.3.yosemite.bottle.tar.gz
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local

File exists - /usr/local/lib Error: File exists - /usr/local/lib

I ran brew doctor and I saw this

Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that  depend on
those kegs to fail to run properly once built. Run `brew link` on these:

libpng
libtiff

So I ran brew link libpng and I got this

Linking /usr/local/Cellar/libpng/1.6.17... Error: File exists - /usr/local/lib

I have no idea whats wrong. Any help

It seems like in your /usr/local/lib folder, there are existing libpng symbols, hence brew doesn't want to overwrite them. It is a dependency of elixir , so it halts the setup.

If you are using MacPorts or Homebrew or installing anything manually, then dependencies might conflict. It's better to use one of them in a mutual exclusive way.

It's a viable choice to use Homebrew in overall since ease of use, if you are not going to build packages from source.

Homebrew does not work as how you would expect. As a default, it has a base directory to install the artifacts of keg s named Cellar , although it is configurable. Normally, you would copy the binaries to the /usr/local/bin , libraries to /usr/local/lib , headers to the /usr/local/include and so on... However, Homebrew installs them to its own directory and creates symbolic links on those directories instead, in order to make them function in same way.

You may find errors (or incompatibities) with brew doctor command. It'll tell you the symbols/files conflicting. You can delete them from file system manually, afterwards brew will create the symbolic links pointing to its base directory (upon your brew link $PACKAGE_NAME command).

Experiment

When I suddenly decided to do a trivial brew doctor in my computer it did output some unexpected header files like so:

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

However, it also states that those are no significance if everything works:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

First few lines from the output:

Unexpected header files:
  /usr/local/include/node/android-ifaddrs.h
  /usr/local/include/node/ares.h
  ...

This is not my personal computer, but it seems like someone installed node to this computer (actually user) manually. Trying to install it or anything dependent to it via brew would fail, in this case, since the upcoming header files would conflict with pre-installed ones.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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