Recently in the toss Ejabberd, the Ejabberd project configuration to eclipse in the compilation, debugging, etc., now write down the process, hoping to help the people in need.
Get ready
- This environment is carried out in Linux, Blogger's Linux is fedora20.
- Installing Erlang
- Install Eclipse
- Install Eclipse plugin: erlide
- The above installation process please self-search related tutorials, this article slightly.
Below we will conquer the problems encountered in importing ejaberd into the eclipse process.
Download the Ejabberd project source code and import the entire project into eclipse, so don't ask me! Then there are all sorts of horrible mistakes:
- -include_lib ("P1_xml/include/xml.hrl"). Error
- Where XML modules are used are errors such as presence: {binary (), Xmlel ()}--type xmlel () undefined error, which is caused by the failure of the include related library
The error is due to the fact that some of Process-one's infrastructure or tooling modules are referenced in the project:
- Esip
- Goldrush
- lager--formatted output for error day to
- P1_cache_tab
- ...
Here's how to fix it:
In the Ejabberd source folder root directory, run in Terminal:
./rebar Get-deps
This will download the required tool module and place it under the Deps folder.
Then compile the tool library:
./rebar Compile
The tool library is compiled into modules that can run in the Erlang environment, many modules are written in application behaviour, and in ejabberd there are many shapes like: Application:start (app name). Such code, Launch the tool application.
After the download has been compiled, copy all the files under the Deps directory to the Lib folder in which Erlang resides in your system, as in my system with the following command:
sudo cp-r./deps/*/usr/local/lib/erlang/lib/
Replace the target directory with a directory on your system so that Erlang can use these applications and modules, and the Include_lib statement is happy.
After solving the above problem, there is a big problem: Can't find the XMPPADDR.HRL file!!!
Xmppaddr.hrl needs to be generated from the XMPPADDR.ASN1, the file is in the ASN1 folder under the Source code folder, which can be compiled into a. hrl file using Erlang's compilation tool. For details, see: http://www.erlang.org/doc/apps/asn1/asn1_ug.html, here withheld. I can post the file I produced as follows:
%% Generated by the Erlang ASN.1 compiler version:3.0.1 %% Purpose:erlang Record Definitions for each named and unnamed %% SEQUENCE and SET, and macro definitions for each value %% definition,in Module Xmppaddr-ifndef (_xmppaddr_hrl_). true ). -define (' id-on-xmppaddr ', {1,3,6,1,5,5,7,8,5}). %% _xmppaddr_hrl_
Name the above Xmppaddr.hrl and copy it to the Ejabberd project include folder.
Finally, the Erlang runtime chosen by eclipse will be the same as the one previously compiled, otherwise it will not work as follows:
In the menu: window/prefrences/erlang/installed runtimes Check the corresponding runtime.
After the above ejabberd can be compiled in eclipse, but the distance running up there is still a big gap.
Ejabberd.app file is missing, the workaround is to rename the ejabberd.app.src.in file under the SRC folder to ejabberd.app into the compiled input directory, which is the. beam file directory, also the Ebin folder.
You can run a lot of startup code at this point, but the estimation program will not find the configuration file to terminate, please keep track of the Code, self-modification, and recompile.
Ejabberd Boot mode: Run in Elipse console (entered Erlang command line):
Erjabberd:start (). Percent of this is Ejabberd's entrance!
In general, please feel free to ask questions.
Ejabberd configuration, commissioning, and operation in Eclipse (Erlide)