erlang / rebar3

Erlang build tool that makes it easy to compile and test Erlang applications and releases.
http://www.rebar3.org
Apache License 2.0
1.69k stars 516 forks source link

Error build rabbitmq-common with rebar3 #1221

Closed nguyenbatam closed 8 years ago

nguyenbatam commented 8 years ago

rebar3 compile ===> Verifying dependencies... ===> Package <<"rebar_gdb_plugin">> not found. Fetching registry updates and trying again... ===> Updating package registry... ===> Writing registry to /home/tamnb/.cache/rebar3/hex/default/registry ===> Generating package index... ===> [cloudi_service_oauth1:1.5.1] Only existing version of cloudi_service_db_riak is 1.3.3 which does not match constraint ~> 1.5.1. Using anyway, but it is not guaranteed to work. ===> Writing index to /home/tamnb/.cache/rebar3/hex/default/packages.idx ===> Plugin rebar_gdb_plugin not available. It will not be used. ===> Compiling rabbit_common ===> Compiling /home/tamnb/workspace_Erlang/my_project/_build/default/lib/rabbit_common/src/rabbit_misc.erl failed /home/tamnb/workspace_Erlang/my_project/_build/default/lib/rabbit_common/src/rabbit_misc.erl:19: can't find include file "rabbit_framing.hrl"

ferd commented 8 years ago

I can't replicate your failure. Using a fresh build, I however get:

===> Verifying dependencies...
===> Fetching amqp_client ({git,
                            "https://github.com/rabbitmq/rabbitmq-erlang-client.git",
                            {tag,"rabbitmq_v3_5_3"}})
===> Dependency failure: Application amqp_client not found at the top level 
of directory /tmp/rmq/_build/default/lib/amqp_client

That specific project appears to have a need for custom erlang.mk plugins to work https://github.com/rabbitmq/rabbitmq-erlang-client/blob/master/Makefile and specifies no format of configuration either rebar or rebar3 can understand.

As far as I can tell we can't do anything about that dependency.

tsloughter commented 8 years ago

As far as I know rabbitmq libs aren't compatible with rebar or rebar3.

nguyenbatam commented 8 years ago

When I test a new project with rebar , it's dont have problem . So I think this problem is belong rebar3 with https://github.com/rabbitmq/rabbitmq-common.git :(

{lib_dirs, ["lib"]}. {erl_opts, [debug_info,{parse_transform, lager_transform}]}. {erl_opts, [ {src_dirs, ["src","rel"]}]}. {deps, [{lager,"3.0.2",{git,"https://github.com/basho/lager.git",{tag,"3.0.2"}}}, {protobuffs,"0.8.2",{git,"https://github.com/basho/erlang_protobuffs.git",{tag,"0.8.2"}}}, {eredis,"1.0.8",{git,"https://github.com/wooga/eredis.git",{tag,"v1.0.8"}}}, {jiffy,"0.14.7",{git,"https://github.com/davisp/jiffy.git",{tag,"0.14.7"}}}, {rabbitcommon,".",{git,"https://github.com/rabbitmq/rabbitmq-common.git",{tag,"rabbitmq_v3_6_1"}}}, {amqpclient,".",{git,"https://github.com/rabbitmq/rabbitmq-erlang-client.git",{tag,"rabbitmq_v3_6_1"}}}, {cowboy, "1.0.4", {git, "https://github.com/ninenines/cowboy.git",{tag,"1.0.4"}}}]}.

{eunit_compile_opts, [export_all]}. {eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.

{cover_enabled, true}. {cover_export_enabled, true}.

ferd commented 8 years ago

I get a similar failure with the old rebar:

==> rabbit_common (compile)
/tmp/rttt/deps/rabbit_common/src/rabbit_misc.erl:19: can't find include file "rabbit_framing.hrl"
Compiling /tmp/rttt/deps/rabbit_common/src/rabbit_misc.erl failed:
ERROR: compile failed while processing /tmp/rttt/deps/rabbit_common: rebar_abort

and for rebar3:

===> Compiling cowlib
===> Compiling rabbit_common
===> Compiling /tmp/rttt/_build/default/lib/rabbit_common/src/rabbit_misc.erl failed
/tmp/rttt/_build/default/lib/rabbit_common/src/rabbit_misc.erl:19: can't find include file "rabbit_framing.hrl"

I don't know where that file ought to be, but it's not in path right now, nor being generated with rebar 2.6.1.

tsloughter commented 8 years ago

@nguyenbatam I don't now how that can be possible since rabbit_framing.hrl requires running the Makefile to generate.

nguyenbatam commented 8 years ago

/bin/sh: -c: line 0: syntax error near unexpected token (' /bin/sh: -c: line 0:echo " DEP " rabbitmq_codegen; fetch_url1='https://github.com/rabbitmq/rabbitmq-codegen.git'; fetch_url2='https://github.com/rabbitmq/rabbitmq-codegen.git'; if test "$fetch_url1" != 'https://github.com/rabbitmq/rabbitmq-common.git' && git clone -q -n -- "$fetch_url1" /home/tamnb/workspace_Erlang/test/_build/default/lib/rabbit_common/deps/rabbitmq_codegen; then fetch_url="$fetch_url1"; push_url='https://github.com/rabbitmq/rabbitmq-codegen.git'; elif git clone -q -n -- "$fetch_url2" /home/tamnb/workspace_Erlang/test/_build/default/lib/rabbit_common/deps/rabbitmq_codegen; then fetch_url="$fetch_url2"; push_url='git@github.com:rabbitmq/rabbitmq-codegen.git'; fi; cd /home/tamnb/workspace_Erlang/test/_build/default/lib/rabbit_common/deps/rabbitmq_codegen && ( git checkout -q (no >/dev/null 2>&1 || git checkout -q branch) >/dev/null 2>&1 || git checkout -q master >/dev/null 2>&1 || git checkout -q master >/dev/null 2>&1 || (echo "error: no valid pathspec among: (no branch) master master" 1>&2 && false) ) && (test "$fetch_url" = "$push_url" || git remote set-url --push origin "$push_url")' make: *\ [/home/tamnb/workspace_Erlang/test/_build/default/lib/rabbit_common/deps/rabbitmq_codegen] Error 1

nguyenbatam commented 8 years ago

{relx, [{release, { test, "0.1.0" }, [test, sasl]},

    {sys_config, "./config/sys.config"},
    {vm_args, "./config/vm.args"},

    {dev_mode, true},
    {include_erts, false},

    {extended_start_script, true}]

}.

{profiles, [{prod, [{relx, [{dev_mode, false}, {include_erts, true}]}] }] }. {overrides, [{override, rabbit_common, [{pre_hooks, [{compile, "rm -Rf .git & make"}]}]}]}.

tsloughter commented 8 years ago

We can't have hacks in rebar3 for individual apps. You'll have to use the override unless rabbit adds support for rebar3.

Tristan Sloughter t@crashfast.com

On Tue, Jun 7, 2016, at 11:07 PM, nguyenbatam wrote:

}. {profiles, [{prod, [{relx, [{dev_mode, false}, {include_erts, true}]}] }] }. {overrides, [{override, rabbit_common, [{pre_hooks, [{compile, "rm -Rf .git & make"}]}]}]}.

  • I think rebar3 need check it when it fetch rabbit-common lib — You are receiving this because you commented. Reply to this email directly, view it on GitHub[8], or mute the thread[9].

Links:

  1. https://github.com/basho/lager.git%22,%7Btag,%223.0.2%22%7D
  2. https://github.com/basho/erlang_protobuffs.git%22,%7Btag,%220.8.2%22%7D
  3. https://github.com/wooga/eredis.git%22,%7Btag,%22v1.0.8%22%7D
  4. https://github.com/davisp/jiffy.git%22,%7Btag,%220.14.7%22%7D
  5. https://github.com/rabbitmq/rabbitmq-common.git%22,%7Btag,%22rabbitmq_v3_6_1%22%7D
  6. https://github.com/rabbitmq/rabbitmq-erlang-client.git%22,%7Btag,%22rabbitmq_v3_6_1%22%7D
  7. https://github.com/ninenines/cowboy.git%22,%7Btag,%221.0.4%22%7D
  8. https://github.com/erlang/rebar3/issues/1221#issuecomment-224482118
  9. https://github.com/notifications/unsubscribe/AACNg8M4JGoePZlYoA7PU1UQQkmyPjP8ks5qJkAMgaJpZM4IuuSd
nguyenbatam commented 8 years ago

I am a newbie Erlang . So it's only a question ! This is the first , I learn Erlang . Tks for yours answer !