1

I've got an external lib 'libspecial.dylib' with following dependencies.

otool -L libspecial.dylib                                                                                                                          [11:20:59]
libspecial.dylib:
     @rpath/libspecial.dylib (compatibility version 1.0.0, current version 1.0.1)
     @rpath/libhelper.dylib  (compatibility version 1.0.0, current version 1.0.1)

Because @rpath causes problems I have a script replacing all @rpath with the real path.

install_name_tool -change @rpath/libspecial.dylib /tmp/libspecial.dylib libspecial.dylib
install_name_tool -change @rpath/libhelper.dylib  /tmp/libhelper.dylib  libspecial.dylib

But this only replaces the second dependency (in fact there are more dependencies, all are replaced but not the first one which points to the lib itself):

otool -L libspecial.dylib
libspecial.dylib:
     @rpath/libspecial.dylib (compatibility version 1.0.0, current version 1.0.1)
     /tmp/libhelper.dylib    (compatibility version 1.0.0, current version 1.0.1)

I have no idea why I can't change the first depencdency. Any ideas?

Running on OSX 10.11.1

Marcel
  • 4,054
  • 5
  • 36
  • 50
  • The first reference is a reference the the library itself, so I wouldn't expect you can change that. However, I would not expect it to have @rpath/ at the beginning either. All the dylibs I've seen start with their own name. Can you set it to just libspecial.dylib? – TheDarkKnight Nov 24 '15 at 11:28
  • You're right, in the last version of this library the reference to itself was without @rpath and everything worked fine. But sadly I'm not able to change it, not to /tmp/libspecial.dylib and not to libspecial.dylib. – Marcel Nov 24 '15 at 12:08
  • Doesn't that just affect the default load path when the binary links with it? I don't *think* it matters at runtime. – trojanfoe Nov 24 '15 at 12:40

1 Answers1

1

Ok, I realized that the first "dependency" isn't a dependency as such, it is more the name of the lib. I can also see it when using

otool -D libspecial.dylib
    @rpath/libspecial.dylib

So the command was just wrong. It can be fixed with

install_name_tool -id libspecial.dylib libspecial.dylib
Marcel
  • 4,054
  • 5
  • 36
  • 50