找不到 OpenSSL 如果已经安装,请相应地设置 OPENSSL_PREFIX 环境变量

Could not find OpenSSL If it's already installed, please set the OPENSSL_PREFIX environment variable accordingly

当我尝试在 Debian 上安装 Net::SSLeay 时,我得到

Use of uninitialized value in subroutine entry at Makefile.PL line 290.
Use of uninitialized value $exec in -x at Makefile.PL line 108.
*** Could not find OpenSSL
    If it's already installed, please set the OPENSSL_PREFIX environment
    variable accordingly. If it isn't installed yet, get the latest version
    from http://www.openssl.org/.
N/A

但我确实安装了 OpenSSL,

$ dpkg -l libssl-dev
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name             Version      Architecture Description
+++-================-============-============-================================================
ii  libssl-dev:amd64 1.1.1b-2     amd64        Secure Sockets Layer toolkit - development files

我也试过 OPENSSL_PREFIX

不是由于无法定位headers(由-dev提供)而导致的错误,而是因为找不到openssl 二进制实用程序。 headers 仍然是必需的,但您也需要二进制 openssl 实用程序。您可以使用 apt 本身安装 Net::SSLeay,或者从源代码构建模块。简单的方法,从 apt 安装 Net::SSLeay,可以用

完成
sudo apt install libnet-ssleay-perl

或者您可以安装二进制文件 openssl,然后尝试使用 cpan 再次安装。

sudo apt install openssl libssl-dev zlib1g-dev ## all requirements to build Net::SSLeay
cpanm Net::SSLeay

您可以验证 openssl 是否已安装(如果有效,则上述错误不应重现)

openssl version