Reputation: 105
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:
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
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!
Upvotes: 4
Views: 1620
Reputation: 17811
My solution was to hack mysql_config and add the following two lines:
libs="$libs -L/opt/homebrew/Cellar/openssl@3/3.3.1/lib"
libs="$libs -L/opt/homebrew/Cellar/zstd/1.5.5/lib"
before the line:
libs="$libs -lmysqlclient -lz -lzstd -lssl -lcrypto -lresolv"
The latter resolves your issue, the first line was necessary for resolving the similar issue with crypto and ssl.
Upvotes: 1
Reputation: 1144
The obvious answer would be to use MacPorts to install DBD::mysql e.g. by running
sudo port install p5.28-dbd-mysql +mysql8
Upvotes: 0
Reputation: 21
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:
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
Upvotes: 2