按照教程安装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之后问题就解决了,
问题解决之前:
解决之后:
如果这样还解决不了问题可以参考下面的帖子:
erlang加载openssl失败
erlang crypto模块不兼容openssl
源码安装erlang
Uncaught error in rebar_core
另加一篇安装erlang的文章:
http://my.oschina.net/u/1540325/blog/308984