[erlang-questions] Questions about OTP debugging...

Peter W. Morreale <>
Tue Feb 1 15:58:25 CET 2011


On Tue, 2011-02-01 at 07:44 +0100, Bengt Kleberg wrote:
> Greetings,
> 
> Your error message seems to indicate that the tcp_rpc module is not
> loaded. Since Erlang loads beam files automatically if they are in the
> path this could be two problems.
> 1 You do not have the right path
> 2 You do not have the beam file
> 
> Can you locate the file tcp_rpc.beam on your system?

Thanks for the response.

There is no tcp_rpc.beam in this example from the book.  I needed to
create a tcp_rpc.app file in the ebin dir, which defines the modules for
the application.  

(This is chapter 4 of the "Erlang and OTP in Action" book.)

> When you have started Erlang, can you find the directory where the bream
> file resides in your path (see code:get_path/0)?
> 
> 
> bengt
> 

I *think* I have everything in the right place.  Here is what I have for
a directory layout and compile/run (including a code:get_path()):

:~/erlang/tcp_rpc> ls -R
:
doc  ebin  include  priv  src

/doc:

/ebin:
tcp_rpc.app  tr_app.beam  tr_server.beam  tr_sup.beam

/include:

/priv:

/src:
tr_app.erl  tr_server.erl  tr_sup.erl
:~/erlang/tcp_rpc> more ebin/tcp_rpc.app 
%% -*- mode: Erlang; fill-column: 75; comment-column: 50; -*-

{application, tcp_rcp, [
	{description, "RPC server for Erlang testing"}, 
	{vsn, "0.1.0"},
	{modules, [tr_app, tr_sup, tr_server]},
	{registered, [tr_sup]},
	{applications, [kernel, stdlib]},
	{mod, {tr_app, []}}
	]}.
:~/erlang/tcp_rpc> erlc -o ebin src/*.erl
:~/erlang/tcp_rpc> erl -pa ebin
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:2:2] [rq:2]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
1> application:start(tcp_rpc).
{error,{not_loaded,tcp_rpc}}
2> 
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
a
:~/erlang/tcp_rpc> erl -pa ebin
Erlang R14B (erts-5.8.1) [source] [64-bit] [smp:2:2] [rq:2]
[async-threads:0] [hipe] [kernel-poll:false]

Eshell V5.8.1  (abort with ^G)
1> code:get_path().
["ebin",".","/usr/lib64/erlang/lib/kernel-2.14.1/ebin",
 "/usr/lib64/erlang/lib/stdlib-1.17.1/ebin",
 "/usr/lib64/erlang/lib/xmerl-1.2.6/ebin",
 "/usr/lib64/erlang/lib/wx-0.98.7/ebin",
 "/usr/lib64/erlang/lib/webtool-0.8.7/ebin",
 "/usr/lib64/erlang/lib/typer-0.1.7.5/ebin",
 "/usr/lib64/erlang/lib/tv-2.1.4.6/ebin",
 "/usr/lib64/erlang/lib/tools-2.6.6.1/ebin",
 "/usr/lib64/erlang/lib/toolbar-1.4.1/ebin",
 "/usr/lib64/erlang/lib/test_server-3.4.1/ebin",
 "/usr/lib64/erlang/lib/syntax_tools-1.6.6/ebin",
 "/usr/lib64/erlang/lib/ssl-4.0.1/ebin",
 "/usr/lib64/erlang/lib/ssh-2.0.1/ebin",
 "/usr/lib64/erlang/lib/snmp-4.18/ebin",
 "/usr/lib64/erlang/lib/sasl-2.1.9.2/ebin",
 "/usr/lib64/erlang/lib/runtime_tools-1.8.4.1/ebin",
 "/usr/lib64/erlang/lib/reltool-0.5.4/ebin",
 "/usr/lib64/erlang/lib/public_key-0.8/ebin",
 "/usr/lib64/erlang/lib/pman-2.7.1/ebin",
 "/usr/lib64/erlang/lib/percept-0.8.4/ebin",
 "/usr/lib64/erlang/lib/parsetools-2.0.4/ebin",
 "/usr/lib64/erlang/lib/otp_mibs-1.0.6/ebin",
 "/usr/lib64/erlang/lib/os_mon-2.2.5/ebin",
 "/usr/lib64/erlang/lib/orber-3.6.17/ebin",
 "/usr/lib64/erlang/lib/odbc-2.10.8/ebin",
 "/usr/lib64/erlang/lib/observer-0.9.8.3/ebin",
 [...]|...]
2> 
BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
       (v)ersion (k)ill (D)b-tables (d)istribution
a


Thanks,
-PWM



More information about the erlang-questions mailing list