今天在Centos6.5下安装erlang,过程真是一波三折,总结一下:
下载erlang源代码包,选择版本,这里以erlang R16B03为例作说明:
[plain] view plain copy
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 $PATHSee ‘config.log’ for more details.yum install gcccurses libraryconfigure: error: No curses library functions foundconfigure: error: /bin/sh ‘/home/otp_src_R16B03/erts/configure’ failed for ertsyum install ncurses-devel
安装erlang的时候可能会出现以下警告信息,但不影响erlang使用,如果要用到以下apps,就必须装好依赖:
[plain] view plain copy
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,将会提示没有这个函数
[plain] view plain copy
Eshell V5.10.4 (abort with ^G)
1> crypto:start().
** exception error: undefined function crypto:start/0
这里有个问题,如果是装openssl,不是openssl-devel的话,crypto还是无法使用。
依赖组件没装无法使用的apps解决OpenSSLcrypto、ssh、sslyum install openssl-develJava compilerjinterfaceyum install java-develODBC libraryodbcyum install unixODBC-develC++ compilerorberyum install gcc-c++
事实上,openssl-devel在erlang中还是不能满足使用的,还需要做一些改动。
[plain] view plain copy
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即可。
[plain] view plain copy
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”>>}]
网上还有另一种做法:修改openssl对EC的支持
[plain] view plain copy
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的时候要做改动:
[plain] view plain copy
./configure —with-ssl=/home/ssl/ —prefix=/home/erl
参考:http://blog.csdn.net/mycwq/article/details/39524847
APPLICATIONS INFORMATION *
wx : wxWidgets not found, wx will NOT be usable
解决:
yum install unixODBC-devel.x86_64
yum -y install openssl-devel.x86_64
yum -y install gcc-c++.x86_64
—without-javac
安装wxWidgets:
wget http://sourceforge.net/projects/wxwindows/files/3.0.1/wxWidgets-3.0.1.tar.bz2/download
bzip2 -dkv wxWidgets-3.0.1.tar.bz2
-d|—decompress 执行解压缩 -k|—keep bzip2在压缩或解压缩后,不删除原文件
v|—verbose 显示详细的信息
tar xvf wxWidgets-3.0.1.tar
mkdir -p /usr/local/wxWidgets3.0.4
./configure —with-opengl —enable-debug —enable-unicode
wxWidgets configure 问题:
错误:** Could not run GTK+ test program, checking why…
yum install gtk+extra-devel.x86_64
错误:configure: error: OpenGL libraries not available
# yum install -y mesa
# yum install -y freeglut*
make & make install
验证wxWidgets:
wx-config —version-full
3.0.1.0
DOCUMENTATION INFORMATION
documentation :
fop is missing.
Using fakefop to generate placeholder PDF files.
#如上,提示错误,解决方法:安装fop
[root@localhost otp_src_17.1]# yum install fop
如果报错:
/usr/bin/env: escript: No such file or directory
make: * [all] Error 127
解决:
vim /etc/profile
底部增加:export PATH=/data/app/nginx/sbin:/data/app/php/bin:/data/app/erl/bin:$PATH
source /etc/profile