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?
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.
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
I'd recommend using precompiled Erlang which is available from Erlang Solutions: https://www.erlang-solutions.com/downloads/download-erlang-otp
There's one for Windows too.
Getting this error when running make command:
root#hs:/var/www/html/ejabberd-master# make
rm -rf deps/.got
rm -rf deps/.built
/usr/local/lib/erlang/bin/escript rebar get-deps && :> deps/.got
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}]},
{escript,run,2,
[{file,"escript.erl"},{line,757}]},
{escript,start,1,
[{file,"escript.erl"},{line,277}]},
{init,start_it,1,[]},
{init,start_em,1,[]}]}}
make: *** [deps/.got] Error 1
The erlang details are:
root#hs:/home/node# erl
Erlang/OTP 18 [erts-7.0] [source] [64-bit] [smp:4:4] [async- threads:10] [hipe] [kernel-poll:false]
Eshell V7.0 (abort with ^G)
1> crypto:start()
1>
Seems like crypto not working, as the command gives "Ok" or "exception error".
Help needed.
Thanks for the answer Ivan. But it seems I figured out the issue:
The ubuntu auto updates were turned off and the dependencies were not installed while compiling erlang (e.g. libssh-dev). Once the auto update was turned on it compiled and make command ran fine.
Related
I am studying the upgrade of erlang applications based on this article.
But there is some problem when I execute rebar3 relup:
Option --relname is missing
hello#centos7-dev:~/relapp1 ((1.0.12))$ rebar3 relup
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling relapp
Solving Release relapp-1.0.12Resolved relapp-1.0.12release: relapp-1.0.12
erts: 13.0.4
goals:
relapp
parse_trans
sasl
applications:
{kernel,"8.4.2"}
{stdlib,"4.0.1"}
{syntax_tools,"3.0"}
{parse_trans,"3.0.0"}
{relapp,"1.0.12"}
{sasl,"4.2"}
......
....relapp1/_build/default/rel/relapp/lib/sasl-4.2/ebin/sasl.apprelease start script createdRelease successfully assembled:
_build/default/rel/relapp===> Option --relname is missing
The environments are as follows:
erlang
Erlang/OTP 25 [erts-13.0.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]
Eshell V13.0.4 (abort with ^G)
rebar3
rebar 3.20.0 on Erlang/OTP 25 Erts 13.0.4
After many times of retry and experiment, I found it in this article.
Hot code reloading with Erlang and Rebar3
The answer is such as:
rebar3 relup -n nine9s -v "0.2.0" -u "0.1.0"
However, there are some issues which need attention.
The rebar.config file
You should replace the default options {mode, dev} with {dev_mode, false}
the *.appup.src
You cannot include the point_of_no_return option in this file, otherwise there will be some problem such as:
No release upgrade script entry for xxxx-0.2.0 to xxxx-0.1.0 in file
I cannot import and therefore cannot call a function of another module in my 'main' module. I am an Erlang newbie. Below is my 'main' module.
-module('Sysmod').
-author("pato").
%% API
-export([ hello_world/0,sayGoodNight/0]).
-import('Goodnight',[sayGoodNight/0]).
hello_world()->
io:fwrite("Hello World\n").
Below is the other module which is being imported.
-module('Goodnight').
-author("pato").
%% API
-export([sayGoodNight/0]).
sayGoodNight() ->
io:format("Good night world\n").
I cannot even compile my 'main' module(Sysmod), once I export the imported function, as it throws an undefined shell command error. It compiles when I have imported the module and function, but cannot execute the function and it throws a undefined function error. I have checked out [this answer]1 and also looked at [erlang man pages on code server]2.
In addition, I managed to add_path of the Erlang Decimal library successfully as below attempting my app to talk to an external library.
12> code:add_path("/home/pato/IdeaProjects/AdminConsole/erlang-decimal-master/ebin"). true
But cannot run any Decimal function successfully as shown below.
decimal:add("1.3", "1.07").** exception error: undefined function decimal:add/2
In short, the first method,(I know its not recommended due to unreadability) of intermodule communication using import is not working. As I looked for a solution, I realized the add-path only works with modules that have an ebin directory.
I am stuck. How do I make my modules talk to each other including an external library added successfully by add_path? I have heard of exref, i cannot grasp the Erlang man pages. I need someone to explain it to me like a five year old. Thank you.
I am an Erlang newbie
Don't use import. No one else does. It's bad programming practice. Instead, call functions by their fully qualified names, i.e. moduleName:functionName
throws a undefined function error
You didn't compile the module you are trying to import. Also, you can't export a function that is not defined within a module.
Here's an example:
~/erlang_programs$ mkdir test1
~/erlang_programs$ cd test1
~/erlang_programs/test1$ m a.erl %%creates a.erl
~/erlang_programs/test1$ cat a.erl
-module(a).
-compile(export_all).
go()->
b:hello().
~/erlang_programs/test1$ erl
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.3 (abort with ^G)
1> c(a).
a.erl:2: Warning: export_all flag enabled - all functions will be exported
{ok,a}
2> a:go().
** exception error: undefined function b:hello/0
3>
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
(v)ersion (k)ill (D)b-tables (d)istribution
~/erlang_programs/test1$ mkdir test2
~/erlang_programs/test1$ cd test2
~/erlang_programs/test1/test2$ m b.erl %%creates b.erl
~/erlang_programs/test1$ cat b.erl
-module(b).
-compile(export_all).
hello() ->
io:format("hello~n").
~/erlang_programs/test1/test2$ erlc b.erl
b.erl:2: Warning: export_all flag enabled - all functions will be exported
~/erlang_programs/test1/test2$ ls
b.beam b.erl
~/erlang_programs/test1/test2$ cd ..
~/erlang_programs/test1$ erl
Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V9.3 (abort with ^G)
1> c(a).
a.erl:2: Warning: export_all flag enabled - all functions will be exported
{ok,a}
2> a:go().
** exception error: undefined function b:hello/0
3> code:add_path("./test2").
true
4> a:go().
hello
ok
When i run command elixir -v or mix, it will return:
{"init terminating in do_boot",{undef,[{elixir,start_cli,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()
Some details:
$ brew list
elixir erlang ...
$ erl
Erlang/OTP 19 [erts-8.0] [source-6dc93c1] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V8.0 (abort with ^G)
1>
$ elixir
Usage: elixir [options] [.exs file] [data]
-e COMMAND Evaluates the given command (*)
-r FILE Requires the given files/patterns (*)
...
I have used brew uninstall, reinstall, but nothing change. Please help me fix it!
erl without any arguments will run Erlang shell. But if you want to run Elixir shell you should try running iex (interactive elixir). elixir is used to run programs you already coded, like elixir simple.exs
Or it might be that your Erlang version is little out of date. Try running brew update.
I am trying to setup a rebar release for my otp application. I followed this guide: https://github.com/basho/rebar/wiki/Getting-started
When I try to generate a release, I get lots of enotdir errors:
~/Projekte/mc-erl/repo $ ./rebar generate
==> rel (generate)
Error reading /home/clonejo/Projekte/mc-erl/repo/rebar/rebar_app_utils.beam's file info: enotdir
Error reading /home/clonejo/Projekte/mc-erl/repo/rebar/rebar_deps.beam's file info: enotdir
Error reading /home/clonejo/Projekte/mc-erl/repo/rebar/rebar_appups.beam's file info: enotdir
[... enotdir errors go on ...]
[... all above enotdir errors are repeated ...]
ERROR: Unable to generate spec: read file info /usr/lib/erlang/man/man1/preunzip.1 failed
This is my version of erlang:
$ erl
Erlang R15B (erts-5.9) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.9 (abort with ^G)
I got rebar at http://cloud.github.com/downloads/basho/rebar/rebar (see the GettingStarted wiki page).
Update: Verbose mode only adds one warning, which is unrelated:
WARN: 'generate' command does not apply to directory /home/clonejo/Projekte/mc-erl/repo/apps/mc_erl
Most likely, you have installed the "reloader" module somehow, perhaps via your .erlang? That specific error message originates from there.
Could you run it with -v
There was and maybe still is a bug
http://lists.basho.com/pipermail/rebar_lists.basho.com/2011-July/000932.html
I would suggest to update rebar and run rebar -v to see more info.
I got this error on my ubuntu when I run debugger:start().
Erlang R14B02 (erts-5.8.3) [source] [smp:4:4] [rq:4] [async-threads:0] [kernel-poll:false]
Eshell V5.8.3 (abort with ^G)
1> debugger:start().
=ERROR REPORT==== 14-Feb-2012::17:57:27 ===
ERROR: Could not find 'wxe_driver.so' in: /usr/local/lib/erlang/lib/wx-0.98.9/priv
{ok,<0.36.0>}
I want to know how to fix the error in order to use debugger ?
Are you running the default erlang running on ubuntu? Unfortunately there is no longer any erlang-wx package in ubuntu, see this for a discussion on why.
I would recommend downloading the deb package from here or just building erlang from source.