Installing perl DBD::mysql fails on Mac Sierra with mysql brew install

2.5k views Asked by At

Trying to install DBD::mysql on my Mac Sierra computer running mysql v 5.7.17. Getting the following error when trying to install with cpanm install DBD::mysql:

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

Other solutions I have found so far don't address this issue with Sierra.

2

There are 2 answers

1
StevieD On BEST ANSWER

You can pass libs and cflags arg to help Makefile.PL find the libaries on the machine (in my case the openssl libraries were installed with homebrew):

cpanm --configure-args="--libs='-L/usr/local/opt/openssl/lib -L/usr/local/Cellar/mysql/5.7.17/lib' --cflags='-I/usr/local/opt/openssl/include -I/usr/local/Cellar/mysql/5.7.17/include/mysql'" DBD::mysql

0
Gedge On

This worked for me:

cpanm --configure-args="--libs='-L/usr/local/opt/openssl/lib -L/usr/local/Cellar/mysql/5.7.19/lib -lmysqlclient -lssl -lcrypto' --cflags='-I/usr/local/opt/openssl/include -I/usr/local/Cellar/mysql/5.7.19/include/mysql'" DBD::mysql