Run ejabberd as an Elixir application dependency: challenges

Recently I found an article about how to use ejabberd as an Elixir application dependency https://blog.process-one.net/how-to-use-ejabberd-as-an-elixir-application-dependency/

It wasn’t so easy to make it works on OS X, so I would like to share the list of challenges I faced during the installation.

#Issue 1

mix new ejapp doesn’t work, getting an error:

{“init terminating in do_boot”,{undef,[{elixir,start_cli,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

Solution
Install latest Erlang https://www.erlang-solutions.com/resources/download.html

#Issue 2

Run mix do deps.get, compile, getting an error:

==> fast_tls (compile)
Compiling c_src/fast_tls_drv.c
c_src/fast_tls_drv.c:21:10: fatal error: ‘openssl/err.h’ file not found
#include <openssl/err.h>
^
1 error generated.
ERROR: compile failed while processing /Users/igorkhomenko/workspace/ejapp/deps/fast_tls: rebar_abort
** (Mix) Could not compile dependency :fast_tls, “/Users/igorkhomenko/.mix/rebar compile skip_deps=true deps_dir=”/Users/igorkhomenko/workspace/ejapp/_build/dev/lib”” command failed. You can recompile this dependency with “mix deps.compile fast_tls”, update it with “mix deps.update fast_tls” or clean it with “mix deps.clean fast_tls”

Solution:

Run xcode-select — install (found here https://github.com/phusion/passenger/issues/1630)

# Issue 3

Next, getting an error:

==> fast_yaml (compile)
Compiled src/fast_yaml_sup.erl
Compiled src/fast_yaml_app.erl
Compiled src/fast_yaml.erl
Compiling c_src/fast_yaml.c
c_src/fast_yaml.c:18:10: fatal error: ‘yaml.h’ file not found
#include <yaml.h>
^
1 error generated.
ERROR: compile failed while processing /Users/igorkhomenko/workspace/ejapp/deps/fast_yaml: rebar_abort
** (Mix) Could not compile dependency :fast_yaml, “/Users/igorkhomenko/.mix/rebar compile skip_deps=true deps_dir=”/Users/igorkhomenko/workspace/ejapp/_build/dev/lib”” command failed. You can recompile this dependency with “mix deps.compile fast_yaml”, update it with “mix deps.update fast_yaml” or clean it with “mix deps.clean fast_yaml”

Solution:
Run brew install libyaml

=============

After this, I was able to run it locally, register a new user and connect via XMPP client!

Cheers!

Further reading
https://blog.process-one.net/ejabberd-joins-the-elixir-revolution/

Show your support

Clapping shows how much you appreciated Igor Khomenko’s story.