Opened 2 years ago

Last modified 7 months ago

#57648 new defect

perl5 builds incompletely with clang-3.4, resulting in dyld: lazy symbol binding failed: Symbol not found: _perl_tsa_mutex_lock

Reported by: snunez1 (Steve Nunez) Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.5.4
Keywords: Cc: kencu (Ken), mojca (Mojca Miklavec), jmroot (Joshua Root), grumpybozo (Bill Cole)
Port: p5-io-socket-ssl

Description

This port, installed as a dependency for git, fails with:

:info:configure dyld: lazy symbol binding failed: Symbol not found: _perl_tsa_mutex_lock
:info:configure   Referenced from: /opt/local/lib/perl5/vendor_perl/5.26/darwin-thread-multi-2level/auto/Net/SSLeay/SSLeay.bundle
:info:configure   Expected in: flat namespace
:info:configure dyld: Symbol not found: _perl_tsa_mutex_lock
:info:configure   Referenced from: /opt/local/lib/perl5/vendor_perl/5.26/darwin-thread-multi-2level/auto/Net/SSLeay/SSLeay.bundle
:info:configure   Expected in: flat namespace
:info:configure sh: line 1: 72740 Trace/BPT trap          /opt/local/bin/perl5.26 Makefile.PL INSTALLDIRS=vendor CC="/opt/local/bin/clang-mp-3.9" LD="/opt/local/bin/clang-mp-3.9"

OS: 10.6.8 XCode 3.2 Upgraded to Clang 3.9

Attachments (1)

main.log (12.8 KB) - added by snunez1 (Steve Nunez) 2 years ago.
log from build

Download all attachments as: .zip

Change History (16)

Changed 2 years ago by snunez1 (Steve Nunez)

Attachment: main.log added

log from build

comment:1 Changed 2 years ago by mf2k (Frank Schima)

Keywords: perl SSLeay removed
Port: p5-io-socket-ssl added; p5.26-io-socket-ssl removed

comment:2 Changed 2 years ago by ryandesign (Ryan Schmidt)

See #54364 where this was reported before. As was the case there, you are using LibcxxOnOlderSystems, which may be related (the build may be neglecting to pass the necessary -stdlib=libc++ flag on).

comment:3 Changed 2 years ago by SerpentChris (Chris Calderon)

I've just run into this too, and I'm not sure how we are supposed to work around it. I tried building it again with the universal variant but it fails the same way. Do I need to uninstall perl entirely and rebuild with clang 3.9?

comment:4 Changed 15 months ago by ryandesign (Ryan Schmidt)

Cc: kencu added

Now that building with libc++ on older systems is the default as of MacPorts 2.6.0, we're seeing this type of failure with other perl ports on our buildbot, such as:

https://build.macports.org/builders/ports-10.6_x86_64-builder/builds/4120/steps/install-port/logs/stdio

Ken, any ideas?

comment:5 Changed 15 months ago by kencu (Ken)

The symbol is defined here <https://perl5.git.perl.org/perl.git/blob/a975eebad:/perl.h#l3192> and implemented here <https://perl5.git.perl.org/perl.git/blob/HEAD:/util.c#l6571>.

I see it is guarded by #ifdef PERL_TSA_ACTIVE so that might be relevant.

As to what that has to do with building on 10.6.8 with libc++, at this moment, I am not sure. I suppose the presence or absence of this symbol happens during the builld of perl and that's where we'd have to look for why it is or is not being included.

comment:6 Changed 15 months ago by kencu (Ken)

Hmm. I seem to be having no problem installing this. So - ?

$ port -v installed | grep io-socket-ssl
  p5.26-io-socket-ssl @2.66.0_0 (active) platform='darwin 10' archs='noarch' date='2019-03-07T09:02:11-0800'
  p5.28-io-socket-ssl @2.66.0_0 (active) platform='darwin 10' archs='noarch' date='2019-10-04T18:33:48-0700'
  p5.30-io-socket-ssl @2.66.0_0 (active) platform='darwin 10' archs='noarch' date='2019-10-31T15:37:11-0700'

comment:7 Changed 15 months ago by kencu (Ken)

and yet, for the one you linked to, I get the same error:

--->  Extracting DateTime-Locale-1.25.tar.gz
Executing:  cd "/opt/local/var/macports/build/_opt_macports-ports_perl_p5-datetime-locale/p5.30-datetime-locale/work" && /usr/bin/gzip -dc '/opt/local/var/macports/distfiles/perl5/DateTime-Locale-1.25.tar.gz' | /usr/bin/gnutar --no-same-owner -xf - 
--->  Configuring p5.30-datetime-locale
Executing:  cd "/opt/local/var/macports/build/_opt_macports-ports_perl_p5-datetime-locale/p5.30-datetime-locale/work/DateTime-Locale-1.25" && /opt/local/bin/perl5.30 Makefile.PL INSTALLDIRS=vendor CC="/opt/local/bin/clang-mp-9.0" LD="/opt/local/bin/clang-mp-9.0" 
dyld: lazy symbol binding failed: Symbol not found: _perl_tsa_mutex_lock
  Referenced from: /opt/local/lib/perl5/vendor_perl/5.30/darwin-thread-multi-2level/auto/Variable/Magic/Magic.bundle
  Expected in: flat namespace

dyld: Symbol not found: _perl_tsa_mutex_lock
  Referenced from: /opt/local/lib/perl5/vendor_perl/5.30/darwin-thread-multi-2level/auto/Variable/Magic/Magic.bundle
  Expected in: flat namespace

sh: line 1: 99437 Trace/BPT trap          /opt/local/bin/perl5.30 Makefile.PL INSTALLDIRS=vendor CC="/opt/local/bin/clang-mp-9.0" LD="/opt/local/bin/clang-mp-9.0"
Command failed:  cd "/opt/local/var/macports/build/_opt_macports-ports_perl_p5-datetime-locale/p5.30-datetime-locale/work/DateTime-Locale-1.25" && /opt/local/bin/perl5.30 Makefile.PL INSTALLDIRS=vendor CC="/opt/local/bin/clang-mp-9.0" LD="/opt/local/bin/clang-mp-9.0" 
Exit code: 133

comment:8 Changed 15 months ago by kencu (Ken)

If you configure the p5.30-variable-magic port, and then edit the Makefile to remove -undefined dynamic_lookup, and add in libperl.dylib instead then build it, you get:

LDDLFLAGS =  -mmacosx-version-min=10.6 -bundle /opt/local/lib/perl5/5.30/darwin-thread-multi-2level/CORE/libperl.dylib -L/opt/local/lib -Wl,-headerpad_max_install_names  -fstack-protector
/opt/local/bin/clang-mp-9.0  -mmacosx-version-min=10.6 -bundle /opt/local/lib/perl5/5.30/darwin-thread-multi-2level/CORE/libperl.dylib -L/opt/local/lib -Wl,-headerpad_max_install_names  -fstack-protector  Magic.o -arch x86_64 -Wl,-syslibroot,/ -o blib/arch/auto/Variable/Magic/Magic.bundle  \
	      \
	  
Undefined symbols for architecture x86_64:
  "_perl_tsa_mutex_lock", referenced from:
      _boot_Variable__Magic in Magic.o
      _XS_Variable__Magic_CLONE in Magic.o
      _XS_Variable__Magic__wizard in Magic.o
      _vmg_wizard_sv_free in Magic.o
      _vmg_wizard_sv_dup in Magic.o
      _xsh_teardown in Magic.o
      _xsh_teardown_late_simple_free in Magic.o
      ...
  "_perl_tsa_mutex_unlock", referenced from:
      _boot_Variable__Magic in Magic.o
      _XS_Variable__Magic_CLONE in Magic.o
      _XS_Variable__Magic__wizard in Magic.o
      _vmg_wizard_sv_free in Magic.o
      _vmg_wizard_sv_dup in Magic.o
      _xsh_teardown in Magic.o
      _xsh_teardown_late_simple_free in Magic.o
      ...
ld: symbol(s) not found for architecture x86_64
Last edited 15 months ago by kencu (Ken) (previous) (diff)

comment:9 Changed 15 months ago by kencu (Ken)

Sorted out. In <https://perl5.git.perl.org/perl5.git/blob/HEAD:/perl.h#l3038> the header checks for clang >= 3.6, and enables that macro only then. But on MacPorts, we're forcing perl to build with clang-3.4 for some reason on 10.6.8 (bootstrapping, no doubt), and so that test fails, and the #ifdef PERL_TSA_ACTIVE macro is disabled, ergo the symbol errors.

Building perl with a newer clang (I used clang-5.0) passes the tests, the symbol is enabled, and all is well:

$ port -v installed p5.30-datetime-locale
The following ports are currently installed:
  p5.30-datetime-locale @1.250.0_0 (active) platform='darwin 10' archs='x86_64' date='2019-10-31T17:02:29-0700'
Last edited 12 months ago by kencu (Ken) (previous) (diff)

comment:10 Changed 15 months ago by kencu (Ken)

Cc: mojca jmroot added
Summary: p5.26-io-socket-ssl fails to buildperl5 builds incompletely with clang-3.4, resulting in dyld: lazy symbol binding failed: Symbol not found: _perl_tsa_mutex_lock

comment:11 Changed 15 months ago by kencu (Ken)

Josh and Mojca, adding you in.

comment:12 Changed 12 months ago by grumpybozo (Bill Cole)

NOTE: This also affects p5-time-hires and almost certainly many other p5-* ports. The recent update to perl5.26 was built broken and packaged, causing breakage after installation of the new version.

A workaround for end-users is to force a local source build using a newer compiler, if one is already installed. e.g.:

      port -s upgrade perl5.26 configure.compiler=macports-clang-9.0

It seems to me that it would be best to remove the broken package(s) from the package server and provide some sort of public notice of the issue, since installing an updated Perl from MacPorts is hard to avoid and this issue gets reported by Perl as an error in add-on modules.

comment:13 Changed 12 months ago by grumpybozo (Bill Cole)

Cc: grumpybozo added

comment:14 Changed 12 months ago by kencu (Ken)

With any luck, the changes I made recently to the clang builds should allow perl to build with clang-9.0 by default now -- at least that was the idea behind them. If that worked out as it was supposed to, we can just revbump perl and it should rebuild properly.

comment:15 Changed 7 months ago by grumpybozo (Bill Cole)

This continues to be a problem with the perl5.28 binary package, which was built with clang 3.4 2020-06-03:

# perl5.28 -V
Summary of my perl5 (revision 5 version 28 subversion 3) configuration:
   
  Platform:
    osname=darwin
    osvers=10.8.0
    archname=darwin-thread-multi-2level
    uname='darwin snowleopard-i386.internal.macports.net 10.8.0 darwin kernel version 10.8.0: tue jun 7 16:33:36 pdt 2011; root:xnu-1504.15.3~1release_i386 i386 '
    config_args='-des -Dprefix=/opt/local -Dscriptdir=/opt/local/bin -Dvendorprefix=/opt/local -Dusemultiplicity=y -Dusethreads -Duseshrplib -Dcc=/opt/local/bin/clang-mp-3.4 -Dman1ext=1pm -Dman3ext=3pm -Dinstallstyle=lib/perl5 -Dman1dir=/opt/local/share/man/man1p -Dman3dir=/opt/local/share/man/man3p -Dsitebin=/opt/local/libexec/perl5.28/sitebin -Dsiteman1dir=/opt/local/share/perl5.28/siteman/man1 -Dsiteman3dir=/opt/local/share/perl5.28/siteman/man3 -Dvendorbin=/opt/local/libexec/perl5.28 -Dvendorman1dir=/opt/local/share/perl5.28/man/man1 -Dvendorman3dir=/opt/local/share/perl5.28/man/man3 -Dpager=/usr/bin/less -sR -Dperlpath=/opt/local/bin/perl5.28 -Dstartperl=#!/opt/local/bin/perl5.28 -Acppflags=-I/opt/local/include -Accflags=-pipe -Os  -Alddlflags=-L/opt/local/lib -Wl,-headerpad_max_install_names  -Aldflags=-L/opt/local/lib -Wl,-headerpad_max_install_names '
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=undef
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='/opt/local/bin/clang-mp-3.4'
 [...]
Note: See TracTickets for help on using tickets.