error "Can't link/include C library 'zstd'" installing DBD::mysql on Mac Big Sur - MacPorts MySQL

1.2k views Asked by At

I'm using mysql8 on Big Sur - it was installed with MacPorts. I've been having trouble installing DBD::mysql - both via CPAN and manually. The error message I get is:

Checking if libs are available for compiling... 
Can't link/include C library 'zstd', aborting.

Some (possibly completely irrelevant) facts that might help - I'm groping in the dark here:

  • I'm using /usr/bin/perl although the MacPorts Perl is shown as "active". @INC does not include anything in /opt
  • I find the following in /opt/local/lib:
lrwxr-xr-x    1 root  admin        19 Mar  6 12:30 libzstd.1.dylib -> libzstd.1.4.9.dylib
-rw-r--r--    1 root  admin   1112760 Mar  6 12:30 libzstd.a
lrwxr-xr-x    1 root  admin        19 Mar  6 12:30 libzstd.dylib -> libzstd.1.4.9.dylib
  • When I run mysql_config, I get the following output related to libraries:
--libs           [-L/opt/local/lib/mysql8/mysql -lmysqlclient -lz -lzstd -lssl -lcrypto -lresolv]

Any hints? Many thanks in advance!

2

There are 2 answers

0
birey On

I had the same problem when installing DBD:mysql on a recent M1 macbook. I solved it by installing perlbrew(and then re-installing perl) and doing a manual installation:

https://perlbrew.pl/

Perlbrew gives you the option installing and running other versions of perl (other than the "vendor" version that OSX uses).

I then downloaded the DBD::mysql package (https://metacpan.org/pod/DBD::mysql). Then I went for a manual installation, setting the linker flags to eliminate the missing libraries.

perl Makefile.PL --libs="-L/opt/homebrew/Cellar/mysql/8.0.25_1/lib -lmysqlclient"
make
make test
make install
0
ryandesign On

The obvious answer would be to use MacPorts to install DBD::mysql e.g. by running

sudo port install p5.28-dbd-mysql +mysql8