Issue with libpng 1.6.27?


(Grahamj1978) #1

I just tried updating my brew installation and it choked when upgrading my opencv install. Any idea how to fix this? I seem to recall having run into this problem before, but don’t recall how/when it was dealt with.

To elaborate, I tracked it back to the updated libpng. Evidently it is making brew think I don’t have developer tools installed since as soon as I install it complains. Running ‘brew doctor’ tells me: Warning: No developer tools installed.
Install the Command Line Tools:
xcode-select --install

Of course, as soon as I remove it everything is fine. The problems is the new version of opencv requires it.

When I try to install opencv with libpng installed (rather than upgrade, since I uninstalled it when I started running into issues), I get the following message:
brew install opencv
==> Installing opencv from homebrew/science
dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
==> Downloading https://homebrew.bintray.com/bottles-science/opencv-2.4.13.2.sie
dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Error: Failed to download resource "opencv"
Download failed: https://homebrew.bintray.com/bottles-science/opencv-2.4.13.2.sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
Error: The following formula:
opencv
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:
xcode-select --install

dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO


(Mike McQuaid) #2

You need to run xcode-select --install.


(Grahamj1978) #3

Except I already have the command line tool installed and trying to install them again doesn’t work.

If I try doing it without libpng installed I get:
xcode-select: error: command line tools are already installed, use “Software Update” to install updates

Whereas if libpng is installed I get:
dyld: Symbol not found: __cg_png_create_info_struct
Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local/lib/libPng.dylib
in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Abort trap: 6

I should note that as of this morning libpng is now at version 1.6.28, however, the problem remains unchanged.


(Mike McQuaid) #4

What does brew doctor output? Sounds like you need to remove that broken libpng.


(Grahamj1978) #5

Brew doctor does warn about a couple of dyld variable I have set:
Warning: Setting DYLD_* vars can break dynamic linking.
Set variables:
DYLD_FALLBACK_LIBRARY_PATH: /Applications/Matlab2013a.app/bin/maci64:$
DYLD_LIBRARY_PATH: /usr/local/lib:/usr/local/cuda/lib:

The Matlab one is needed for my Matlab Python interface, however, I tried commenting out the mods to the DYLD_LIBRARY_PATH and that seems to fix the issue.

I don’t remember why I placed them at this point, but I suppose if needed I can toggle them back and forth when working with brew.