./configure 期间未找到 OpenSSL

./configure 期间未找到 OpenSSL

我正在尝试在 Ubuntu 14.04.3 上创建一个类似比特币的守护进程。当我点击./configure

checking for SSL... no
configure: error: openssl  not found.

# apt-get install libssl-dev linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version.
linux-headers-3.13.0-61-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

我在 Google 上搜索了错误消息,但我不知道该怎么办。我成功地在我的另一台 Ubuntu 14.04 上创建了那个守护进程,因此源和配置脚本都很好。

UPD1. 安装 openssl 没有帮助:

# apt-get install openssl
..
openssl is already the newest version.
..

我已经检查了 config.log,最后没有关于 openssl 的任何内容 -HAVE_WORKING_BOOST_SLEEP_FOR指的是-输出checking for dynamic linked boost test... yes中的最后一行成功:./configure

# tail config.log
#define HAVE_BOOST /**/
#define HAVE_BOOST_SYSTEM /**/
#define HAVE_BOOST_FILESYSTEM /**/
#define HAVE_BOOST_PROGRAM_OPTIONS /**/
#define HAVE_BOOST_THREAD /**/
#define HAVE_BOOST_CHRONO /**/
#define HAVE_BOOST_UNIT_TEST_FRAMEWORK /**/
#define HAVE_WORKING_BOOST_SLEEP_FOR 1

configure: exit 1

UPD2. 我在日志中发现,距离结尾很远的地方:

configure:25626: checking for SSL
configure:25633: $PKG_CONFIG --exists --print-errors "libssl"
Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libssl' found
configure:25636: $? = 1
configure:25650: $PKG_CONFIG --exists --print-errors "libssl"
Package libssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libssl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libssl' found
configure:25653: $? = 1
configure:25667: result: no
No package 'libssl' found
configure:25683: error: openssl  not found.

答案1

您将在 Synaptic Package Manager (Ubuntu 16.04) 中找到一个软件包名称libssl-dev,安装后libssl-dev,所有问题都将解决。顺便说一句,libssl1.0.0不要工作。您最好同时安装libssl-dev和 。libssl1.0.0

顺便说一句,我认为以下解决方案不起作用:“pkg-config”在您的 PATH 中,并且 PKG_CONFIG_PATH 包含 openssl.pc 文件。如果 pkg-config 不可用,您可以通过以下方式手动设置 INCLUDE_DIR 和 LIB_DIR:R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'

答案2

由于某种原因,PKG_CONFIG_PATH没有包含openssl.pcpkg-config 实用程序所需文件的正确路径。我找到了find / -name 'openssl.pc'它,并在 中找到它/usr/lib/x86_64-linux-gnu/pkgconfig/。我的其他 ubuntu 也使用了该路径./configure

于是我跑了PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig/" ./configure,而且成功了!

openssl.pc其他事情,我的里面还有另一个/usr/local/ssl/lib/pkgconfig/,但是当我尝试使用它时,以下make命令会因不同的错误而挂起(例如对函数的未知引用等)。

相关内容