Skip to content

Instantly share code, notes, and snippets.

@newdigate
Last active January 27, 2024 13:50
Show Gist options
  • Save newdigate/8418a30039b9c1c849a1a20db2de81dc to your computer and use it in GitHub Desktop.
Save newdigate/8418a30039b9c1c849a1a20db2de81dc to your computer and use it in GitHub Desktop.
Xcode 15 Fucks your /usr/local/lib dynamic library loading
install_name_tool -id /usr/local/lib/libpact_ffi.dylib /usr/local/lib/libpact_ffi.dylib

from pact-go-issue

I was able to resolve it locally by:

  • either ensure DYLD_FALLBACK_LIBRARY_PATH is set to /usr/local/lib - tricky to do for go test, since it requires using -exec flag, as described here - https://forum.golangbridge.org/t/go-test-with-cgo-on-macos-and-dyld-library-path/32274/2
  • or calling install_name_tool -id /usr/local/lib/libpact_ffi.dylib /usr/local/lib/libpact_ffi.dylib - now when linking to this lib, the resulting binary would link to a full path, rather than just the file name, removing the need to search in fallback dir

environment variables useful for dynamic library loading LD_LIBRARY_PATH=/usr/local/lib; DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib:/usr/lib; DYLD_PRINT_SEARCHING=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment