Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rebar: error exit on create-app: {crypto,start,[]}

Tags:

erlang

rebar

I followed the instructions here, to the letter. I then ran the instruction to create an application project structure, and got the following error.

$ ./rebar create-app appid=myapp
Uncaught error in rebar_core: {'EXIT',
                              {undef,
                                  [{crypto,start,[]},
                                   {rebar_core,run,1},
                                   {rebar,main,1},
                                   {escript,run,2},
                                   {escript,start,1},
                                   {init,start_it,1},
                                   {init,start_em,1}]}}

Any ideas what I'm doing wrong?

like image 518
Andrew Matthews Avatar asked Jan 20 '11 00:01

Andrew Matthews


2 Answers

It looks like your Erlang was compiled without OpenSSL (the crypto module). crypto is required for many (most?) Erlang applications. You'll need to get a version of Erlang with a working crypto module, and then you shouldn't have any problems like this.

like image 84
YOUR ARGUMENT IS VALID Avatar answered Oct 18 '22 06:10

YOUR ARGUMENT IS VALID


A clarification to YOUR ARGUMENT IS VALID's answer (adding as an answer because the comment is too short).

It may be that Erlang was compiled properly but the OpenSSL libraries are not visible to Erlang, so the crypto server can't be started. I compiled Erlang on Solaris 10 and it didn't complain about OpenSSL not being installed. In fact, it compiled crypto and installed it in: /usr/local/lib/erlang/lib/crypto-2.2/

But Rebar still wasn't working. It's easy to check if the problem is indeed with the crypto module.

Open Erlang shell and type crypto:start(). This was happening on my system:

bash-3.2# erl
Erlang R15B03 (erts-5.9.3.1) [source] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.3.1  (abort with ^G)
1> crypto:start().
** exception error: undefined function crypto:start/0
2>
=ERROR REPORT==== 8-Feb-2013::15:28:43 ===
Unable to load crypto library. Failed with error:
"load_failed, Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/lib/erlang/lib/crypto-2.2/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"
OpenSSL might not be installed on this system.

=ERROR REPORT==== 8-Feb-2013::15:28:43 ===
The on_load function for module crypto returned {error,
                                                 {load_failed,
                                                  "Failed to load NIF library: 'ld.so.1: beam.smp: fatal: relocation error: file /usr/local/lib/erlang/lib/crypto-2.2/priv/lib/crypto.so: symbol DES_ede3_cfb_encrypt: referenced symbol not found'"}}

If OpenSSL is installed in a non-standard location, as it is the case when using OpenCSW to install OpenSSL on Solaris 10, it is easy to fix the problem by adding the library path to the environment variable. For example on Solaris 10 to /etc/profile:

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/opt/csw/lib
export LD_LIBRARY_PATH

Then log-out and log-in or re-load the bash environment, for example like this:

bash-3.2# . /etc/profile

Result:

bash-3.2# erl
Erlang R15B03 (erts-5.9.3.1) [source] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.9.3.1  (abort with ^G)
1> crypto:start().
ok
like image 38
Greg Avatar answered Oct 18 '22 07:10

Greg