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



我正在尝试在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&进行安装,但在启动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

我无法解决这个错误,任何建议。。请注意,我正在使用访问机器作为根用户

/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位的英特尔机器,可能会出现以下情况。

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计算机上使用它。另请参阅OpenSSL wiki上的编译和安装|配置选项。


此外,请确保使用适用于OpenSSL 1.0.2及以下版本的make dclean;或适用于OpenSSL 1.1.0及以上版本的CCD_ 4。否则,即使在更改了选项之后,一些旧配置仍然存在。

相关内容

最新更新