How do I include the wx libraries, that are shipped with erlang (/lib/erlang/lib/wx-2.1.2), in my rebar3 release? I do not understand where to copy those files and how to declare them in my rebar.config file.
I use this code in my app:
-module(main_window).
-include_lib("wx/include/wx.hrl").
-include("state_records.hrl").
-export([start/0]).
start() ->
Wx = wx:new(),
State = wx:batch(fun() -> create_window(Wx) end),
wxWindow:show(State#state.frame),
loop(State),
wx:destroy(),
ok.
...
Starting my app by running rebar3 compile and then rebar3 shell works. But when I use rebar3 release I get the following output:
===> There are missing function calls in the release.
===> Make sure all applications needed at runtime are included in the release.
===> main_window:create_window/1 calls undefined function wxBoxSizer:new/1
===> main_window:create_window/1 calls undefined function wxFrame:connect/2
===> main_window:create_window/1 calls undefined function wxFrame:createStatusBar/2
===> main_window:create_window/1 calls undefined function wxFrame:new/4
===> main_window:create_window/1 calls undefined function wxFrame:setIcon/2
===> main_window:create_window/1 calls undefined function wxFrame:setMenuBar/2
===> main_window:create_window/1 calls undefined function wxFrame:setStatusText/3
===> main_window:create_window/1 calls undefined function wxIcon:new/2
...
According to the documentation here applications that relx will add into release should be mentioned as a list see <app>.
Running rebar3 release will build the release and provide a script for starting a node under _build//rel//bin/.
<release_name> must be an atom, same for each in the list of applications to include in the release.
{relx, [{release, {<release name>, <vsn>},
[<app>]},
{dev_mode, true},
{include_erts, false},
{extended_start_script, true}]}.
Related
I am trying to install ChicagoBoss based on the instructions here. Now, Make is failing with exception -
=ERROR REPORT==== 14-Dec-2022::11:15:33.605319 ===
beam/beam_load.c(148): Error loading module rebar:
please re-compile this module with an Erlang/OTP 25 compiler
escript: exception error: undefined function rebar:main/1
in function escript:run/2 (escript.erl, line 750)
in call from escript:start/1 (escript.erl, line 277)
in call from init:start_em/1
in call from init:do_boot/3
make: *** [compile] Error 127
I have further installed rebar3 using command -
homebrew install rebar3
I am running Erlang OTP/25 in mac. I haven't been able to understand if it's a problem with
rebar3
or
ChicagoBoss
The problem is with ChicagoBoss. It includes a rebar binary that was compiled with Erlang/OTP release 17, but Erlang/OTP release 25 can only use modules compiled with release 21 or later.
The rebar binary starts with the line #!/usr/bin/env escript, meaning that it looks for escript in the PATH. This picks up release 25, causing this problem. You could try installing release 24 or earlier to work around this.
You might find ASDF useful for switching between Erlang versions: https://github.com/asdf-vm/asdf-erlang
erlang 24.3.3, rebar3 are used.
rebar3 as default keyboard
show the following message
bash-3.2$ rebar3 as default tar
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling keyboard
===> Assembling release keyboard-0.0.1.0...
===> Warnings generating release:
*WARNING* stdlib: Object code (filename) out of date
===> Release successfully assembled: _build/default/rel/keyboard
===> Building release tarball keyboard-0.0.1.0.tar.gz...
===> Tarball successfully created: _build/default/rel/keyboard/keyboard-0.0.1.0.tar.gz
what's the meaning of this warning message?
I am unable to use ejabberd_auth in my helloworld project.
-behaviour(ejabberd_auth).
...
....
try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).
With that I get the error warning:
helloworld.erl:15: Warning: behaviour ejabberd_auth undefined
-import(ejabberd_auth, [try_register/3]).
...
....
try_register(<<"username">>, <<"example.com">>, <<"secret_password">>).
With this I get:
exception error: undefined function ejabberd_auth:try_register/3
Why am I unable to access ejabberd_auth?
I am using IntelliJ Idea, with the Erlang plugin installed.
Thank you all in advance.
UPDATE:
I'm on Ubuntu 16.04 LTS
I can get you past that error. Here's how...
When I compile a module in the erlang shell, the compiler creates a .beam file in the same directory, which allows me to call functions defined in the module. In your case, if you cd into the directory:
.../ejabberd/ebin
you will see all the ejabberd .beam files, including ejabberd_auth.beam. If you start an erlang shell in that directory, then issue your function call (don't compile anything), you won't get that error anymore.
But, then I get the error:
exception error: undefined function jid:nodeprep/1
in function ejabberd_auth:validate_credentials/3 (src/ejabberd_auth.erl, line 796)
in call from ejabberd_auth:try_register/3 (src/ejabberd_auth.erl, line`
There is no jid.beam file in that directory. But:
~/Downloads/ejabberd$ find . -name jid.beam
./deps/xmpp/ebin/jid.beam
You are going to have to figure out how to compile your module so that all the ejabberd modules are available to your program. See: ejabberd how to compile new module.
I am unable to use ejabberd_auth in my helloworld project.
Are you following a tutorial somewhere?
I have added poison library to rebar.config file:
{
deps, [
poison
]
}.
But when I run rebar3 compile, it shows me an error:
===> Package <<"poison">> not found. Fetching registry updates and trying again...
...
===> Package not found in registry: <<"poison">>.
How do I make it work?
While compiling one app, i am getting below error
==> dynamo
Compiled lib/dynamo/base.ex
Compiled lib/dynamo/connection/behaviour.ex
== Compilation error on file lib/dynamo/connection/query_parser.ex ==
** (CompileError) lib/dynamo/connection/query_parser.ex:2: undefined function defexception/2
(elixir) src/elixir.erl:188: :elixir.quoted_to_erl/3
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6
(elixir) src/elixir.erl:156: :elixir.erl_eval/2
could not compile dependency dynamo, mix compile failed. You can recompile this dependency with
`mix deps.compile dynamo` or update it with `mix deps.update dynamo`
but not able to understand the problem. Version details are show below that i am using,
Erlang/OTP 17 [erts-6.1]
Interactive Elixir (0.14.1)
Dynamo is using an incompatible Elixir version. Open up the mix.exs file inside the deps/dynamo checkout in your repository and see the closest version Dynamo was running against.
Also note Dynamo is no in active development, you will likely have better luck with Phoenix.