ssl - Erlang 安装和 "/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value"

标签 ssl erlang rabbitmq

我正在尝试在 Linux 机器 Red Hat Enterprise Linux Server 6.6 版上安装 RabbitMQ (3.6.1)。要安装 rabbitMQ ,首先我从源代码 (otp_src_R16B03) 安装了 Erlang R16B03 版本并遵循以下命令

wget http://www.erlang.org/download/otp_src_R16B03.tar.gz
tar xvfz /usr/tmp/otp_src_R16B03.tar
cd otp_src_R16B03
LANG=C; export LANG
./configure --with-ssl=/usr/bin

我收到如下所示的消息:

*********************************************************************
**********************  APPLICATIONS DISABLED  **********************
*********************************************************************

crypto         : OpenSSL is configured for kerberos but no krb5.h found
jinterface     : No Java compiler found
odbc           : ODBC library - link check failed
orber          : No C++ compiler found
ssh            : OpenSSL is configured for kerberos but no krb5.h found
ssl            : OpenSSL is configured for kerberos but no krb5.h found

*********************************************************************
*********************************************************************
**********************  APPLICATIONS INFORMATION  *******************
*********************************************************************

wx             : wxWidgets not found, wx will NOT be usable
*********************************************************************

尽管我继续进行 make 和 make install 但是在启动 Rabbitmq 服务器时出现以下错误

sbin/rabbitmq-server

获取消息

BOOT FAILED
===========

Error description:
   {error,{missing_dependencies,[crypto,ssl],[mochiweb,cowlib,cowboy]}}

Log files (may contain more information):
   /usr/tmp/rabbitmq_server-3.6.1/var/log/rabbitmq/rabbit.log
   /usr/tmp/rabbitmq_server-3.6.1/var/log/rabbitmq/rabbit-sasl.log

Stack trace:
   [{rabbit_plugins,ensure_dependencies,1,
                    [{file,"src/rabbit_plugins.erl"},{line,179}]},
    {rabbit_plugins,prepare_plugins,1,
                    [{file,"src/rabbit_plugins.erl"},{line,198}]},
    {rabbit,broker_start,0,[{file,"src/rabbit.erl"},{line,284}]},
    {rabbit,start_it,1,[{file,"src/rabbit.erl"},{line,303}]},
    {init,start_it,1,[]},
    {init,start_em,1,[]}]

{"init terminating in do_boot",{error,{missing_dependencies,[crypto,ssl],[mochiweb,cowlib,cowboy]}}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

在探索了多种解决方案后,我了解到我需要安装最新的 Openssl 并提供新安装的 openssl 的路径。

我从源码安装了 Openssl 并且安装了 -fPIC

wget https://www.openssl.org/source/openssl-1.0.2.tar.gz
tar xvfz /usr/tmp/openssl-1.0.2.tar.gz
cd /usr/tmp/openssl-1.0.2
./config -fPIC
make 
make install 

现在新的 openssl 安装在 bin/local/ssl 位置,我已经使用以下配置重新安装了 Erlang

export PATH="/usr/local/ssl/bin:$PATH”
export CFLAGS=-fPIC
cd /usr/tmp/otp_src_RB1603
LANG=C; export LANG
./configure --with-ssl=/usr/local/bin
make
make install

现在我得到了错误

/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(rsaz_exp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value**
collect2: ld returned 1 exit status
make[6]: *** [../priv/lib/x86_64-unknown-linux-gnu/crypto.so] Error 1
make[6]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[5]: *** [release_spec] Error 2
make[5]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[4]: *** [release] Error 2
make[4]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[3]: *** [release] Error 2
make[3]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto/c_src'
make[2]: *** [release] Error 2
make[2]: Leaving directory `/var/tmp/otp_src_R16B03/lib/crypto'
make[1]: *** [release] Error 2
make[1]: Leaving directory `/var/tmp/otp_src_R16B03/lib'
make: *** [install.libs] Error 2

我无法解决这个错误,任何建议.. 请注意我正在以 root 用户身份访问机器

最佳答案

/usr/bin/ld: /usr/local/ssl/lib/libcrypto.a(rsaz_exp.o): relocation R_X86_64_32 against `.rodata'
can not be used when making a shared object; recompile with -fPIC
/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value**
collect2: ld returned 1 exit status

您需要使用 shared 选项构建 OpenSSL。对于 64 位 Intel 机器,可能类似于以下内容。

wget https://www.openssl.org/source/openssl-1.1.0b.tar.gz
tar xzf openssl-1.1.0b.tar.gz
cd openssl-1.1.0b

./Configure no-ssl2 no-ssl3 shared enable-ec_nistp_64_gcc_128
...
make -j 8
...
make test
...
suod make install

enable-ec_nistp_64_gcc_128 使 EC Diffie-Hellman 速度提高 2 到 4 倍,但它有一些限制。你可以在 64 位 Intel 机器上使用它。另见 Compilation and Installation | Configure Options在 OpenSSL wiki 上。


此外,请确保为 OpenSSL 1.0.2 及以下版本make dclean;或 make distclean 用于 OpenSSL 1.1.0 及更高版本。否则,一些旧配置即使在更改选项后仍然存在。

关于ssl - Erlang 安装和 "/usr/local/ssl/lib/libcrypto.a: could not read symbols: Bad value",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36710051/

相关文章:

apache - https htaccess 排除一些 url

ios - 使用 azure api 管理为 native 应用程序实现 SSL 固定的最佳方法

二郎 : Tcp Server

erlang - 使用 XPath 删除元素

javascript - 如何使用 AMQP/Node 每秒处理 >100 条消息

ios - 在 iOS 应用程序中嵌入 SSL 根证书,而不是为整个系统安装它

performance - Perl方式快速创建套接字(1000+)

erlang - 在 Erlang 中生成没有堆栈的幂集

java - 如何在没有确认的情况下消费 100 条消息,然后工作然后确认它们?

rabbitmq - 如何使用spring-rabbitmq将消息标记为持久?