Qt application throws "dyld: Symbol not found: __cg_jpeg_resync_to_restart"
Asked Answered
R

3

9

I get well known dyld issue on OS X.

Qt.pro file:

INCLUDEPATH += /usr/local/Cellar/libpng/1.6.23/include /usr/local/Cellar/jpeg/8d/include
LIBS += -L/usr/local/Cellar/libpng/1.6.23/lib -L/usr/local/Cellar/jpeg/8d/lib -ljpeg -lpng -ljpeg -lz

In runtime my application throws:

dyld: Symbol not found: __cg_jpeg_resync_to_restart Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib Expected in: /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib in /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

I already got this before and I fixed it using this answer, but now it occurs again and this advice not works. How can I solve this problem?

Rufus answered 30/6, 2016 at 18:45 Comment(0)
G
14

This is only a QtCreator runtime issue. DanyAlejandro's answer (above) is partially correct.

  1. Go to Projects -> Run -> "Run Environment" (show Details)
  2. I would not recommend Unset, rather you should edit Both: DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH
  3. Add /System/Library/Frameworks/ImageIO.framework/Resources: to the beginning for both paths (colon delimited string)
  4. Build project again - this will fix it for good
Goshen answered 30/6, 2017 at 16:48 Comment(1)
Fix my problem, TKS. I think this is system library link path priority issue? Cauz i may installed some other library along with different version of libjpeg by brew : )Skelton
G
7

In my case, this error would only happen in Qt Creator on OSX ElCapitan (Compiling my OpenCV programs with CLion or XCode in OSX would work without doing anything), so I don't think it's correct to say that a change in the system configuration is mandatory (like your link suggests).

What I did, was to link each library file one by one (linking the dylib files one by one, with their full path). This way, I didn't have to mess with my files or do any extra configuration. For example:

LIBS += "/usr/local/lib/libopencv_core.dylib"
LIBS += "/usr/local/lib/libopencv_highgui.dylib"

Provided such files exist.

Edit: Another way to fix this problem (which further proves that this is only Qt Creator related) is to go to Projects -> Run -> "Run Environment" (show Details), select DYLD_LIBRARY_PATH and click Unset. After this, your project should compile as expected.

Gradient answered 5/1, 2017 at 2:10 Comment(0)
S
3

This question provides a screen shot of finding the setting to change:

I was looking everywhere except the correct spot. I'll walk you through it. You can click the images for bigger versions.

Within Qt Creator, there's a toolbar along the left side of the window. Welcome, Edit, Design, etc. One of the choices is Projects. Select that tab.

The Projects Tab

From there, there's a new navigation area near the left. Under Build and Run, your Desktop, there's a Run section.

Projects Navigation Section

That goes to the run settings, and in almost the exact center of that page are the Run settings in a grey box, and one of the items is the checkbox to turn off.

Run Settings

Solvency answered 20/5, 2019 at 15:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.