0

I am trying to build mongooseim with rabbitMQ. Im getting the below error while doing make rel.

==> rel (generate)
ERROR: generate failed while processing /home/mongoose/MongooseIM/rel: {'EXIT',{{badmatch,{error,"Module mochijson2 potentially included by two different applications: mochijson2 and rabbit_common."}},
         [{rebar_reltool,generate,2,[]},
          {rebar_core,run_modules,4,[]},
          {rebar_core,execute,5,[]},
          {rebar_core,process_dir1,6,[]},
          {rebar_core,process_each,5,[]},
          {rebar_core,process_dir1,6,[]},
          {rebar_core,process_commands,2,[]},
          {rebar,main,1,[]}]}}
make: *** [rel] Error 1

What should be the best way to fix this? I didnt get much info from google. My rebar configuration file is as below:

{ok, Path} = file:get_cwd(),
ConfigureOut = Path ++ "/../configure.out",
Conf = case file:consult(ConfigureOut) of
            {ok, Terms} -> Terms;
            E -> io:format("WARN: error ~p reading file: ~p - using default rel config~n", [E, ConfigureOut]), []
       end,

BaseAppsToRun = [compiler,
                 lager,
                 kernel,
                 mnesia,
                 sasl,
                 ssl,
                 stdlib,
                 ejabberd,
                 inets,
                 syntax_tools,
                 p1_stringprep,
                 exml,
                 cowboy,
                 fusco,
                 folsom,
                 exometer,
                 xmerl,
                 amqp_client,
                 rabbit_common],

AppsToRunIn = BaseAppsToRun ++ proplists:get_value(apps_to_run, Conf, []),

AppsToRun = ordsets:to_list(ordsets:from_list(AppsToRunIn)),

BaseAppsToInclude = AppsToRun ++
                    [asn1,
                     crypto,
                     public_key,
                     goldrush,
                     runtime_tools,
                     p1_utils,
                     ranch,
                     cowlib,
                     bear,
                     mochijson2,
                     p1_cache_tab,
                     pa,
                     base16,
                     cuesport,
                     alarms,
                     idna,
                     recon,
                     setup,
                     xmerl,
                     amqp_client,
                     rabbit_common],


RemovedApps = [mysql,pgsql,redo,seestar,odbc],

AppsToIncludeIn = BaseAppsToInclude ++ proplists:get_value(apps_to_include, Conf, []),

AppsToInclude = ordsets:to_list(ordsets:from_list(AppsToIncludeIn)),

IncludeApps = lists:map(fun(App) -> {app, App, [{incl_cond, include}]} end, AppsToInclude),


[{sys, [
        {lib_dirs, ["../apps", "../deps"]},
        {incl_cond, exclude},
        {rel, "mongooseim", "", [mongoose | AppsToRun]},
        {rel, "start_clean", "", [kernel,stdlib]},
        {boot_rel, "mongooseim"},
        {profile, embedded},
        {excl_archive_filters, [".*"]}, % do no archive built libs
        {excl_sys_filters, ["^bin/.*",
                            "^erts.*/bin/(dialyzer|typer)"]},

        {app, mongoose, [{incl_cond, include}, {lib_dir, ".."}]}
       ] ++ IncludeApps},


{target_dir, "mongooseim"},

{overlay_vars, "vars.config"},

{overlay, [{mkdir, "log/sasl"},
               {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
               {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "files/mongooseim", "bin/mongooseim"},
           {copy, "files/mongooseimctl", "bin/mongooseimctl"},
           {copy, "files/app.config", "etc/app.config"},
           {template, "files/vm.args", "etc/vm.args"},
           {template, "files/ejabberd.cfg", "etc/ejabberd.cfg"},
           {mkdir, "var"},
           {mkdir, "var/log"}
          ]}
].
Kamrul Khan
  • 3,260
  • 4
  • 32
  • 59
  • Merging these applications doesn't seem like a good idea, why do you need to do this? – kjw0188 Apr 28 '15 at 20:55
  • you mean mongooseim and rabbitmq ? I want to store some messages from mongooseim to rabbitmq for later processing. This post may give you better idea on what im trying to do. http://stackoverflow.com/questions/29808159/how-to-build-erlang-amqp-client-in-mongooseim/29809232#29809232 – Kamrul Khan Apr 28 '15 at 22:01

1 Answers1

1

I have faced the same problem before. There are several ways to solve the problem.

  1. use older version of rabbitmq common. common's 2.8.2 version doesn't contain mochijson2 module.

  2. In the "reltool.config" file, try to exclude mochijson2 for rabbitmq common or from mochiweb. ( it need to read carefully release-related documents).

Chen Yu
  • 3,955
  • 1
  • 24
  • 51