Does "insall_name_tool -change" supports "~"

Hi, ALL,

WHat is the way to use "~" with the "install_name_tool -change" command?

Problem:

I'm using self-build library in my development. I build this library in my home directory and then successfully link it to my application. Then I make a script that copies all dylib that my application uses inside the Bundle and using "install_name_tool -change" command to relink them from new location.

The current commands look like this:

[code] cp -f /home/igorkorot/wxWidgets/buildC11/libwx-* "$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx-*"

install_name_tool -change "/Users/igorkorot/wxWidgets/buildC11/lib/libwx_" @executable_path/../Frameworks/libwx_"$TARGET_BUILD_DIR/$TARGET_NAME.app/Contents/Frameworks/libwx_*" [/code]

I'd like to remove the references to "/Users/igorkorot" and instead use "~" to reference a "home directory"

How can I do that?

Thank you.

Traditionally, the ~ character is expanded by your shell. So, if you run something like:

% install_name_tool -change foo ~/foo …

the ~ is expanded by the shall and install_name_tool bakes the path /Users/you/foo into the dynamic library. So, your question isn’t really about ~ or install_name_tool, but about whether the dynamic linker supports home-directory-relative references. And the answer to that is… It does not.

If you’re curious about what it does support, see the dyld man page.

As to what you should do about that, it kinda depends on what sort of product you’re creating. It looks like you’re building an GUI app. In that case the standard approach is:

  1. Make all your libraries rpath-relative.

  2. Place them in Contents/Frameworks.

  3. Add an rpath entry to the app that points in to Contents/Frameworks.

For more details, see Embedding nonstandard code structures in a bundle.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Does "insall_name_tool -change" supports "~"
 
 
Q