1

I'm encountering a message seen for the first time when I execute a perl script requiring DBD::mysql module.

Simple example:

use DBI;
 
my $dbh = DBI->connect("DBI:mysql:db",'root','root');

$dbh->disconnect();

I'm working on macOS 11.1 on ARM64, my perl version is 5.30.3 installed with perlbrew.

The message is:

dyld: lazy symbol binding failed: Symbol not found: _mysql_init
  Referenced from: /Users/test/perl5/perlbrew/perls/perl-5.30.3/lib/site_perl/5.30.3/darwin-2level/auto/DBD/mysql/mysql.bundle
  Expected in: flat namespace

dyld: Symbol not found: _mysql_init
  Referenced from: /Users/test/perl5/perlbrew/perls/perl-5.30.3/lib/site_perl/5.30.3/darwin-2level/auto/DBD/mysql/mysql.bundle
  Expected in: flat namespace

Abort trap: 6

Any idea how this can be fixed?

In my .bash_profile and .bashrc I've added these lines:

export PATH="/usr/local/mysql/bin:${PATH}"
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:${DYLD_LIBRARY_PATH}"
Flavio Del Grosso
  • 490
  • 2
  • 7
  • 21
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/227008/discussion-on-question-by-flavio-del-grosso-perl-dyld-lazy-symbol-binding-fai). – Samuel Liew Jan 08 '21 at 01:51

2 Answers2

4

The problem is the new system integrity protection procedure, which causes DYLD_LIBRARY_PATH not to be propagated to sub processes. Specifically, when running make test the test subprocess does not pick up the DYLD_LIBRARY_PATH from the parent shell.

The issue has been reported previously.

See also this question.

Håkon Hægland
  • 39,012
  • 21
  • 81
  • 174
1

Finally resolved installing mysql natively. I reinstalled it using brew and passing -s to the command (brew install -s mysql). So the problem was the wrong architecture and recompiling it for ARM64 now also make test while installing DBD::mysql works well without any error.

Hope can helps :)

Flavio Del Grosso
  • 490
  • 2
  • 7
  • 21