Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#36621 closed defect (invalid)

__cg_jpeg_resync_to_restart error on system open and edit commands

Reported by: cdeil (Christoph Deil) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: base Version: 2.1.2
Keywords: Cc:
Port:

Description

I am getting this error when trying to open a Finder Application window in the current working directory from the terminal after putting /opt/local/lib on the library path:

$ open .
$ export DYLD_LIBRARY_PATH=/opt/local/lib
$ open .
dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
  Expected in: /opt/local/lib/libJPEG.dylib
 in /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
Trace/BPT trap: 5

I have an astronomy library and command line tools that add /opt/local/lib to DYLD_LIBRARY_PATH in a setup script because it uses /opt/local/lib/libcfitsio.dylib . The problem (if I understand correctly) is that now /opt/local/lib/libJPEG.dylib shadows /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib and some system commands like open DIR or edit FILE give the error shown.

Is this a Macports bug?

If not, what is the correct alternative to setting DYLD_LIBRARY_PATH=/opt/local/lib for (non-Macports) libraries and command line tools that require Macports libraries to load?

Thanks for your help!

Change History (2)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Resolution: invalid
Status: newclosed

It's an error to set the DYLD_LIBRARY_PATH environment variable because it will cause problems like this. Any program that recommends you set this, or sets it itself, is built incorrectly and should be fixed. If that's not an option, usually the DYLD_FALLBACK_LIBRARY_PATH environment variable is a safer one to set.

In this specific case the fact that OS X's default filesystem is case-insensitive contributed to the problem. (The library the jpeg MacPorts port installs is libjpeg.dylib; the system library is libJPEG.dylib.) However, installing OS X on a case-sensitive filesystem usually comes with its own set of problems and I don't recommend it.

comment:2 Changed 12 years ago by cdeil (Christoph Deil)

Thanks for explaining! I have a follow-up question, if you have a short suggestion or link with further info to share, that would be very much appreciated.

The library in question is gammalib and there is a set of command line tools ctools built using gammalib. Both are C++ autotools projects with swig python bindings. I am a co-author and want to fix this issue and then add gammalib and ctools to Macports soon.

Can you give a suggestion what to do instead of setting DYLD_LIBRARY_PATH in a gammalib-init.sh the user executes before using the library / tools? Should all references to libraries in /opt/local/lib like cfitsio and readline be set as absolute references when building or installing gammalib and ctools? How do we do and check this?

Note: See TracTickets for help on using tickets.