Search code examples
perlmacos-sierracpanmdbd-mysql

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


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.


Solution

  • 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