Making ejabberd run on LING VM
The log of changes follows:
A standard source of ejabberd from P1 (https://github.com/processone/ejabberd) does not work with rebar. There are a couple of "rebarized" versions. I took the one by treacheroustalks (https://github.com/treacheroustalks/ejabberd-app). There is also a required companion application, stringprep (https://github.com/treacheroustalks/stringprep-app). Both added as rebar dependencies.
c_src directories of both ejabberd and stringprep are moved to __REMOVED directory. rebar builds everything cleanly.
- standard deps
The following application dependencies found: sasl, crypto, public_key, ssl, mnesia. All this applications are imported to the image and start successfully.
Yet another dependency is stringprep. The purpose of the application is not clear. It is rewritten not to use driver and spew arguments of all calls.
application:start(ejabberd) fails because ejabberd_loglevel.erl uses a dynamic compilation (for efficiency?). Upon initialization ejabberd_loglevel:set(4) is called. The ejabberd_logger.erl module that corresponds to this level is generated and added to the source tree. The module is also added to ejabberd.app.
ejabberd_app:db_init restarts mnesia. Calling application:stop(mnesia) leads to a complete shutdown. The shutdown was due to a bug in process_info(_, group_leader). mnesia restarts cleanly now.
Module sha loads a driver. sha.erl heavily edited to use standard crypto:* routines and not load the driver.
A possibility to use --enable-nif removed in xml.erl. File xml.c removed.
The start sequence starts tls_drv and expat_erl drivers. The line is commented out. Another line that loads ASN1.0 driver commented out too because it produces a deprecated message (and is noop).
Mnesia creates a subdirectory in the project directory. The project directory is not writable. A writable directory is mounted over 9p and designated as a database directory to Mnesia.
ejabberd uses system\monitor() functions. Functions are stubbed and do nothing. When opening a listening socket it sets the send timeout. The TCP driver updated to support the option fully. mod_caps wants to know the number of logical processors. system_info(logical_processors) always returns 1.
ejabberd now starts. The admin user is added and admin console is accessible at port 5280.
A c2s listener is configured on c2s. An attempt to connect fails because expat driver is not present/known. xml_stream.erl reimplemented using xmerl as xmerl_sax_parser offers functionality almost identical to the expat driver.
tls driver hit upon connection attempt. tls and starttls removed from the listener to enable unencrypted connection. After a couple of more bugs it is now possible to login to the server.