About rebar on Windows

Matthew Campbell matthew.campbell at asolutions.com
Tue Sep 20 21:12:30 EDT 2011


In order to get you to the correct answer for the root of your problem, I need to understand better what it is you're trying to do.  Why are you trying to run *that specific* werl.exe?  

If you are trying to start your application(s) in the generated node, then I strongly suggest using the "bin\nodename.cmd console" command which I mentioned earlier.  It's a convenient shorthand for the following command line, filling in all the necessary variables:

     %erts_bin%\werl.exe -boot %releases_dir%\%release_version%\%node_name%

(This causes the werl.exe process to bootstrap your node's applications (as specified in your reltool.config).)
 
If you are trying to install your application as a Windows Service, then you don't want werl.exe at all, and you need a different set of steps, also involving the runner script:

     node_root\bin\node_name.cmd install
     node_root\bin\node_name.cmd start

There are complementary "stop" and "uninstall" commands provided by the runner script as well.  If you have some sort of problem or limitation in running the generated runner script, then you will need to look at the script to understand the several steps it performs to determine the correct values to put into the necessary erlsrv.exe command lines.

In the unlikely event that you really just want to run a vanilla werl.exe environment without your node's application(s), just run whatever werl.exe is on your path, and don't worry about the one that was copied into your node.

The explanation for the error you're seeing doing what you're trying to do now is that the generated node either:

a -> doesn't come with the default erlang boot script.
b -> doesn't come with the correct (and large) set of libraries needed by the default boot script.
c -> a ++ b.

... and none of these is a bug.  Your node in production doesn't *need* all of those things, they would just be bloat.  That's why reltool builds you your boot scripts in the releases directories, and only copies over the libraries/applications you actually depend upon.

Hope this helps!

----- Original Message -----
From: "Roberto Aloi" <prof3ta at gmail.com>
To: "Matthew Campbell" <matthew.campbell at asolutions.com>
Cc: rebar at lists.basho.com
Sent: Tuesday, September 20, 2011 5:43:42 PM
Subject: Re: About rebar on Windows

Hi again,

Let's recap what my problem is.

I know how to use rebar, but this is the first time I'm trying it on a
Windows system.

I get a brand new copy of rebar, using git under cygwin:

git clone git at github.com:basho/rebar.git

I perform the bootstrap:

cmd /c bootstrap.bat

And I obtain the files rebar and rebar.bat that I can move to my
project (I will add them to the repo, once I know they work). At this
point the first problem occurs. The get-deps command doesn't work for
me and I obtain a 127 error on the function rebar_utils:sh/2:

cmd /c rebar.bat get-deps -> BANG!

Unfortunately, the suggestions here:

http://stackoverflow.com/questions/7129151/rebar-get-deps-does-not-play-well-with-msysgit-1-7-4-on-windows

won't help. I don't even have a git.cmd. My Git executable is a proper git.exe.

Anyway, let's live with this issue for the time being. I can still
clone the dependencies manually, so I do that. Then, I run on my
project's root:

cmd /c rebar.bat compile

Awesome. Everything seems to work. Let's generate the release:

cmd /c rebar.bat generate force=1

Everything looks fine, but if I try to execute the newly create
rel/XYZ/erts-5.8.4/bin/werl.exe I get the following:

cd rel/XYZ/erts-5.8.4/bin

cmd /c werl.exe
===
{"init terminating in
do_boot",{badarg,[{erl_prim_loader,check_file_result,3},{init,get_boot,1},{init,get_boot,2},{init,do_boot,3}]}}
(no error logger present) error: "Error in process <0.2.0> with exit
value: {badarg,[{erl_prim_loader,check_file_result,3},{init,get_boot,1},{init,get_boot,2},{init,do_boot,3}]}\n"

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

Abnormal termination
===
And that's where I'm stuck.

Matthew, I've seen your template and it will be very useful to create
the noderunner under Windows, but if I do not solve this preliminary
issue with werl.exe, I won't be able to use it...

Any suggestion on where to look for errors is very appreciated.

Kind regards,

Roberto Aloi
@robertoaloi



More information about the rebar mailing list