huiqing / percept2

Concurrent profiling tool for Erlang
135 stars 34 forks source link

Conflict with percept and egd #4

Closed dantswain closed 11 years ago

dantswain commented 11 years ago

I'm building a project with rebar and get the following error on rebar generate:

ERROR: generate failed while processing /Users/dswain/src/reporting_maulerl/rel: {'EXIT',{{badmatch,{error,"Module egd potentially included by two different applications: percept and percept2."}},
         [{rebar_reltool,generate,2,
                         [{file,"src/rebar_reltool.erl"},{line,53}]},
          {rebar_core,run_modules,4,[{file,"src/rebar_core.erl"},{line,437}]},
          {rebar_core,execute,5,[{file,"src/rebar_core.erl"},{line,363}]},
          {rebar_core,process_dir1,6,[{file,"src/rebar_core.erl"},{line,227}]},
          {rebar_core,process_commands,2,
                      [{file,"src/rebar_core.erl"},{line,90}]},
          {rebar,main,1,[{file,"src/rebar.erl"},{line,58}]},
          {escript,run,2,[{file,"escript.erl"},{line,747}]},
          {escript,start,1,[{file,"escript.erl"},{line,277}]}]}}

I installed percept2 on my system (OS X, erlang R16B01) by cloning this repo and doing

make
make install

My reltool.config file:

%% -*- mode: erlang -*-
%% ex: ft=erlang
{sys, [
       {lib_dirs, ["../apps", "../deps"]},
       {erts, [{mod_cond, derived}, {app_file, strip}]},
       {app_file, strip},
       {rel, "maulerl", "1",
        [
         kernel,
         stdlib,
         sasl,
         uatu,
         epgsql,
         line_writer,
         line_server,
         campaign_key,
         maulerl,
         appmon
        ]},
       {rel, "start_clean", "",
        [
         kernel,
         stdlib
        ]},
       {boot_rel, "maulerl"},
       {profile, embedded},
       {incl_cond, derived},
       {excl_archive_filters, [".*"]}, %% Do not archive built libs
       {excl_sys_filters, ["^bin/(?!start_clean.boot)",
                           "^erts.*/bin/(dialyzer|typer)",
                           "^erts.*/(doc|info|include|lib|man|src)"]},
       {excl_app_filters, ["\.gitignore"]},
       {app, maulerl, [{mod_cond, app}, {incl_cond, include}]}
      ]}.

{target_dir, "maulerl"}.

{overlay, [
           {mkdir, "log/sasl"},
           {copy, "files/erl", "\{\{erts_vsn\}\}/bin/erl"},
           {copy, "files/nodetool", "\{\{erts_vsn\}\}/bin/nodetool"},
           {copy, "maulerl/bin/start_clean.boot",
                  "\{\{erts_vsn\}\}/bin/start_clean.boot"},
           {copy, "files/maulerl", "bin/maulerl"},
           {copy, "files/maulerl.cmd", "bin/maulerl.cmd"},
           {copy, "files/start_erl.cmd", "bin/start_erl.cmd"},
           {copy, "files/install_upgrade.escript", "bin/install_upgrade.escript"},
           {copy, "files/sys.config", "releases/\{\{rel_vsn\}\}/sys.config"},
           {copy, "files/vm.args", "releases/\{\{rel_vsn\}\}/vm.args"}
          ]}.

I'm looking into this. If I can find a fix, I'll submit a pull request.

dantswain commented 11 years ago

Note I'm not requiring percept or percept2 manually at all. This is coming in through the system somehow; I don't think it's anything specific about my setup.

dantswain commented 11 years ago

I tried a bunch of changes to my reltool.config, but no luck. I had to uninstall percept2 (there's no make uninstall, btw... I had to rm -rf /usr/local/lib/erlang/lib/percept2-1.0) to make progress. I'll try to revisit later.

huiqing commented 11 years ago

Percept2 and Percept do have some common modules, but since you are not requiring Percept or Percept2 manually at all, I don't know why these conflicts were checked. I don't use rebar a lot, so sorry that I'm not very helpful. Thanks for noting there is not 'make uninstall', will add it soon.

dantswain commented 11 years ago

I did a bit of research and I believe reltool, under default circumstances, will try to include every module in the system directories (i.e., every app in /usr/local/lib/erlang/lib/). I don't think this is a rebar-specific issue because that decision gets made in the reltool code.

I can understand that you might think this is not a bug with Percept2, but installing Percept2 rendered my entire build system unusable. The solution might be as simple as modifying the documentation to point out how the user needs to modify their release config.

If I have some time I'll try to figure out what the right thing to do is. It's interesting to try to understand how reltool works ;)

huiqing commented 11 years ago

Thanks! I would be great if this could be resolved.

piboye commented 11 years ago

{sys, [ ....

success to rebar generate,