Tesseract Incompatible lib libpng16.16.dylib brew - macos

dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
Referenced from: /usr/local/opt/leptonica/lib/liblept.5.dylib
Reason: Incompatible library version: liblept.5.dylib requires version 54.0.0 or later, but libpng16.16.dylib provides version 29.0.0
Abort trap: 6
Have tried brew reinstall and upgrade, and tesseract reinstall, leptonica reinstall, deleted cache, deleted libs forcing new to be downloaded, nothing works. Not sure if this is a brew problem or leptonica, or the libpng thing. Is this a High Sierra gotcha? High Sierra libpng not compatible with whatever leptonica the same brew is installing? In which case that is brew's fault. Mac Port install leaves same error.
Something similar here, but no solution, note date is 2016 http://eeko-amaryllis.hatenablog.com/entry/2016/07/28/181303

google "liblept.5.dylib requires version" in quotes
gives you three results, the first being the above query, but the second is "Calling external command tesseract resulted in old version of ... " https://fr.mathworks.com/matlabcentral/answers/313225-calling-external-command-tesseract-resulted-in-old-version-of-tesseract-being-executed
the answer there refers to DYLD_LIBRARY_PATH
from terminal window
echo $DYLD_LIBRARY_PATH
/Applications/GIMP.app/Contents/Resources/lib:/Users/your_name_here/Downloads/magic/ImageMagick-7.0.7/lib/
You can check the libs for the offending older version of the dyld, but I knew I hadn't updated GIMP in a while and it wouldn't be surprising to find it used an imaging library. I did confirm by looking at that lib directory the lib was there, updated GIMP, checked ImageMagic wasn't using same lib, and still had to remove the DYD_LIBRARY_PATH reference as new GIMP didn't update it.

Related

libpng not linked on Mac OSX 10.9.2

I installed matrix2png on my Mac and had used it without problem before last week when I installed another image manipulating tool "circos". Circos requires me to install a different version of libpng, and I did. After that, I am no longer able to run matrix2png, which gives me the following error. I think the old ligpnb is not linked any more. Does anyone know how to fix this error? - appreciate your help.
dyld: Library not loaded: /usr/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/matrix2png
Reason: image not found
Those step solve my problem:
brew versions libpng
You will see some versions of libpng, but unfortunately not 1.5.15, so next you should install 1.5.18.
git checkout 7bec702 Library/Formula/libpng.rb
brew install libpng
You'll will find version 1.5.18 and some another versions.
ln -s /usr/local/Cellar/libpng/1.5.18/lib/libpng15.15.dylib /usr/local/lib/libpng15.15.dylib`
See https://github.com/Homebrew/homebrew-php/issues/1055
Some more info on installing certain versions of brew formulas can be found at https://coderwall.com/p/lqphzg.
Your new version of libpng has probably changed the name of its dyld files. This often happens with upgrades (especially following a major release). To verify this, open up the terminal and type:
ls /usr/local/lib/libpng*
What do you see?
From your error message we know that matrix2png is looking for libpng15 but if you've upgraded when instaling circos then you may now have libpng16 on your system. Consequently matrix2png won't be able to find the files that it's looking for and will be unhappy.
Fixing it this time:
Try re-installing matrix2png and see whether it notices the dependency issues and fixes it for you. You don't really want to downgrade libpng nor do you want to have two versions of it on your system, so having an up-to-date version of matrix2png would be good.
It looks like matrix2png comes from C source code, so you'll want to rebuild it. Download the source code or and then open a terminal. Navigate to the folder with the source code and run configure and then make. Configure will generate a Makefile for your system, and then make will use that file to generate a new binary. I've tested this on my Mac (with libpng16), and found that matrix2png built without any errors.
Suggested future approach:
To prevent future linking problems, you may want to use a package manager like homebrew or macports. In case you're using (or want to use) homebrew, it has circos and lib2png (but not matrix2png, sorry!). Once brew is installed, type the following into the terminal:
brew install libpng
And it should detect linking issues / version conflicts and guide you through fixing them. Brew places all of it's files in a 'cellar' location in /usr/local/Cellar and then symbolically links them into your system.
In case you're already using brew, try brew doctor and follow the instructions to resolve problems.
My experience (I've been dealing with a lot of version conflicts in the past few weeks) is that package managers make life much easier. Occasionally I've had to remove and reinstall packages to fix version issues, but in general brew keeps things neat and working.

Xcode looks for wrong OpenCV lib name: 2.4.dylib instead of 2.4.5.dylib

This issue appeared after an upgrade from Mountain Lion to Mavericks, with no code changes in between.
I have installed OpenCV 2.4.5 using Homebrew. This isn't the latest version of OpenCV, but I have not upgraded because I had incompatibility issues when I tried before. I have a project in Xcode that built fine pre-Mavericks, but seemed to be unable to find Homebrew's opencv build after the upgrade.
The Xcode project's Header Search Paths have:
/usr/local/Cellar/opencv/2.4.5/include
and the Library Search Paths have:
/usr/local/Cellar/opencv/2.4.5/lib
The project builds fine. When I try to run it, I get:
dyld: Library not loaded: lib/libopencv_video.2.4.dylib
Referenced from: <executable path>
Reason: image not found
/usr/local/Cellar/opencv/2.4.5/lib has the file libopencv_video.2.4.5.dylib in it. It does have an alias libopencv_video.2.4.dylib, which points to libopencv_video.2.4.5.dylib. In the "Build Phases" of my target, under the heading "Link Binary with Libraries", I have libopencv_video.2.4.5.dylib
How can I get Xcode to link with the correct library?
Note:
I have already tried the solution here.
It appears I may be able to do the same thing as here, but that looks super-clumsy.
Appears to be resolved by uninstalling and re-installing the opencv formula through homebrew

Tesseract and dylib on OSX Mountain Lion

I just installed imagemagick and tesseract through brew, everything went well. When I try tesseract -l eng decrypted.png output, though, I get the following error:
dyld: Library not loaded: /opt/local/lib/libpng15.15.dylib
Referenced from: /usr/local/bin/tesseract
Reason: Incompatible library version: tesseract requires version 32.0.0 or later, but libpng15.15.dylib provides version 29.0.0
Trace/BPT trap: 5
I searched everywhere but I couldn't find any place where it is explained how to update that dynamic library to version 32 (or higher). Any suggestions? Thanks!
Done by cleaning my installation of both the softwares and re-installing them through brew. Mind that if there is some linking problem, you have to execute brew link --overwrite tesseract to solve them.

dyld: Symbol not found: _jpeg_resync_to_restart

I'm trying to run a simple OpenGL tutorial for my class, but the C++ code was made to run for Windows and Linux. I'm trying to make it run under Mac OS X Mountain Lion.
I found the proper library headers, it now compiles OK (with scons), but the build gives this error when run:
dyld: Symbol not found: _jpeg_resync_to_restart
Referenced from: /usr/local/lib/libIL.1.dylib
Expected in: flat namespace
in /usr/local/lib/libIL.1.dylib
Trace/BPT trap: 5
Searching online gave me nothing but python imaging library problems. I have a libjpeg and DevIL installed through homebrew.
Judging from the Google searches, the built-in libjpeg library in Mac OS X has the
__cg_jpeg_resync_to_restart while if you use MacPorts, Fink, or maybe compile it yourself you get - _jpeg_resync_to_restart.
In this case the DevIL library, gotten through Homebrew was searching for the symbol not coming from the Mac OS X library, so I assumed that I should install libjpeg through homebrew. However it turns out that libjpeg was already installed through homebrew. So I guessed that maybe there were problems with the linking of libjpeg, I unlinked and linked again, and yes there were problems with the initial linking of the library.
However this did not seam to solve the problem. I again made the assumption that now that the libjpeg has symbolic links at the right places if I built the DevIL library again it will link against the proper library at the proper place. So I did a brew uninstall devil and then brew install devil which compiled with from source again. Aaand voila :)
It worked for me just changing the DYLD_LIBRARY_PATH to the correct path.

I messed up my terminal environment on Mac OS X and was wondering how to fix it

When I open a terminal window this is what I get immediately:
dyld: Library not loaded: /usr/lib/libiconv.2.dylib
Referenced from: /bin/bash
Reason: Incompatible library version: bash requires version 7.0.0 or later, but libiconv.2.dylib provides version 6.0.0
[Process completed]
You could try removing the files ~/.bash_profile, ~/.profile, ~/.bashrc, and ~/Library/Preferences/com.apple.Terminal.plist, if they exist, but most likely this is actually the problem as described by the error: libiconv got replaced with an older version. In this case, there are two methods to replace it: download the source code, build and install by ssh-ing into the computer, or reinstall the library from your installer DVD. If you choose to install from the DVD, I would suggest downloading Pacifist so that you can install just libiconv instead of the whole system (of course, there might be other files that need replacing too).

Resources