How to Compile a Module Under Windows

This page describes a method to compile individual .erl files under Microsoft Windows.

  1. Copy the .erl file to the directory where you installed ejabberd, for example C:/ejabberd/. In some occasions you may need to copy additional .hrl files. You can copy those files from the source code package (or from SVN repository) to the ejabberd installation directory.

  2. Stop ejabberd in case it is running.

  3. Start ejabberd using the shortcut. A window will appear in which you can enter commands:

    Erlang (BEAM) emulator version 5.4.13 [threads:0]
    
    Eshell V5.4.13  (abort with ^G)
    (ejabberd@arfle)1>
  4. Compile the .erl file. In this example we compile the file mod_ctlextra.erl:

    (ejabberd@arfle)2> c(mod_ctlextra).
    {ok,mod_ctlextra}
  5. If the source code was correctly compiled, you will see a new .beam file in the ejabberd directory, in this case mod_ctlextra.beam. Copy it to the ebin directory.

Common Errors

  • (ejabberd@arfle)2> c(mod_ctlextra).
    ./mod_ctlextra.erl:none: no such file or directory
    error

    The .erl file was not found. It has a different name, or you have put it in a different directory. You must copy the .erl file to the directory reported by the pwd command:

    (ejabberd@arfle)4> pwd().
    C:/Program files/Ejabberd
    ok
  • (ejabberd@arfle)5> c(mod_ctlextra).
    ebin/mod_ctlextra.erl:39: can't find include file "ejabberd_ctl.hrl"
    ebin/mod_ctlextra.erl:40: can't find include file "jlib.hrl"
    ...
    error

    To compile that .erl file you need to copy the listed header files to the same directory.

  • =ERROR REPORT==== 18-May-2006::11:41:03 ===
    E(<0.39.0>:gen_mod:47): {undef,[{mod_ctlextra,start,["localhost",[]]},
                                    {gen_mod,start_module,3},
                                    {lists,foreach,2},
                                    {ejabberd_app,start,2},
                                    {application_master,start_it_old,4}]}

    Once you have compiled the .erl file, you must copy the resulting .beam file to the ebin/ directory.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Does not seem to work for me...

HI,

I tried this solution with both mod_webpresence and mod_log_chat from SVN with my windows ejabberd 1.1.4 and I can compile wothout error but the modules don't start...

Anyone have an idea?

I copied the compiled files to C:\WEB\ejabberd-1.1.4\lib\ejabberd-1.1.4\ebin\ (which is where my other mods are also located)

You can contact me at cs (AT) aplsystems.de (jabber and mail)

errors in LOG:

=CRASH REPORT==== 20-Dec-2007::19:28:36 ===
  crasher:
    pid: <0.290.0>
    registered_name: 'ejabberd_mod_webpresence_xxx.de'
    error_info: {undef,
                     [{gen_mod,
                          get_opt_host,
                          ["aplsystems.de",
                           [{host,"webstatus.jabber.xxx.de"},
                            {pixmaps_path,"C:/WEB/ejabberd-1.1.4/pixmaps"}],
                           "webpresence.@HOST@"]},
                      {mod_webpresence,init,1},
                      {gen_server,init_it,6},
                      {proc_lib,init_p,5}]}
    initial_call: {gen,init_it,
                      [gen_server,
                       <0.203.0>,
                       <0.203.0>,
                       {local,'ejabberd_mod_webpresence_xxx.de'},
                       mod_webpresence,
                       ["aplsystems.de",
                        [{host,"webstatus.jabber.xxx.de"},
                         {pixmaps_path,"C:/WEB/ejabberd-1.1.4/pixmaps"}]],
                       []]}
    ancestors: [ejabberd_sup,<0.36.0>]
    messages: []
    links: [<0.203.0>]
    dictionary: []
    trap_exit: false
    status: running
    heap_size: 610
    stack_size: 21
    reductions: 2183
  neighbours:


E(<0.36.0>:gen_mod:47): {undef,
                            [{ejabberd_logger,
                                 debug_msg,
                                 [mod_log_chat,
                                  31,
                                  " ~p  ~p~n",
                                  ["aplsystems.de",
                                   [{path,"C:/WEB/ejabberd-1.1.4/chatlog"}]]]},
                             {mod_log_chat,start,2},
                             {gen_mod,start_module,3},
                             {lists,foreach,2},
                             {ejabberd_app,start,2},
                             {application_master,start_it_old,4}]}

Check the documentation

the Joe wrote:

I tried this solution with both mod_webpresence and mod_log_chat from SVN with my windows ejabberd 1.1.4 and I can compile without error but the modules don't start...

Anyone have an idea?

mod_webpresence has a README.txt file. Read it to understand why the module doesn't work correctly for you.

Saw it...

Thanks for the answer...

not for the 1.1.x version saw it now...
I feel kinda stupid :)

Syndicate content