[/usr/local/openssl//.openssl/include/openssl/ssl.h] Error 127 - 小众知识

[/usr/local/openssl//.openssl/include/openssl/ssl.h] Error 127

2022-08-14 06:28:14 苏内容
  标签: openssl
阅读:2726

[/usr/local/openssl//.openssl/include/openssl/ssl.h] Error 127

/bin/sh: line 2: ./config: No such file or directory

make[1]: *** [/usr/local/ssl/.openssl/include/openssl/ssl.h] Error 127

make[1]: Leaving directory `/usr/local/src/nginx-1.9.9'

make: *** [build] Error 2

需要说明的是,我这里编译所使用的Nginx源码是1.9.9的。根据报错信息我们知道,出错是因为Nginx在编译时并不能在/usr/local/ssl/.openssl/ 这个目录找到对应的文件,其实我们打开/usr/local/ssl/这个目录可以发现这个目录下是没有.openssl目录的,因此我们修改Nginx编译时对openssl的路径选择就可以解决这个问题了

解决方案:

打开nginx源文件下的/usr/local/src/nginx-1.9.9/auto/lib/openssl/conf文件:

找到这么一段代码:

CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"

CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"

CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"

CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"

CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

修改成以下代码:

CORE_INCS="$CORE_INCS $OPENSSL/include"

CORE_DEPS="$CORE_DEPS $OPENSSL/include/openssl/ssl.h"

CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libssl.a"

CORE_LIBS="$CORE_LIBS $OPENSSL/lib/libcrypto.a"

CORE_LIBS="$CORE_LIBS $NGX_LIBDL"

 然后再进行Nginx的编译安装即可 



我尝试通过执行以下操作使用 OpenSSL 安装 Postgres

./configure --with-openssl

但我有一个错误说

配置:错误:OpenSSL 需要头文件 openssl/ssl.h

但是,我确实安装了 OpenSSL。如果我运行,openssl version我会得到这个输出

OpenSSL 0.9.8zh 2016 年 1 月 14 日

我遇到了这个解决方案并尝试做

./configure --with-includes=/usr/local/ssl/include 它安装没有任何问题。

有人可以解释发生了什么以及两个配置版本之间的区别吗?


有人可以解释发生了什么以及两个配置版本之间的区别。

您可以运行./configure --help以获取参数概要:

$ ./configure --help | egrep -i '(ssl|includes)'
  --with-includes=DIRS    look for additional header files in DIRS
  --with-openssl          build with OpenSSL support

./configure --with-openssl

这只是在 Postgres 中启用 OpenSSL。它可以检查 Autoconf,例如探测符号CRYPTO_new_ex_data和SSL_Library_init.

它看起来也像 configure 定义#define USE_OPENSSL 1了激活 OpenSSL 代码路径:

$ grep -IR OPENSSL * | grep '.c'...
src/backend/postmaster/fork_process.c:#ifdef USE_OPENSSLsrc/backend/postmaster/fork_process.c:#ifdef USE_OPENSSLsrc/backend/utils/init/postinit.c:#ifdef USE_OPENSSLsrc/backend/utils/init/postinit.c:#ifdef USE_OPENSSLsrc/include/libpq/libpq-be.h:#ifdef USE_OPENSSLsrc/include/libpq/libpq-be.h:#ifdef USE_OPENSSL...

./configure --with-includes=/usr/local/ssl/include

这可能并没有启用OpenSSL的。它只是为编译期间未使用的头文件添加了一个路径。使用lddLinux和otool -LOS X上,看看是否有任何的OpenSSL依赖。


您可能应该使用./configure --with-openssl --with-includes=/usr/local/ssl/include --with-libraries=/usr/local/ssl/lib. 您可能应该添加CFLAGS="-Wl,-rpath=/usr/local/ssl/lib以确保正确的运行时链接。

另请参阅Postgres 问题 14308:Postgres 9.5.4 未针对 OpenSSL 1.1.0 进行配置


扩展阅读
相关阅读
© CopyRight 2010-2021, PREDREAM.ORG, Inc.All Rights Reserved. 京ICP备13045924号-1