I was able to reproduce your issue with a quick test project. It was fixed when I appended a trailing slash to the LD_RUNPATH_SEARCH_PATH
build setting.
Instead of:
@executable_path
you should try
@executable_path/
The output from otool -l
now looks like this:
cmd LC_RPATH
cmdsize 32
path @executable_path/ (offset 12)
In general, you can check your toplevel executable (in this case "demux") with my dyld analyzer script at https://github.com/liyanage/macosx-shell-scripts/blob/master/checklibs.py
./checklibs.py demux
This tool attempts to faithfully reproduce dyld
's resolution logic. It can usually provide a hint about which references don't work, but in this case it doesn't catch the issue with the missing trailing slash. I will update it accordingly to match dyld
's behavior.