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