NGINX + BoringSSL 编译错误

在使用最新版本的Nginx和Boringssl编译的时候会出现如下错误提示:

./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with Angie by using --with-openssl=<path> option.

出现以上的原因在于Boringssl项目在清除其他代码后遗留下来了一个C或者C++的运行时runtime检查.

因此libssl 现在需要 C++ 运行时,除了
预先存在的 C++ 要求。某些项目可能需要将最终链接切换到使用 C++ 链接器而不是 C 链接器。

以上参考链接https://github.com/google/boringssl/commit/c52806157c97105da7fdc2b021d0a0fcd5186bf3

Nginx社区有人给出了针对三个平台的解决方案如下:

MacOS:

auto/configure \
--with-cc-opt="-I../boringssl/include" \
--with-ld-opt="-L../boringssl/build/ssl -L../boringssl/build/crypto -lc++"

C语言环境下Linux:

auto/configure /
--with-cc=clang /
--with-cc-opt="-I../boringssl/include" /
--with-ld-opt="-L../boringssl/build/ssl -L../boringssl/build/crypto -lstdc++"

C++语言环境下Linux:

auto/configure \
--with-cc=c++ \
--with-cc-opt="-I../boringssl/include -x c" \
--with-ld-opt="-L../boringssl/build/ssl -L../boringssl/build/crypto"

多少情况下用的C++环境。通过以上方式编译,即可解决openssl库无法连接的问题。


评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

Captcha Code