Homebrew-core: `libpng` v1.6.36 Fails to Finish `brew link`ing on OS X v10.11.6 'El Capitan'

Created on 20 Dec 2018  Â·  14Comments  Â·  Source: Homebrew/homebrew-core

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

Please always confirm that you:

  • [x] are reporting a bug others will be able to reproduce and not asking a question or requesting software. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh. To get software added or changed in Homebrew, please file a Pull Request.
  • [x] have a problem with brew installing (or upgradeing or reinstalling) a single, official formula (not cask?) If it's a general brew problem, please file this issue at Homebrew/brew: https://github.com/Homebrew/brew/issues/new/choose. If it's a brew cask problem, please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap — e.g.: Homebrew/homebrew-php) — problem, please file this issue at the tap.
  • [x] ran brew update and can still reproduce the problem?
  • [ ] ran brew doctor, fixed all issues, and can still reproduce the problem? (As many as possible, but not all.)
  • [ ] ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link? (N/A; see the next checklist item.)
  • [x] if brew gist-logs didn't work (or wasn't preferred:) ran brew config and brew doctor and included their output and that of all relevant logs with your issue?

Poster's Note:

     Normally, what follows would likely preclude me from filing this issue, but another user has already reported a similar issue with another formula occurring under an officially supported configuration, so I'm submitting this for triage anyway. Both this issue and that other one only manifested after the recent release of Homebrew v1.8.6 as far as I can tell, though I didn't immediately pick up any changes that might obviously be relevant here upon reviewing said version's release notes again.


'brew config' Output:

…:~ …$ brew config
HOMEBREW_VERSION: 1.8.6
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: 858c5e1afb0eb00079a4f014e8fbedf9065d50e4
Last commit: 3 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e17886a979fa590917802087f36c377e2fbc3dd6
Core tap last commit: 32 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: --appdir=/Applications --prefpanedir=/Library/PreferencePanes --colorpickerdir=/Library/ColorPickers --dictionarydir=/Library/Dictionaries --servicedir=/Library/Services --qlplugindir=/Library/QuickLook --fontdir=/Library/Fonts --input_methoddir=/Library/Input\ Methods --screen_saverdir=/Library/Screen\ Savers --internet_plugindir=/Library/Internet\ Plug\-Ins
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_FORCE_BREWED_CURL: 1
HOMEBREW_FORCE_BREWED_GIT: 1
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_UPDATE_TO_TAG: 1
CPU: dual-core 64-bit core2
Homebrew Ruby: 2.3.7 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.7/bin/ruby
Clang: 8.0 build 800
Git: 2.20.1 => /usr/local/opt/git/bin/git
Curl: 7.63.0 => /usr/local/opt/curl/bin/curl
Java: 11.0.1
macOS: 10.11.6-x86_64
CLT: 8.2.0.0.1.1480973914
Xcode: 8.2.1
XQuartz: 2.7.11 => /opt/X11

'brew doctor' Output:

…:~ …$ brew doctor
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 or file an issue; just ignore this. Thanks!

Warning: You are using macOS 10.11.
We (and Apple) do not provide support for this old version.
You will encounter build failures and other breakages.
Please create pull requests instead of asking for help on Homebrew's
GitHub, Discourse, Twitter or IRC. As you are running this old version,
you are responsible for resolving any issues you experience.

Warning: Broken symlinks were found. Remove them with `brew prune`:
  /usr/local/lib/libpng.la

To help us debug your issue, please explain:

  • What you were trying to do (and why:)

         Upgrade my local, built-from-source copy of 'libpng' from v1.6.35 to v1.6.36 in the course of going through my normal routine of keeping all of my software tools up to date.

  • What happened (include command output:)

         Homebrew initially appeared to have succeeded in upgrading 'libpng' from v1.6.35 to v1.6.36. My logs are:

    • here (for a run with HOMEBREW_BUILD_FROM_SOURCE=1 set.)
    • here (for a run with HOMEBREW_BUILD_FROM_SOURCE left unset.)

    In both cases, both running 'brew doctor' and inspecting the installed package's contents later revealed that one of the symbolic links resulting from its installation was broken. 'brew doctor' output appeared as included above, and manual inspection proceeded as follows:

    …:~ …$ file /usr/local/lib/libpng.la
    /usr/local/lib/libpng.la: broken symbolic link to ../Cellar/libpng/1.6.36/lib/libpng.la
    
  • What you expected to happen:

         For Homebrew to successfully build the new version of 'libpng' from source and install it in the old version's place without leaving any broken symbolic links behind, as was the case with previous versions of the package.

  • Step-by-step reproduction instructions (by running brew commands:)

         Regardless of whether 'HOMEBREW_BUILD_FROM_SOURCE' is set or not:

    1. Run either:

      brew upgrade -vd --build-from-source libpng
      

      or:

      brew reinstall -vd --build-from-source libpng
      

      or:

      brew uninstall -vd --ignore-dependencies libpng
      brew install -vd --build-from-source libpng

    2. Run:

      brew doctor
      file /usr/local/lib/libpng.la


outdated

All 14 comments

Hi, Bryce. Homebrew usually removes all .la files. Here's the code:
https://github.com/Homebrew/brew/blob/a2b4d4aac294ec0872cd84d44f65bd5bd507e166/Library/Homebrew/cleaner.rb#L93-L94
Can you please report the output of…

brew doctor
brew prune
brew doctor
brew reinstall libpng
brew doctor

@sjackman:

     Interesting. Here's the result of running those commands as an attachment to this reply.

Seems like there is a bug here. I'm not able to reproduce it myself though. When I run brew install -s libpng, I don't see this line, which you do see in your log.

ln -s ../Cellar/libpng/1.6.36/lib/libpng.la libpng.la

The other 18 ln -s are identical.

I see in both your and my log

==> Cleaning
rm /usr/local/opt/libpng/lib/libpng16.la

So that code that I linked to above is removing the file libpng16.la. I'm guessing that libpng.la is a symlink, which is why it's not being removed by that same code. Once libpng16.la is removed though it'll be a dangling symlink, and so should probably be removed for that reason. As far as I can tell though, there is no code to remove dangling symlinks (edit: other than brew prune).

@sjackman:

     Indeed:

Bryces-HD-1-TB:~ zadmin$ ls -@aHhlO /usr/local/opt/libpng/lib/ | grep "libpng.la"
lrwxr-xr-x   1 zadmin  wheel  -   11B Dec 20 23:41 libpng.la -> libpng16.la
Bryces-HD-1-TB:~ zadmin$ file /usr/local/opt/libpng/lib/libpng.la
/usr/local/opt/libpng/lib/libpng.la: broken symbolic link to libpng16.la
Bryces-HD-1-TB:~ zadmin$ file /usr/local/opt/libpng/lib/libpng16.la
/usr/local/opt/libpng/lib/libpng16.la: cannot open `/usr/local/opt/libpng/lib/libpng16.la' (No such file or directory)
Bryces-HD-1-TB:~ zadmin$ file /usr/local/Cellar/libpng/1.6.36/lib/libpng.la
/usr/local/Cellar/libpng/1.6.36/lib/libpng.la: broken symbolic link to libpng16.la
Bryces-HD-1-TB:~ zadmin$ file /usr/local/Cellar/libpng/1.6.36/lib/libpng16.la
/usr/local/Cellar/libpng/1.6.36/lib/libpng16.la: cannot open `/usr/local/Cellar/libpng/1.6.36/lib/libpng16.la' (No such file or directory)

Here's something curious, though:

Bryces-HD-1-TB:~ zadmin$ ls -@aHhlO /usr/local/opt/libpng/lib/
total 888
drwxr-xr-x+  9 zadmin  wheel  -  306B Dec 20 23:42 .
drwxr-xr-x+ 13 zadmin  wheel  -  442B Dec 20 23:42 ..
lrwxr-xr-x   1 zadmin  wheel  -   10B Dec 20 23:41 libpng.a -> libpng16.a
lrwxr-xr-x   1 zadmin  wheel  -   14B Dec 20 23:41 libpng.dylib -> libpng16.dylib
lrwxr-xr-x   1 zadmin  wheel  -   11B Dec 20 23:41 libpng.la -> libpng16.la
-r--r--r--+  1 zadmin  wheel  -  173K Dec 20 23:42 libpng16.16.dylib
-r--r--r--+  1 zadmin  wheel  -  251K Dec 20 23:41 libpng16.a
lrwxr-xr-x   1 zadmin  wheel  -   17B Dec 20 23:41 libpng16.dylib -> libpng16.16.dylib
drwxr-xr-x+  4 zadmin  wheel  -  136B Dec 20 23:41 pkgconfig
Bryces-HD-1-TB:~ zadmin$ ls -@aHhlO /usr/local/Cellar/libpng/1.6.36/lib/
total 888
drwxr-xr-x+  9 zadmin  wheel  -  306B Dec 20 23:42 .
drwxr-xr-x+ 13 zadmin  wheel  -  442B Dec 20 23:42 ..
lrwxr-xr-x   1 zadmin  wheel  -   10B Dec 20 23:41 libpng.a -> libpng16.a
lrwxr-xr-x   1 zadmin  wheel  -   14B Dec 20 23:41 libpng.dylib -> libpng16.dylib
lrwxr-xr-x   1 zadmin  wheel  -   11B Dec 20 23:41 libpng.la -> libpng16.la
-r--r--r--+  1 zadmin  wheel  -  173K Dec 20 23:42 libpng16.16.dylib
-r--r--r--+  1 zadmin  wheel  -  251K Dec 20 23:41 libpng16.a
lrwxr-xr-x   1 zadmin  wheel  -   17B Dec 20 23:41 libpng16.dylib -> libpng16.16.dylib
drwxr-xr-x+  4 zadmin  wheel  -  136B Dec 20 23:41 pkgconfig

/usr/local/opt/libpng is a symlink to /usr/local/Cellar/libpng/1.6.36.
libpng.la is the dangling symlink, pointing to libpng16.la.

     đź¤¦â€Ťâ™‚ď¸Ź. Never mind, then; that was a momentary think-o; of _course_ it's the parent folder that's the symlink… (_Shakes it off._)

Addendum: It's still odd that the filesystem indicates that the link shouldn't be dangling, though… Never mind _that_, either; I'm seeing things that aren't there… (_Shakes it off some more._)

@sjackman:

     'brew doctor' isn't reporting this issue any more as of either Homebrew v1.9.0 or v1.9.1, likely due to how 'brew cleanup' has now superseded 'brew prune,' but I've verified that it still exists.

Sorry, we don't support building from source on request or your version of macOS.

@MikeMcQuaid:

     Consider:

  1. @sjackman confirmed that this issue is valid on a newer release of OS X/macOS that's still supported by both you and Apple.
  2. This issue is, additionally, with the final installed build results, which should be identical to what's poured from a pre-built bottle; I therefore think it still applies.
  3. Finally, I filed this issue prior to the official in–pull-request verdict carried by a tagged release that Homebrew was deprecating building from source.

I thought @sjackman could have been implying slightly by his knowledge of the logic involved that he might follow up with a quick drive-by fix, but I'll submit a PR myself if you'd like. I recall that you generally prefer this.

@RandomDSdevel If you can reproduce it by pouring a bottle I can reopen this.

@MikeMcQuaid:

     After building an El Capitan bottle locally to do so, I can no logner reproduce my issue with said bottle:

Bryces-HD-1-TB:~ zadmin$ HOMEBREW_BUILD_FROM_SOURCE=1 brew install -vd --build-from-source --build-bottle libpng
â‹®
Bryces-HD-1-TB:~ zadmin$ brew postinstall -vd libpng
â‹®
Bryces-HD-1-TB:~ zadmin$ ls -@aHhlO /usr/local/opt/libpng/lib/ | grep "libpng.la"
Bryces-HD-1-TB:~ zadmin$ file /usr/local/opt/libpng/lib/libpng.la
/usr/local/opt/libpng/lib/libpng.la: cannot open `/usr/local/opt/libpng/lib/libpng.la' (No such file or directory)
Bryces-HD-1-TB:~ zadmin$ file /usr/local/opt/libpng/lib/libpng16.la
/usr/local/opt/libpng/lib/libpng16.la: cannot open `/usr/local/opt/libpng/lib/libpng16.la' (No such file or directory)

After restoring my previous, from-source install, however, I found that my issue still persists with it:

ryces-HD-1-TB:~ zadmin$ ls -@aHhlO /usr/local/opt/libpng/lib/ | grep "libpng.la"
lrwxr-xr-x   1 zadmin  staff  -   11B Dec 20 23:41 libpng.la -> libpng16.la
Bryces-HD-1-TB:~ zadmin$ file /usr/local/opt/libpng/lib/libpng.la
/usr/local/opt/libpng/lib/libpng.la: broken symbolic link to libpng16.la
Bryces-HD-1-TB:~ zadmin$ file /usr/local/opt/libpng/lib/libpng16.la
/usr/local/opt/libpng/lib/libpng16.la: cannot open `/usr/local/opt/libpng/lib/libpng16.la' (No such file or directory)

This is surprising. I wonder what about directly building from source and building and pouring a bottle are different when cleaning build results; I'd expect the results to be identical. Where in brew's source would this be handled so I can take a look? Somewhere in 'install.rb,' right?

This is surprising. I wonder what about directly building from source and building and pouring a bottle are different when cleaning build results; I'd expect the results to be identical. Where in brew's source would this be handled so I can take a look? Somewhere in 'install.rb,' right?

Not to me, I'm afraid. Building from source is affected by many individual differences on any given user's machine (despite our best efforts to neutralise them). This is why we've found it untenable to support.

I can't really given specific points on where to look at an issue like this, sorry.

Quoting from https://github.com/Homebrew/homebrew-core/issues/35269#issuecomment-449270556

So that code that I linked to above is removing the file libpng16.la. I'm guessing that libpng.la is a symlink, which is why it's not being removed by that same code. Once libpng16.la is removed though it'll be a dangling symlink, and so should probably be removed for that reason. As far as I can tell though, there is no code to remove dangling symlinks (edit: other than brew prune).

https://github.com/Homebrew/brew/blob/a2b4d4aac294ec0872cd84d44f65bd5bd507e166/Library/Homebrew/cleaner.rb#L93-L94

@sjackman:

Quoting from #35269 (comment)

So that code that I linked to above is removing the file libpng16.la. I'm guessing that libpng.la is a symlink, which is why it's not being removed by that same code. Once libpng16.la is removed though it'll be a dangling symlink, and so should probably be removed for that reason. As far as I can tell though, there is no code to remove dangling symlinks (edit: other than brew prune).

https://github.com/Homebrew/brew/blob/a2b4d4aac294ec0872cd84d44f65bd5bd507e166/Library/Homebrew/cleaner.rb#L93-L94

     Which is why I'm fixing that in Homebrew/brew#5633. (Apologies for not doing this first instead of trying unsuccessfully to figure out how the bottle-related code differed…; egads, sometimes I'm dense.)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jakepetroules picture jakepetroules  Â·  3Comments

tglawless picture tglawless  Â·  3Comments

xeoneux picture xeoneux  Â·  3Comments

ghost picture ghost  Â·  3Comments

sstadick picture sstadick  Â·  4Comments