您的位置:首页 > 其它

安装rebar时提示"Uncaught error in rebar_core"

2015-01-02 17:32 507 查看
最近在学Erlang,看到第25章时要安装一个叫做rebar的软件,具体怎么用还不知道,只不过中途出了点问题,花了一下午才解决问题,实在太蛋疼了,所以特整理出此博文,如果有人遇到同样的问题可以有个参考。

先描述下问题:

按照教程安装rebar,从 https://github.com/rebar/rebar/ 下载编译好的版本(注:网上大多数都是说的http://github.com/rebar/rebar/wiki/rebar这个地址,但是这个地址找不到,应该是已经更新了),或者直接下载源码包到本地,然后自己编译:

git clone git://github.com/rebar/rebar.git
cd rebar
./bootstrap
安装成功会提示(https://github.com/rebar/rebar):

Recompile: src/getopt
...
Recompile: src/rebar_utils
==> rebar (compile)
Congratulations! You now have a self-contained script called "rebar" in
your current working directory. Place this script anywhere in your path
and you can use rebar to build OTP-compliant apps.
我的却提示:

Recompile: src/getopt
...
Recompile: src/rebar_xref
Uncaught error in rebar_core: {'EXIT',
{undef,
[{crypto,start,[],[]},
{rebar,run_aux,2,
[{file,"src/rebar.erl"},{line,163}]},
{rebar,main,1,
[{file,"src/rebar.erl"},{line,58}]},
{erl_eval,do_apply,6,
[{file,"erl_eval.erl"},{line,657}]},
{escript,eval_exprs,5,
[{file,"escript.erl"},{line,865}]},
{erl_eval,local_func,5,
[{file,"erl_eval.erl"},{line,544}]},
{escript,interpret,4,
[{file,"escript.erl"},{line,781}]},
{escript,start,1,
[{file,"escript.erl"},{line,276}]}]}}
随后就是各种查资料,最后弄明白了,其实不是rebar的问题,从报错可以看出在编译crypto模块时候出现了undef错误,也就是说crypto模块不存在,这个模块其实是安装erlang的时候生成的,也就是说问题出在erlang 上;

rebar的github(https://github.com/yrashk/socket.io-erlang)说明里也提到了这个问题如下:



其实这是因为erlang在安装的时候没有安装openssl,erlang安装的时候需要依赖几个库,其中就有openssl,可以参考这篇文章,但是我安装openssl时候却提示已安装,之后我查到源码包安装erlang时,config要带一些参数,我发现我的openssl路径和网上提到的都不一样,所以我就在--withssl="path"里把自己的openssl路径填上重新安装了一次erlang之后问题就解决了,

问题解决之前:



解决之后:



具体安装过程:

首先从http://www.erlang.org/download.html下载最新版源码包otp_src_17.4.tar.gz
解压tar zxf otp_src_17.4.tar.gz
cd otp_src_17.4
./configure --with-ssl=/usr/local/ssl --enable-hipe --enable-threads --enable-smp-support --enable-kernel-poll(这里ssl的路径填自己的安装路径,这些参数是可选的)
make
sudo make install


如果这样还解决不了问题可以参考下面的帖子:

erlang加载openssl失败

erlang crypto模块不兼容openssl

源码安装erlang

Uncaught error in rebar_core
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐