Antarix
Antarix

Reputation: 685

External module not loaded in Erlang

I am new here in Erlang. I am trying to load library which is hosted on git through rebar3 and been able to compile successfully. Now when I try to run my Erlang application call the main function which actually points to library module function it throws an error in shell 'module could not be loaded'.

I have tried code.get_path() but in that my module is not listed. So I am confused here. Can anyone help me out here ?

    ** Generic server <0.80.0> terminating 
** Last message in was {'DOWN',#Ref<0.1535589919.2261778436.90425>,process,
                               <0.79.0>,normal}
** When Server state == {st_tcprx,<0.79.0>,
                                  #Ref<0.1535589919.2261778436.90425>,
                                  #Port<0.612>,<0.79.0>,<<>>,true,undefined}
** Reason for termination == 
** {'module could not be loaded',
       [{smpp34pdu,pack,[0,2147483647,{unbind}],[]},
        {smpp34_tcprx,terminate,2,
            [{file,
                 "/home/antarix/IdeaProjects/smpp34/_build/default/lib/smpp34/src/mod/smpp34_tcprx.erl"},
             {line,69}]},
        {gen_server,try_terminate,3,[{file,"gen_server.erl"},{line,648}]},
        {gen_server,terminate,10,[{file,"gen_server.erl"},{line,833}]},
        {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,247}]}]}
** exception error: no match of right hand side value 
                    {'EXIT',
                        {{undef,
                             [{smpp34pdu,pack,
                                  [0,1,
                                   {bind_transceiver,"simple","simple123",[],
                                       52,0,0,[]}],
                                  []},
                              {smpp34_tx,handle_call,3,
                                  [{file,
                                       "/home/antarix/IdeaProjects/smpp34/_build/default/lib/smpp34/src/mod/smpp34_tx.erl"},
                                   {line,54}]},
                              {gen_server,try_handle_call,4,
                                  [{file,"gen_server.erl"},{line,636}]},
                              {gen_server,handle_msg,6,
                                  [{file,"gen_server.erl"},{line,665}]},
                              {proc_lib,init_p_do_apply,3,
                                  [{file,"proc_lib.erl"},{line,247}]}]},
                         {gen_server,call,
                             [<0.77.0>,
                              {send,0,
                                  {bind_transceiver,"simple","simple123",[],
                                      52,0,0,[]}}]}}}
     in function  smpp34module:start/0 (/home/antarix/IdeaProjects/smpp34/_build/default/lib/smpp34/src/smpp34module.erl, line 43)

Here is my code:get_path() output

    code:get_path().
["/home/antarix/IdeaProjects/smpp34",
 "/home/antarix/IdeaProjects/smpp34/_build/default/lib/smpp34/ebin",
 ".","/usr/lib/erlang/lib/kernel-5.3.1/ebin",
 "/usr/lib/erlang/lib/stdlib-3.4.1/ebin",
 "/usr/lib/erlang/lib/xmerl-1.3.15/ebin",
 "/usr/lib/erlang/lib/wx-1.8.1/ebin",
 "/usr/lib/erlang/lib/tools-2.10.1/ebin",
 "/usr/lib/erlang/lib/syntax_tools-2.1.2/ebin",
 "/usr/lib/erlang/lib/ssl-8.2/ebin",
 "/usr/lib/erlang/lib/ssh-4.5.1/ebin",
 "/usr/lib/erlang/lib/snmp-5.2.6/ebin",
 "/usr/lib/erlang/lib/sasl-3.0.4/ebin",
 "/usr/lib/erlang/lib/runtime_tools-1.12.1/ebin",
 "/usr/lib/erlang/lib/reltool-0.7.4/ebin",
 "/usr/lib/erlang/lib/public_key-1.4.1/ebin",
 "/usr/lib/erlang/lib/parsetools-2.1.5/ebin",
 "/usr/lib/erlang/lib/otp_mibs-1.1.1/ebin",
 "/usr/lib/erlang/lib/os_mon-2.4.2/ebin",
 "/usr/lib/erlang/lib/orber-3.8.3/ebin",
 "/usr/lib/erlang/lib/odbc-2.12/ebin",
 "/usr/lib/erlang/lib/observer-2.4/ebin",
 "/usr/lib/erlang/lib/mnesia-4.15/ebin",
 "/usr/lib/erlang/lib/megaco-3.18.2/ebin",
 "/usr/lib/erlang/lib/jinterface-1.8/ebin",
 "/usr/lib/erlang/lib/inets-6.4/ebin",
 "/usr/lib/erlang/lib/ic-4.4.2/ebin",
 "/usr/lib/erlang/lib/hipe-3.16/ebin",
 [...]|...]

Note : I am using Intellij for writing my code

Upvotes: 0

Views: 802

Answers (1)

mpm
mpm

Reputation: 3584

It looks like you are pooling smpp34pdu in incorrect manner. It should be as dependency to smpp34, but for some reason it isn't. Easiest solution would be adding smpp34pdu to your deps in reber.config.

smpp34 is also seven years old library, and you might expect some incompatibility issues with rebar3, and/or current version of Erlang (if you are using one). I would recommend cloning both repositories to your own GithHub account and fixing/adressing all issues you encounter. You could upgrade config to rebar3, and add smpp34pdu as dependency to smpp34.

Upvotes: 1

Related Questions