Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#61634 closed defect (fixed)

talloc @2.3.1: wrong install name on Big Sur

Reported by: borwickatuw (John Borwick) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: bigsur Cc:
Port: talloc freeradius notmuch osmocore osmocore-devel py27-tsk

Description (last modified by borwickatuw (John Borwick))

Under Big Sur, I have seen this error on two different computers:

dyld: Library not loaded: /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_talloc/talloc/work/talloc-2.3.1/bin/default/libtalloc.dylib

This persists even after running:

sudo port clean notmuch
sudo rm -rf /opt/local/var/macports/build/*
sudo port install notmuch

Notably, macports seems to know there's an issue, because after sudo port install notmuch I get an error:

--->  Found 2 broken files, matching files to ports
--->  Found 1 broken port, determining rebuild order
You can always run 'port rev-upgrade' again to fix errors.
The following ports will be rebuilt: notmuch @0.31.2
Continue? [Y/n]: y

This creates a circular dependency I guess? Where notmuch has a linking error and it's somehow detected but it can't ever be resolved?

I was able to "fix" this on one of the computers but I'm not sure how. I have also tried to uninstall/reinstall talloc as well.

Change History (12)

comment:1 Changed 3 years ago by borwickatuw (John Borwick)

Description: modified (diff)

comment:2 Changed 3 years ago by borwickatuw (John Borwick)

Description: modified (diff)

comment:3 Changed 3 years ago by borwickatuw (John Borwick)

FWIW I ran otool(1) and notmuch is somehow linked to this incorrect path:

/opt/local/bin/notmuch:
	/opt/local/lib/libnotmuch.5.dylib (compatibility version 5.3.0, current version 5.3.0)
	/opt/local/lib/libgmime-3.0.0.dylib (compatibility version 207.0.0, current version 207.1.0)
	/opt/local/lib/libgio-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libgobject-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libglib-2.0.0.dylib (compatibility version 5801.0.0, current version 5801.3.0)
	/opt/local/lib/libintl.8.dylib (compatibility version 10.0.0, current version 10.5.0)
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.106.0)
	/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_talloc/talloc/work/talloc-2.3.1/bin/default/libtalloc.dylib (compatibility version 0.0.0, current version 0.0.0)
	/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
	/opt/local/lib/libxapian.30.dylib (compatibility version 41.0.0, current version 41.3.0)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 904.4.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)

comment:4 Changed 3 years ago by borwickatuw (John Borwick)

OK I did this as a workaround; notmuch now works but I'd love to know what went wrong in the building of notmuch and/or talloc that created this issue.

sudo install_name_tool -change /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_talloc/talloc/work/talloc-2.3.1/bin/default/libtalloc.dylib /opt/local/lib/libtalloc.dylib /opt/local/bin/notmuch
sudo install_name_tool -change /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_talloc/talloc/work/talloc-2.3.1/bin/default/libtalloc.dylib /opt/local/lib/libtalloc.dylib /opt/local/lib/libnotmuch.5.dylib 

comment:5 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Keywords: bigsur added
Port: talloc freeradius osmocore osmocore-devel py27-tsk added
Summary: notmuch @0.31.2 dyld linking issue with talloctalloc @2.3.1: wrong install name on Big Sur

Looking at the packages our build machine produced for talloc on Big Sur on x86_64, we can see its install name is wrong:

$ otool -L /tmp/talloc-2.3.1_0.darwin_20.x86_64/opt/local/lib/libtalloc.dylib
/tmp/talloc-2.3.1_0.darwin_20.x86_64/opt/local/lib/libtalloc.dylib:
	/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_devel_talloc/talloc/work/talloc-2.3.1/bin/default/libtalloc.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)

Compared to the one we built on Catalina where the install name is right:

$ otool -L /tmp/talloc-2.3.1_0.darwin_19.x86_64/opt/local/lib/libtalloc.dylib
/tmp/talloc-2.3.1_0.darwin_19.x86_64/opt/local/lib/libtalloc.dylib:
	/opt/local/lib/libtalloc.2.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1281.100.1)

We need to fix that, and since a library's install name gets baked into other software when other software links with it, we then need to revbump all of the ports that link with talloc: freeradius, notmuch, osmocore, osmocore-devel, py27-tsk

comment:6 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

The talloc build system apparently doesn't set the right install name but the portfile contains code that fixes it after the build:

post-destroot {
    system "install_name_tool -id ${prefix}/lib/libtalloc.${major}.dylib ${destroot}${prefix}/lib/libtalloc.${major}.dylib"
}

That code has been in the port for 8 years already so it's hard to see what could have failed there on macOS 11.

comment:7 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

I see it: On macOS 10.x, we produce one library (libtalloc.2.3.1.dylib) and a couple symlinks to it (libtalloc.2.dylib and libtalloc.dylib) and we fix the install name of the one and only library by addressing it via the libtalloc.2.dylib symlink.

But on macOS 11, for some reason, we are producing two libraries (libtalloc.2.3.1.dylib and libtalloc.2.dylib) and only one symlink (libtalloc.dylib). We are fixing the install name of the libtalloc.2.dylib library but not the libtalloc.2.3.1.dylib library which is a problem because due to the libtalloc.dylib symlink the libtalloc.2.3.1.dylib library is the one that other software will link against when it uses a flag like -ltalloc.

$ ls -l /tmp/talloc*/opt/local/lib/
/tmp/talloc-2.3.1_0.darwin_19.x86_64/opt/local/lib/:
total 96
-rwxr-xr-x@ 1 rschmidt  wheel  46764 Sep 10 09:16 libtalloc.2.3.1.dylib
lrwxr-xr-x@ 1 rschmidt  wheel     21 Sep 10 09:16 libtalloc.2.dylib -> libtalloc.2.3.1.dylib
lrwxr-xr-x@ 1 rschmidt  wheel     21 Sep 10 09:16 libtalloc.dylib -> libtalloc.2.3.1.dylib
drwxr-xr-x@ 3 rschmidt  wheel     96 Sep 10 09:16 pkgconfig

/tmp/talloc-2.3.1_0.darwin_20.x86_64/opt/local/lib/:
total 304
-rwxr-xr-x@ 1 rschmidt  wheel  75448 Nov 17 22:13 libtalloc.2.3.1.dylib
-rwxr-xr-x@ 1 rschmidt  wheel  75448 Nov 17 22:13 libtalloc.2.dylib
lrwxr-xr-x@ 1 rschmidt  wheel     21 Nov 17 22:13 libtalloc.dylib -> libtalloc.2.3.1.dylib
drwxr-xr-x@ 3 rschmidt  wheel     96 Nov 17 22:13 pkgconfig

comment:8 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

I couldn't find our talloc build log from x86_64 but here's the one from arm64 where we see the same problem:

https://build.macports.org/builders/ports-11_arm64-builder/builds/2017/steps/install-port/logs/stdio

comment:9 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Holy buckets, this is a bug in install_name_tool. If you invoke install_name_tool on a symlink, it replaces the symlink with a copy of the library while leaving the library that the symlink pointed to untouched. I'll report it to Apple.

comment:10 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Reported as feedback FB8915358

comment:11 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Resolution: fixed
Status: newclosed

In d04815130fc81c48a78f509b982f1e3d710f3efa/macports-ports (master):

talloc: Fix library install name on Big Sur

Work around broken install_name_tool on Xcode 12.2.

Closes: #61634

comment:12 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

In 7a02b9a6d4ed6f0804b370ad5f69450dc05dcdaf/macports-ports (master):

notmuch: Revbump for darwin 20 for talloc

See: #61634

Note: See TracTickets for help on using tickets.