Reputation: 131
After updating perl via homebrew, i broke my dbd::mysql
installation
installing via cpanm
results in:
I will use the following settings for compiling and testing:
cflags (mysql_config) = -I/usr/local/Cellar/mysql-connector-
c/6.1.9/include
embedded (guessed ) =
ldflags (guessed ) =
libs (mysql_config) = -L/usr/local/Cellar/mysql-connector-
c/6.1.9/lib -l
mysql_config (guessed ) = mysql_config
nocatchstderr (default ) = 0
nofoundrows (default ) = 0
nossl (default ) = 0
testdb (default ) = test
testhost (default ) =
testpassword (default ) =
testport (default ) =
testsocket (default ) =
testuser (guessed ) = root
To change these settings, see 'perl Makefile.PL --help' and 'perldoc DBD::mysql::INSTALL'.
Checking if libs are available for compiling...
Can't link/include C library '', aborting.
Does anyone know how to resolve?
I've tried removing mysql-connector-c
and installing mysql
via
homebrew instead. The complaint then is Can't link/include C library
'ssl', 'crypto', aborting
. I do have openssl
installed.
perl version:
This is perl 5, version 24, subversion 1 (v5.24.1) built for
darwin-thread-multi-2level
Upvotes: 12
Views: 7720
Reputation: 1237
Stumbled upon this AGAIN, and after none of the answers worked, this one helped right away:
PATH="$(brew --prefix mysql-client)/bin:$PATH"
export LIBRARY_PATH=$(brew --prefix openssl)/lib:$LIBRARY_PATH
cpanm DBD::mysql
Credit goes to https://blog.mitsuto.com/macos-mojave-perl-dbd-mysql
Upvotes: 4
Reputation: 121
I followed the link given in @Benny K answer as the commands he gave didn't worked for me and simply executed the below command and it worked
cpanm DBD::mysql --configure-args="--libs='-L/usr/local/opt/openssl/lib -lssl -lcrypto -L/usr/local/lib -lmysqlclient'"
Upvotes: 4
Reputation: 151
show mysql_config
path by which mysql_config
eg: /usr/local/opt/[email protected]/bin/mysql_config
show openssl lib path by which openssl
. note: if it's a symbol in /usr/local/bin/openssl
, you can type ls -ld /usr/local/bin/openssl
to show real path
eg: if it's
/usr/local/openssl/bin/openssl
, then you can insert-L/usr/local/openssl/lib/
for searchingcrypto
andssl
libs
edit mysql_config
file and insert path of openssl lib(line #114)
eg:
libs=$libs -L/usr/local/opt/openssl/lib
4.type cpan install DBD::mysql
, success.
Upvotes: 15
Reputation: 198
This is an old question, but I just had this problem installing DBD::mysql and I see that others are still having this problem too. Here's the convoluted solution that worked for me.
I started by running (MacOX Mojave 10.14.1):
brew install mysql
cpanm install DBD::mysql
This gave me the error message "Can't link/include C library 'ssl', 'crypto', aborting". As per this thread and the DBD::mysql install instructions on meta-cpan, this error is happening because the DBD::mysql package requires (?) "mysql-connector-c" rather than "mysql". Okay, I fixed that by doing:
brew unlink mysql
brew install mysql-connector-c
cpanm install DBD::mysql
That "fixed" the issue in that it got me a different error message. I was now getting the message: "Can't link/include C library'', aborting". Progress! Now I was getting the error on this answer. I fixed this error by:
mysql_config
/usr/local/Cellar/mysql-connector-c/6.1.11/bin/mysql_config line #114
libs="$libs -l"
to libs="$libs -lmysqlclient"
mysql_config
cpanm install DBD::mysql
This got DBD::mysql installed successfully for me. I do think I'm going to have to go back and add some more linkage flags.
Upvotes: 15
Reputation: 1
i got the same error and while poking around trying to figure it out I added -I/usr/local/mysql/include to the perl makefile.pl command. This didn't work but like a goat i tried again and then it came up with an Xcode agreement form that I had to read and abide by. Longer story i upgraded an older macbook pro to el capitan then had to install Xcode 6.3 last week. I'd forgotten about the newer Xcode. Anyway, the end result was a successful install once i'd agreed to the Xcode usage
Upvotes: 0