View Full Version : Why dynalib that I build expects dependency under @executable_path/../lib?

Nov 6, 2010, 10:52 AM
I am trying to build my shared library. It is dependent on another library /opt/local/xxx/lib/libxxx.dylib:
g++ -shared -fPIC -o libmy.dylib my.o -L/opt/local/xxx/lib -lxxx

But when I run otool -L libmy.dylib, I see this:
@executable_path/../lib/libxxx.dylib (compatibility version 0.0.0, current version 0.0.0)

Why gcc makes libmy.dylib to depend on nonexistent library under @executable_path/ even though it sees that libxxx.dylib is under /opt/local/?

How to make dependency path correct?