Flavio Del Grosso
Flavio Del Grosso

Reputation: 600

Perl - dyld: lazy symbol binding failed: Symbol not found: _mysql_init

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}"

Upvotes: 1

Views: 1069

Answers (2)

Flavio Del Grosso
Flavio Del Grosso

Reputation: 600

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 :)

Upvotes: 1

Håkon Hægland
Håkon Hægland

Reputation: 40778

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.

Upvotes: 4

Related Questions