0

How did adding /usr/lib/ to my DYLD_LIBRARY_PATH cause this dynamic linking problem on my MacOS Ventura M1 MBP?

I had set export DYLD_LIBRARY_PATH="...:/usr/lib:..." in my .bash_profile.

$ xz --version
dyld[52238]: Symbol not found: _lzma_cputhreads
  Referenced from: <2057FB51-46E1-3DB6-B2E8-DCB023BF98DC> /opt/homebrew/Cellar/xz/5.4.3/bin/xz
  Expected in:     <D0CF8623-5E85-35D2-8ABA-8A7F0002AB0A> /usr/lib/liblzma.5.dylib
Abort trap: 6
$ otool -L /opt/homebrew/Cellar/xz/5.4.3/bin/xz
/opt/homebrew/Cellar/xz/5.4.3/bin/xz:
    /opt/homebrew/Cellar/xz/5.4.3/lib/liblzma.5.dylib (compatibility version 10.0.0, current version 10.3.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1319.100.3)

Unsetting this variable fixed my immediate problem.

$ DYLD_LIBRARY_PATH="" xz --version
xz (XZ Utils) 5.4.3
liblzma 5.4.3

However, looking in /usr/lib, I cannot find why my system thinks there was a version of liblzma in /usr/lib at all.

$ ls /usr/lib | grep 'liblzma'
$ find /usr/lib -name '*liblzma*'
$

I could understand seeing these symptoms if there was a version of liblzma in that directory, but there does not appear to be. /usr/lib was neither the first nor the last path in that list, so I don't understand why the failure would manifest that way in particular. So why did having that directory on my DYLD_LIBRARY_PATH cause my system trying to link to a dylib in that directory, even though said dylib does not exist at that location?

5
  • Right now this reads more like the description of a solution to an unknown problem than an actual question. Can you edit this down to an actual question?
    – nohillside
    Commented Jun 29, 2023 at 13:05
  • Use the command which to see what library is in your path: which liblzma. Then you’ll know where it’s located…if it’s in your path
    – Allan
    Commented Jun 29, 2023 at 15:21
  • @Allan, thank you. There isn't any such executable or library on PATH, luckily. But also that means the problem is still open. Commented Jun 30, 2023 at 2:58
  • What was the full definition of DYLD_LIBRARY_PATH which triggered the error? Maybe the order of paths in there matter.
    – nohillside
    Commented Jun 30, 2023 at 8:07
  • Maybe. My definition was "$HOMEBREW_PREFIX/opt/sqlite/lib:/usr/lib:/Applications/azprolog.app/Contents/az_home/lib" I was confused and surprised that the failure was related to the path in the middle. Commented Jun 30, 2023 at 10:02

0

You must log in to answer this question.

Browse other questions tagged .