Why dynalib that I build expects dependency under @executable_path/../lib?

Discussion in 'Mac Programming' started by jerrry94087, Nov 6, 2010.

  1. jerrry94087 macrumors newbie

    Nov 6, 2010
    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?

Share This Page