Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#57594 closed defect (fixed)

dyld error when enabling tests for tk +quartz

Reported by: chrstphrchvz (Christopher Chavez) Owned by: MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: Cc:
Port: tk

Description

Using Tk 8.6.8/8.6.9rc4 on macOS 10.14.1.

If I manually add test.run yes to the tk portfile under the +quartz variant, and run port -vt test tk +quartz, there is an error:

DYLD_LIBRARY_PATH="`pwd`:/opt/local/lib:${DYLD_LIBRARY_PATH}"; export DYLD_LIBRARY_PATH; … 
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

(full test log)

I'm guessing /opt/local/lib/libJPEG.dylib should instead be /opt/local/lib/libjpeg.dylib (note this is on a case-insensitive APFS volume).

There have been tickets for similar errors on other ports, and one common diagnosis is that ports shouldn't use/set DYLD_LIBRARY_PATH.

I'm inclined to think this is a MacPorts-specific issue but haven't ruled out it being an upstream issue.

I am unsure whether tests should be runnable for +quartz. My impression is they were left out of the portfile mainly because they can't be run for the +x11 variant (since port runs tests as the macports user, which can't access the X11 server).

Change History (5)

comment:1 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

This is a know issue.
DYLD_FALLBACK_LIBRARY_PATH should be used instead of DYLD_LIBRARY_PATH.

If we run otool -L /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO, we see that the library uses /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib.
When DYLD_LIBRARY_PATH is set to ${prefix}/lib, we force ImageIO to use ${prefix}/lib/libjpeg.dylib instead.
Th two libjpeg.dylibs have different symbols, hence the error.

DYLD_FALLBACK_LIBRARY_PATH goes looking for other libraries only if the requested one cannot be found.

This issue has cropped up from time to time.
tix and cargo are two I can think of off the top of my head.

Last edited 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez) (previous) (diff)

comment:2 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Resolution: fixed
Status: assignedclosed

comment:3 Changed 5 years ago by kencu (Ken)

There is a minor typo in that comment. You said:

When DYLD_FALLBACK_LIBRARY_PATH is set to ${prefix}/lib, we force ImageIO to use ${prefix}/lib/libjpeg.dylib instead.

but I think you meant:

When DYLD_LIBRARY_PATH is set to ${prefix}/lib, we force ImageIO to use ${prefix}/lib/libjpeg.dylib instead.

comment:4 Changed 5 years ago by kencu (Ken)

BTW - would this only show up on case-insensitive file systems? libjpeg vs libJPEG? Maybe that's why some people don't seem to see it.

comment:5 in reply to:  3 Changed 5 years ago by MarcusCalhoun-Lopez (Marcus Calhoun-Lopez)

Thank you for pointing this out.
I have made the edit.

Replying to kencu:

There is a minor typo in that comment. You said:

When DYLD_FALLBACK_LIBRARY_PATH is set to ${prefix}/lib, we force ImageIO to use ${prefix}/lib/libjpeg.dylib instead.

but I think you meant:

When DYLD_LIBRARY_PATH is set to ${prefix}/lib, we force ImageIO to use ${prefix}/lib/libjpeg.dylib instead.
Note: See TracTickets for help on using tickets.