Opened 14 years ago

Closed 14 years ago

#25842 closed defect (invalid)

ddd DYLD_LIBRARY_PATH conflict

Reported by: essandess (Steve Smith) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 1.9.1
Keywords: Cc:
Port: ddd

Description

The latest version of ddd [GNU DDD 3.3.12 (i386-apple-darwin10.3.0)] appears to have a conflict with other applications that use the DYLD_LIBRARY_PATH environment variable, especially Matlab. This results in a conflict over finding the correct libpng12.0.dylib dynamic library.

Here's a few commands that illustrate the issue:

This works:

% unsetenv DYLD_LIBRARY_PATH
% ddd /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/MATLAB

This doesn't work:

% setenv DYLD_LIBRARY_PATH /Applications/MATLAB_R2010a.app/sys/os/maci64:/Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS:/opt/local/lib
% ddd /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/MATLAB        dyld: Library not loaded: /opt/local/lib/libpng12.0.dylib
  Referenced from: /opt/local/bin/ddd
  Reason: Incompatible library version: ddd requires version 44.0.0 or later, but libpng12.0.dylib provides version 40.0.0
Trace/BPT trap

(This an abbreviated DYLD_LIBRARY_PATH set by Matlab before it starts, with /opt/local/lib appended to the end.)

Also FYI, Matlab's libpng12.0 has an old version (40.0.0):

% otool -L /Applications/MATLAB_R2010a.app/bin/maci64/libpng12.0.dylib
/Applications/MATLAB_R2010a.app/bin/maci64/libpng12.0.dylib:
    @loader_path/libpng12.0.dylib (compatibility version 40.0.0, current version 40.0.0)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.0.0)

Macport's libpng12.0.dylib has the latest version (45.0.0):

% otool -L /opt/local/lib/libpng12.0.dylib
/opt/local/lib/libpng12.0.dylib:
    /opt/local/lib/libpng12.0.dylib (compatibility version 45.0.0, current version 45.0.0)
    /opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

I looked in the ddd executable and it points to the dynamic library /opt/local/lib/libpng12.0.dylib explicitly.

Why should setting DYLD_LIBRARY_PATH cause ddd to fail? How does one deconflict ddd so that it works with applications like Matlab that use DYLD_LIBRARY_PATH?

Change History (2)

comment:1 Changed 14 years ago by essandess (Steve Smith)

More details. This is curious: adding the path /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS [a symbolic link to ../../] is what breaks functionality.

This works:

% setenv DYLD_LIBRARY_PATH /Applications/MATLAB_R2010a.app/sys/os/maci64:/opt/local/lib
% ddd /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/MATLAB

This doesn't work:

% setenv DYLD_LIBRARY_PATH /Applications/MATLAB_R2010a.app/sys/os/maci64:/Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS:/opt/local/lib
% ddd /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/MATLABdyld: Library not loaded: /opt/local/lib/libpng12.0.dylib
  Referenced from: /opt/local/bin/ddd
  Reason: Incompatible library version: ddd requires version 44.0.0 or later, but libpng12.0.dylib provides version 40.0.0
Trace/BPT trap

But the director /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS is simply a symbolic link to the first directory in DYLD_LIBRARY_PATH, /Applications/MATLAB_R2010a.app/sys/os/maci64:

% ls -l /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS
lrwxr-xr-x  1 admin  admin  6 Apr  1 14:56 /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS@ -> ../../

And the conflicted dynamic library is, of course, the same in both these directories:

% ls -i /Applications/MATLAB_R2010a.app/bin/maci64/libpng12.0.dylib /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/libpng12.0.dylib
30245226 /Applications/MATLAB_R2010a.app/bin/maci64/MATLAB.app/Contents/MacOS/libpng12.0.dylib*
30245226 /Applications/MATLAB_R2010a.app/bin/maci64/libpng12.0.dylib*

Why should adding this symbolically linked directory to DYLD_LIBRARY_PATH cause ddd to fail?

comment:2 Changed 14 years ago by jmroot (Joshua Root)

Resolution: invalid
Status: newclosed

DYLD_LIBRARY_PATH appears to be working as described in the dyld man page. There's really not much advice that can be given here apart from "don't set DYLD_LIBRARY_PATH". Anything that doesn't work without it set is linked incorrectly.

Note: See TracTickets for help on using tickets.