dyld: Symbol not found: _jpeg_resync_to_restart - macos

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.

Related

Tesseract Incompatible lib libpng16.16.dylib brew

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.

cannot run gdb on mac's terminal even after codesign

I'm trying to install gdb on my Mac. I downloaded it with brew and code signed it according to the instructions on https://sourceware.org/gdb/wiki/BuildingOnDarwin
However, when I run gdb in the terminal, it still doesn't work and output the following error message:
dyld: Library not loaded: /usr/local/opt/mpfr/lib/libmpfr.6.dylib
Referenced from: /usr/local/bin/gdb
Reason: image not found
Trace/BPT trap: 5
Does anyone know what it means? My Mac version is 10.11.5, by the way
I ran into the same issue on macOS 10.11.6, I'm guessing (and this is just speculation; I don't actually know how Homebrew works) that Homebrew installed a pre-compiled version of gdb which depended on a library that existed on the machine it was compiled with, but did not exist on my machine.
At any rate, I was able to get a working version of gdb by downloading & unzipping version 7.12 (8.1 failed to compile on my machine) from http://ftp.gnu.org/gnu/gdb/gdb-7.12.tar.gz, then compiling & installing with (IIRC) the commands:
./configure
make
sudo make install
I blogged about this and the subsequent steps (getting the executable code-signed so that macOS would allow it to debug other processes, etc) here: http://prust.github.io/posts/2018-02-24-interactively-debugging-c-in-sublime-text-3.html
I get this problem too. And I find solution in https://qiita.com/yoshixj/items/698d94337ca447e9b9de
Since we don't have /usr/local/opt/mpfr/lib/libmpfr.6.dylib
we can simply install it. Use this command:
brew install gawk
echo 'export PATH="/usr/local/opt/gettext/bin:$PATH"' >> ~/.zshrc
I had the same error message when running gdb after installing it from Homebrew (gdb v8.1) on a Mac OS X El Capitan v10.11.6. However, installing it via Homebrew using its Python binary solved the issue:
brew install gdb --with-python
Beaware that this may take some time, since you'd be compiling gdb from scratch. After it's done, you still need to create a certificate and codesign gdb.

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.

Using IUP on Mac OS X

Are you guys suffered from this question when using IUP on MacOS?
Gizak-Pro:iup-3.6_MacOS107_bin Gizak$ ./iupview
dyld: Library not loaded: /sw/lib/fontconfig2/lib/libfontconfig.1.dylib
Referenced from: /Users/Gizak/Downloads/iup-3.6_MacOS107_bin/./iupview
Reason: image not found
Trace/BPT trap: 5
So..How to make it work? That would be very helpful!
OS:Mac OS X 10.7.5
install lua5.1 by port
IUP version:3.6
That application depends on some libraries that are not installed on your system.
In the IUP documentation you will be able to find a guide how to run IUP on MacOSX. The relevant section is in IUP / System / Drivers / GTK.
The binary you're using is linking to a path provided by Fink, check the README.md in the download directory of IUP sf project.
You could either:
install Fink and fullfill the dependencies
rewrite the dependency using install_name_tool
set DYLD_FALLBACK_LIBRARY_PATH to match dependencies installed by another source

Resources