install_name_tool problem with symlinks on Xcode 12.2

Ryan Schmidt ryandesign at macports.org
Tue Nov 24 12:48:49 UTC 2020


Heads up! install_name_tool in Xcode 12.2 -- the version we are using for Big Sur -- has a bug that could affect ports. If you give install_name_tool a path to a symlink to a library, you might expect it to modify the library, and that's what it did in previous versions of Xcode. But in Xcode 12.2, it replaces the symlink with a modified copy of the library while leaving the original library untouched. This could cause ports to install libraries that have not been modified in the intended ways; this happened to talloc in https://trac.macports.org/ticket/61634 for example.

I've reported the bug to Apple as feedback FB8915358. Hopefully they'll get a fixed version out soon.

Please check your Portfiles for any calls to install_name_tool. If you're calling it on a symlink, use [file readlink] to get the name of the real library and call it on that instead, for example the way I fixed talloc in the ticket above.


More details:

Given a library and a symlink to it:

% ls -l libt*dylib
-rwxr-xr-x  1 rschmidt  wheel  75448 Nov 24 06:09 libtalloc.2.3.1.dylib
lrwxr-xr-x  1 rschmidt  wheel     21 Nov 24 06:09 libtalloc.dylib -> libtalloc.2.3.1.dylib

Use install_name_tool on the symlink:

% install_name_tool -id /opt/local/lib/libtalloc.2.dylib libtalloc.dylib

What happens on Catalina and earlier with Xcode 12.0 and earlier is what you would expect:

% ls -l libt*dylib
-rwxr-xr-x  1 rschmidt  wheel  75448 Nov 24 06:10 libtalloc.2.3.1.dylib
lrwxr-xr-x  1 rschmidt  wheel     21 Nov 24 06:09 libtalloc.dylib -> libtalloc.2.3.1.dylib

What happens on Big Sur with Xcode 12.2 is this:

% ls -l libt*dylib
-rwxr-xr-x  1 rschmidt  wheel  75448 Nov 24 06:09 libtalloc.2.3.1.dylib
-rwxr-xr-x  1 rschmidt  wheel  75448 Nov 24 06:10 libtalloc.dylib



More information about the macports-dev mailing list