今天在Centos6.5下安装erlang,过程真是一波三折,总结一下:
下载
erlang源代码包,选择版本,这里以erlang
R16B03为例作说明:
wget http://www.erlang.org/download/otp_src_R16B03.tar.gz
tar -zxf otp_src_R16B03.tar.gz
cd otp_src_R16B03
mkdir -p /home/erl
./configure --prefix=/home/erl
make && make install
ln -s /home/erl/bin/erl /usr/bin/erl
依赖组件
| 报错信息 |
解决
|
C compiler |
configure: error: no acceptable C compiler found in $PATH
See'config.log' for more details.
|
yum install gcc
|
curses library |
configure: error: No curses library functions found
configure: error: /bin/sh '/home/otp_src_R16B03/erts/configure' failed for erts
|
yum install ncurses-devel
|
安装erlang的时候可能会出现以下警告信息,但不影响erlang使用,如果要用到以下apps,就必须装好依赖:
*********************************************************************
********************** APPLICATIONS DISABLED **********************
*********************************************************************
crypto : No usable OpenSSL found
jinterface : No Java compiler found
odbc : ODBC library - link check failed
orber : No C++ compiler found
ssh : No usable OpenSSL found
ssl : No usable OpenSSL found
*********************************************************************
没装依赖的话会遇到什么问题,比如像用crypto,将会提示没有这个函数
Eshell V5.10.4 (abort with ^G)
1> crypto:start().
** exception error: undefined function crypto:start/0
这里有个问题,
如果是装
openssl,不是
openssl-devel的话,
crypto还是无法使用。
依赖组件
| 没装无法使用的apps |
解决
|
OpenSSL |
crypto、
ssh、
ssl
| yum install openssl-devel |
Java compiler |
jinterface
|
yum install java-devel
|
ODBC library |
odbc
|
yum install unixODBC-devel
|
C++ compiler
|
orber
|
yum install gcc-c++
|
Eshell V5.10.4 (abort with ^G)
1> crypto:start().
=ERROR REPORT==== 24-Sep-2014::15:10:46 ===
Unable to load crypto library. Failed with error:
"load_failed, Failed to load NIF library: '/home/erl/lib/erlang/lib/crypto-3.2/priv/lib/crypto.so: undefined symbol: EC_GROUP_new_curve_GF2m'"
OpenSSL might not be installed on this system.
erlang R16B以上版本运行crypto:start()时,提示crypto.so: undefined symbol: EC_GROUP_new_curve_GF2m,是因为新版的libssl库去除了对一些过时算法的支持,如果程序用不到,可以注释掉otp_src_R16B0x/lib/crypto/c_src/crypto.c第81行# define HAVE_EC即可。
Eshell V5.10.4 (abort with ^G)
1> crypto:start().
ok
2> crypto:md5("ggg").
<<186,36,140,152,90,206,148,134,56,128,146,29,137,0,197,63>>
3> crypto:info_lib().
[{<<"OpenSSL">>,268439647,
<<"OpenSSL 1.0.1e-fips 11 Feb 2013">>}]
wget http://www.openssl.org/source/openssl-1.0.1i.tar.gz
tar -zxf openssl-1.0.1i.tar.gz
cd openssl-1.0.1i
./config --prefix=/home/ssl
sed -i "s|CFLAG= |CFLAG= -fPIC |" Makefile
make && make install
编译erlang的时候要做改动
:
./configure --with-ssl=/home/ssl/ --prefix=/home/erl
参考:http://blog.csdn.net/mycwq/article/details/39524847