22

I'm trying to run a java version of PowerLoom, but when I try to start it in the terminal, I get the following error message:

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /usr/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5

This seems like a very similar problem to this question, except that the answers are specific to MAMP/Cacti. Any tips on how to deal with this, or even what this error message really means?

Community
  • 1
  • 1
LeahNH
  • 535
  • 1
  • 4
  • 12

5 Answers5

50

If using Qt Creator, you have to uncheck the Add build library search path to DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH option from the Run section in the Projects tab:

qtcreator

Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113
12

You could try this in shell:

$ cd /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources

$ sudo ln -sf libJPEG.dylib /usr/local/lib/libJPEG.dylib

$ sudo ln -sf libPng.dylib /usr/local/lib/libPng.dylib

$ sudo ln -sf libTIFF.dylib /usr/local/lib/libTIFF.dylib

$ sudo ln -sf libGIF.dylib /usr/local/lib/libGIF.dylib
hpm
  • 1,202
  • 13
  • 34
user9639510
  • 137
  • 1
  • 4
11

This issue may be down to the application in question dynamically linking to the wrong version of the [libJPEG.dylib] library (it's also possible the correct version has been overwritten/modified). As explained in another question it is a problem that can occur when an application alters environment variables that control dynamic linking library location (e.g. On MacOS: DYLD_LIBRARY_PATH - more info see man dyld; On Linux: LD_LIBRARY_PATH - see man ld.so). It may be down to other factors such as dynamic link library config files but they have a system wide affect. You'll need to locate the variable setup in the application files and change it so that it prioritises the system paths e.g. (for MacOS):

export DYLD_LIBRARY_PATH=/usr/lib/:ADDITION_LIBRARY_PATH_LOCATION
Pierz
  • 7,064
  • 52
  • 59
  • 2
    This doesn't seem to address the issue. – wickund Jan 25 '17 at 18:33
  • 1
    Why's that - could you not locate the setting DYLD_LIBRARY_PATH? The setting of that variable certainly can be a factor that causes the problem as I experienced it myself - and this fixed it. Or if you think it's down to another factor then add another answer to the question. – Pierz Jan 25 '17 at 18:43
  • I have a situation here where DYLD_LIBRARY_PATH is not set, yet I see the same issue. In my case I want to compile something with cargo (`cargo install svgbob_cli`) Linking into /usr/local/lib (as outlined below) works. – radiospiel May 09 '19 at 07:06
  • I've expanded my answer a bit to include info on MacOS and Linux info regarding dynamic linking setup/config - there's quite a few other options mentioned in the man pages that might help with your issue. – Pierz May 09 '19 at 10:07
8

You likely have HomeBrew installed (or something like it). Something is setting DYLD_LIBRARY_PATH to /usr/local/lib first and you get a collision with Jpeg installed in /usr/local/lib/libJPEG.dylib instead of using the system version.

The (wrongly demoted) answer given by @Pierz above is correct.

Antediluvian
  • 149
  • 1
  • 6
1

In my case the problem was caused by having set DYLD_LIBRARY_PATH to help a program find a missing library. The path I set also contained libjpeg, which was a different version from the system version that the program was expecting.

The solution was to set DYLD_FALLBACK_LIBRARY_PATH instead, so that the library path was only used for things that couldn’t be found otherwise, not to override system libraries.

andrewdotn
  • 32,721
  • 10
  • 101
  • 130