使用mysql brew install在Mac Sierra上安装perl DBD :: mysql失败

时间:2017-03-31 00:14:45

标签: perl macos-sierra cpanm dbd-mysql

尝试在运行mysql v 5.7.17的Mac Sierra计算机上安装DBD::mysql。尝试使用cpanm install DBD::mysql安装时出现以下错误:

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

到目前为止,我发现的其他解决方案并未解决Sierra的问题。

2 个答案:

答案 0 :(得分:5)

您可以传递libscflags arg来帮助Makefile.PL找到计算机上的库(在我的情况下,openssl库是用自制软件安装的):

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

答案 1 :(得分:0)

这对我有用:

public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(DataSourceConfiguration.class); context.register(BatchConfiguration.class); context.register(SpringBatchConfig.class); context.refresh(); JobLauncher jobLauncher = (JobLauncher) context.getBean("jobLauncher"); Job job = (Job) context.getBean("firstBatchJob"); System.out.println("Starting the batch job"); try { DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); Date date = new Date(); JobParameters jobParam = new JobParametersBuilder().addString("jobDate",dateFormat.format(date)).toJobParameters(); JobExecution execution = jobLauncher.run(job, jobParam); System.out.println("Job Status : " + execution.getStatus()); System.out.println("Job completed : " + execution.getJobId()); } catch (Exception e) { e.printStackTrace(); System.out.println("Job failed"); } }