[erlang-questions] How can I debug this?

80 views
Skip to first unread message

Ian

unread,
Jul 20, 2012, 10:05:20 AM7/20/12
to erlang-questions Questions
Hi All,

I am attempting to work through the Chicago Boss quickstart tutorial at
https://github.com/evanmiller/ChicagoBoss/wiki/Quickstart

I am using Windows 7 - 64 bit, and the R15B release of Erlang. New to
Erlang.

First a minor bug - I think I installed the 32 bit version, removed it,
and installed the 64 bit version. Then I discovered that the 64 bit
version's bin directory is C:\Program Files\erl5.9.1\bin but the
directory in the path was C:\Program Files (x86)\erl5.9.1\bin. That was
why nothing worked.

After that was corrected, I created the project and set up the file in
Step 4, before starting the server with start-server.bat. The werl
window flashed up an error message for a second or so - and vanished
before I could read it!

A few tries later I was able to catch it in a screen dump. The error
message was:

{"init terminating in
do_boot",{undef,[{boss,start,[],[],{init,start_it,1,[{file
,"init.erl"},[line,1041}]},{init,start_em,1,[{file,"init.erl"},{line,1022}]}]}}


(copied by hand)

I know this means the server did not start up. But why, and what have I
done wrong/missed out? I have not found a init.erl file.

My project is called erlian and is in d:\erlian . The file
D:\erlian\src\controller\erlian_greeting_controller.erl
contains:

-module(erlian_greeting_controller, [Req]).
-compile(export_all).

hello('GET', []) ->
{output, "<strong>Erlian says hello!</strong>"}.

(copy/pasted)

Help much appreciated.

Ian



_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Ian

unread,
Jul 20, 2012, 11:18:06 AM7/20/12
to erlang-q...@erlang.org
Further information:

It is something to do with Windows and/or my windows setup.

I tried the same tutorial in Ubuntu, in a VM and it worked as advertised.

Regards

Dave Cottlehuber

unread,
Jul 21, 2012, 3:36:06 PM7/21/12
to hobs...@gmail.com, erlang-q...@erlang.org
Hi Ian,

I've tested & get the same issue here as well. On my
side, the issue is that for some reason, boss isn't being
compiled correctly. I was able to build it manually but
can't see immediately why this doesn't work within the
rebar structure.

You can edit start-server.bat and replace werl for erl, this at
least means you can see the error messages in the command
prompt.

Let's move this to the Chicago Boss list, can you re-post there
with the output from your original windows-make script perhaps?

A+
Dave

tom kelly

unread,
Jul 22, 2012, 11:16:06 AM7/22/12
to hobs...@gmail.com, erlang-q...@erlang.org
Hi Ian,

I'm CC'ing the list again. It was probably a typo not including them on your mail? and I think it's important that more people see you points. If we want Erlang usage to grow it's important that we address issues like this as much as possible.

I'm happy to hear my input helped, and I find your comments as a newbie interesting. I didn't see that thread your referenced last week (going to search for it as soon as I hit send) but I'm sure we can all associate with the frustrations of struggling with unfamiliar tools or environments. I can only speak for myself but will try to smooth things for newbies, even if it's only by replying to similar questions here more often.

//TTom


On Sat, Jul 21, 2012 at 10:16 PM, Ian <hobs...@gmail.com> wrote:
Hi Tom,

Your right - it cannot find boss.beam.  There is no such file on my system.

After some investigation on the Ubuntu system, I discover that it should be in D:\ChicagoBoss\bin with a lot of other .beam files.

In fact the ChicargoBoss\bin directory has no .beam files at all. So I tried to compile them. That crashed.

After some more investigation it appears that  the file D:\ChicagoBoss\deps\proper\include\compile_flags.hrl did not exist.

What should it contain? Back to the Unbuntu system and found that it is empty! After "touching" it, the compile worked and I now have a running system under windows. Thank you for your help - it was just the information I needed.

I wrote last week in another thread that I agreed with Dimitii in his talk in Stockholm that it was too difficult to do the easy stuff in Erlang. It has taken two days and help from kind people to get me over these initial teething problems.

But note that I was doing real basic newbie stuff.  I downloaded the STANDARD install of erlang for my operating system, and the STANDARD install of Chicago Boss, installed them into the STANDARD locations, and attempted to set up a web server to serve "Hello World" following instructions included with those downloads.

But look at what went wrong.
  The install of Erlang did not set it up my path.
  Chicago Boss assumed I had a suitable Make on my machine.
  Chicago Boss failed to create a file that was necessary.
  The error message was incomprehensible to a newbie.

Trivial problems for the experienced Erlang buff, I'm sure, but for a newbie (or a manager who is authorising the investigation) they are stoppers.  These problems must be slowing the adoption of Erlang. That is a pity, because Erlang is very strongly positioned for major growth because it is "the way" to take advantage of multiple cores.  Actors, message passing, no shared state, no slouch, reliable and easy to scale to multiple cores/cpus - what's not to like?
</rant>

Thanks again Tom, your information was all I needed.

Ian


On 21/07/2012 14:51, tom kelly wrote:
Hi,
I've never worked with Chicago boss but it looks like your start script doesn't have the path to boss.beam.

Your error message:
{"init terminating in do_boot",{undef,[{boss,start,[],[],{init,start_it,1,[{file,"init.erl"},[line,1041}]},{init,start_em,1,[{file,"init.erl"},{line,1022}]}]}}

says that during startup it tried to call "boss:start()." but that this is undefined, probably because it didn't have boss.beam in its path.
You should locate boss.beam on your system and check that its location is added.
HTH,
//TTom.

Joe Armstrong

unread,
Jul 25, 2012, 4:25:18 AM7/25/12
to hobs...@gmail.com, erlang-questions Questions
> {"init terminating in
> do_boot",{undef,[{boss,start,[],[],{init,start_it,1,[{file
> ,"init.erl"},[line,1041}]},{init,start_em,1,[{file,"init.erl"},{line,1022}]}]}}

This error message means Erlang cannot find the file boss.beam - some
code has tried to
evaluate the function boss:start() (That's what the cryptic error
message means) and the module
boss is not loaded. When this happens the system tries to find a file
called boss.beam - this must
be one of the files in the code load path.

To debug this - start erlang (If you can't start erlang at all) you're screwed.
then in the erlang shell give the command and code:get_path()
(Or io:format("~p~n",[code:get_path()]).

When I do this I see this:

1 > io:format("~p~n",[code:get_path()]).
[".","/usr/local/lib/erlang/lib/kernel-2.15/ebin",
"/usr/local/lib/erlang/lib/stdlib-1.18/ebin",
...
"/home/joe/projects/doc42/ebin","/home/joe/projects/validate",
"/home/joe/nobackup/erlang_imports/deps/meck/ebin",
"/home/joe/nobackup/erlang_imports/deps/cowboy/ebin",
"/home/joe/nobackup/erlang_imports/deps/bitcask/ebin"]

One of these directories should contain the file boss.beam

Since boss.beam is not in your path you have to find and add it to your path.
This can be done in (at least) three ways:

If boss.beam is in the directory DIR then you can evaluate this:

> code:add_pathz(Dir).

in the shell

Better is to add it to the erlang startup file.

On a unix or mac you just make a file called ".erlang" which is either
on ${HOME}/.erlang
or the directory you start erlang from.

I tried to do this on windows but I have no evironment variable HOME
and I do now have write permissions
under Program Files (or whatever)

(( Actually I'd like to keep an up-to-date install guide on the erlang
web site so if anybody
could tell me how to make a .erlang file on windows I would be appreciate this))

Once we know how to make a .erlang file I can fill in the details of
how to get your
boss example running.

Just keep mailing back to this thread every time you have a problem
and we'll get it fixed.

Cheers

/Joe

Ian

unread,
Jul 25, 2012, 5:49:29 AM7/25/12
to Joe Armstrong, erlang-questions Questions
Hi Joe,

Thanks for the reply!

On 25/07/2012 09:25, Joe Armstrong wrote:
> On a unix or mac you just make a file called ".erlang" which is either
> on ${HOME}/.erlang or the directory you start erlang from. I tried to
> do this on windows but I have no evironment variable HOME and I do now
> have write permissions under Program Files (or whatever) (( Actually
> I'd like to keep an up-to-date install guide on the erlang web site so
> if anybody could tell me how to make a .erlang file on windows I would
> be appreciate this
The equivalent of HOME is %USERPROFILE%.

The more tricky problem with the windows install was that the install
script does not change the path variable. I guess because there might be
more than one version of erlang installed. The more satisfactory
solution is to add the <install location>/bin to the path.
Setting up a erl.bat and .werl.bat files is not enough because escript
remains broken, and that leads to further problems.


> )) Once we know how to make a .erlang file I can fill in the details
> of how to get your boss example running. Just keep mailing back to
> this thread every time you have a problem and we'll get it fixed.
> Cheers /Joe
Thanks for the offer. I'll try not to waste people's time.

Dave Cottlehuber

unread,
Jul 25, 2012, 8:14:34 AM7/25/12
to erlang-questions Questions
On 25 July 2012 10:25, Joe Armstrong <erl...@gmail.com> wrote:
> Better is to add it to the erlang startup file.
>
> On a unix or mac you just make a file called ".erlang" which is either
> on ${HOME}/.erlang
> or the directory you start erlang from.
>
> I tried to do this on windows but I have no evironment variable HOME
> and I do now have write permissions
> under Program Files (or whatever)
>
> (( Actually I'd like to keep an up-to-date install guide on the erlang
> web site so if anybody
> could tell me how to make a .erlang file on windows I would be appreciate this))

On Windows, the HOME env var trick doesn't work, you need to use the
current working directory of the werl/erl process instead.
@Joe what format (or where in OTP source) is best for documenting
this? I've got a few other things that would be useful too.

## Creating a working .erlang file:

- open notepad or <decent_editor_of_your_choice>, and paste this in,
or whatever you prefer:

c:pwd(), io:format("running .erlang~n", []).

- file -> save as ".erlang" including the double quotes. This tells
the dialog box NOT to add .txt, just to use the provided filename.

## Create a shortcut to use this new startup file:

- right-click on desktop
- create new shortcut
- enter path c:\erlang\bin\werl.exe (or where-ever you installed the
appropriate version)
- name it whatever & click finish
- right-click on new icon & select "properties"
- change "Start In" field to the directory you want to load your
.erlang file from
- click OK

## Alternatively, from command line

start /d c:\home c:\erlang\bin\werl.exe

Or:

- change directory to the same folder as your .erlang file
- run c:\erlang\bin\werl.exe (or erl.exe)

BTW Ian's original issue is that Chicago Boss uses proper as a rebar
dependency, and proper uses some shell scripts which don't work under
native windows. This prevents Boss from compiling successfully
depending on what unix-like shell you are using, if any.

A+
Dave

Joe Armstrong

unread,
Jul 25, 2012, 10:17:04 AM7/25/12
to Dave Cottlehuber, erlang-questions Questions
On Wed, Jul 25, 2012 at 2:14 PM, Dave Cottlehuber <da...@muse.net.nz> wrote:
> On 25 July 2012 10:25, Joe Armstrong <erl...@gmail.com> wrote:
>> Better is to add it to the erlang startup file.
>>
>> On a unix or mac you just make a file called ".erlang" which is either
>> on ${HOME}/.erlang
>> or the directory you start erlang from.
>>
>> I tried to do this on windows but I have no evironment variable HOME
>> and I do now have write permissions
>> under Program Files (or whatever)
>>
>> (( Actually I'd like to keep an up-to-date install guide on the erlang
>> web site so if anybody
>> could tell me how to make a .erlang file on windows I would be appreciate this))
>
> On Windows, the HOME env var trick doesn't work, you need to use the
> current working directory of the werl/erl process instead.
> @Joe what format (or where in OTP source) is best for documenting
> this? I've got a few other things that would be useful too.

Plain text is fine - I'll reformat if necessary - it's the content
that's the important bit

>
> ## Creating a working .erlang file:
>
> - open notepad or <decent_editor_of_your_choice>, and paste this in,
> or whatever you prefer:
>
> c:pwd(), io:format("running .erlang~n", []).

Or

io:format("running .erlang in ~p~n", [file:get_cwd()]).

>
> - file -> save as ".erlang" including the double quotes. This tells
> the dialog box NOT to add .txt, just to use the provided filename.
>
> ## Create a shortcut to use this new startup file:
>
> - right-click on desktop
> - create new shortcut
> - enter path c:\erlang\bin\werl.exe (or where-ever you installed the
> appropriate version)
> - name it whatever & click finish
> - right-click on new icon & select "properties"
> - change "Start In" field to the directory you want to load your
> .erlang file from
> - click OK

It worked - thanks

>
> ## Alternatively, from command line
>
> start /d c:\home c:\erlang\bin\werl.exe
>
> Or:
>
> - change directory to the same folder as your .erlang file
> - run c:\erlang\bin\werl.exe (or erl.exe)
>
> BTW Ian's original issue is that Chicago Boss uses proper as a rebar
> dependency, and proper uses some shell scripts which don't work under
> native windows. This prevents Boss from compiling successfully
> depending on what unix-like shell you are using, if any.

Sigh - then we'll have to compile chicago boss manually
(or fix the scripts)

Manual compilation is something like ..

$ cd ~/Downloads/ChicagoBoss-0.7.5/src/boss
$ erlc .o ../../ebin -I ../../include *.erl

You'll have to do this for each directory that has .erl files in it

/Joe


> cd
Reply all
Reply to author
Forward
0 new messages