在OSX 10.11上安装DBD::MySQL时出错-CAN链接/包含C库'',正在中止

2022-03-14 00:00:00 macos perl homebrew mysql dbd
通过自制软件更新Perl后,我损坏了dbd::mysql安装 通过cpanm安装会导致:

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.

有人知道如何解决吗? 我已尝试删除mysql-connector-c并安装mysqlVIA 改成自制的。那么投诉就是Can't link/include C library 'ssl', 'crypto', aborting。我确实安装了openssl

Perl版本:

This is perl 5, version 24, subversion 1 (v5.24.1) built for
darwin-thread-multi-2level

解决方案

  1. which mysql_config显示mysql_config路径

    例如:/usr/local/opt/mysql@5.7/bin/mysql_config

  2. 通过which openssl显示OpenSSL库路径。注意:如果它是/usr/local/bin/openssl中的符号,您可以键入ls -ld /usr/local/bin/openssl以显示实际路径

    例如:如果是/usr/local/openssl/bin/openssl, 然后您可以插入-L/usr/local/openssl/lib/用于搜索cryptossl

  3. 编辑mysql_config文件并插入OpenSSL库的路径(第114行)

    例如:libs=$libs -L/usr/local/opt/openssl/lib

    4.键入cpan install DBD::mysql,成功。

相关文章