After rebooting my dev machine, my Rust project stopped running on macOS. The error message is:
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
I have absolutely no idea what changed and caused this. The problem seems to be with my rig, not with the code, since it runs fine on a Docker container, and the older commits refuse to run on my computer. Another thing is that my project shouldn't be using any image-processing libraries. (And I don't know how to list transitive dynamic dependencies on macOS to check whether it really does.)
otool -L /System/Library/Frameworks/ImageIO.framework/Versions/A/ImageIO
reveals that ImageIO
links to /System/Library/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib (compatibility version 1.0.0, current version 1.0.0)
. That file exists indeed. /usr/local/lib/libjpeg.dylib
(My FS is case-insensitive) exists too, but it's a symlink to a homebrewed file ../Cellar/jpeg/8d/lib/libjpeg.dylib
, so clearly the system library shouldn't use that. However, I have not set LD_LIBRARY_PATH
or any other env var that – as far as I know – should coerce macOS to use /usr/local/lib
as a dylib search path.
So my questions are:
1) Is there a tool on macOS to check, which libraries in my project link (possibly transitively) to the ImageIO.framework
?
2) How are dylib search paths configured on macOS? Is there a tool to check which paths are searched and in which preference order? The problem itself might be due to some Homebrew problem, but I'd like to have the tools to diagnose and understand it.