简体   繁体   English

为什么rebar3无法编译它可以自己编译的依赖项?

[英]Why can't rebar3 compile a dependency it can compiled by itself?

I'm trying to compile a module that uses the new xmpp library for ejabberd. 我正在尝试为ejabberd使用新的xmpp库的模块进行编译。

I've a very simple rebar.config file: 我有一个非常简单的rebar.config文件:

{deps, [
    {xmpp, ".*", {git, "https://github.com/processone/xmpp", {tag, "1.1.4"}}}
]}.

When I try to run rebar3 eunit or rebar3 compile I get an error message: 当我尝试运行rebar3 eunitrebar3 compile ,出现错误消息:

$ rebar3 compile
===> Verifying dependencies...
===> Fetching xmpp ({git,"https://github.com/processone/xmpp",
                                {ref,"c010141487632db1666bcbf64f90f42c0fde50aa"}})
===> Fetching rebar3_hex ({pkg,<<"rebar3_hex">>,<<"3.1.0">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/rebar3_hex-3.1.0.tar
===> Compiling rebar3_hex
===> Fetching fast_xml ({pkg,<<"fast_xml">>,<<"1.1.18">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/fast_xml-1.1.18.tar
===> Fetching pc ({pkg,<<"pc">>,<<"1.4.0">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/pc-1.4.0.tar
===> Compiling pc
===> Fetching stringprep ({pkg,<<"stringprep">>,<<"1.0.7">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/stringprep-1.0.7.tar
===> Fetching p1_utils ({pkg,<<"p1_utils">>,<<"1.0.6">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/p1_utils-1.0.6.tar
===> Compiling p1_utils
===> Compiling fast_xml
===> Compiling /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/fast_xml/c_src/fxml.c
===> Compiling /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/fast_xml/c_src/fxml_stream.c
===> Linking /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/fast_xml/priv/lib/fxml.so
===> Linking /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/fast_xml/priv/lib/fxml_stream.so
===> Compiling stringprep
===> Compiling /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/stringprep/c_src/stringprep.cpp
===> Linking /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/stringprep/priv/lib/stringprep.so
===> Compiling xmpp
===> Compiling _build/default/lib/xmpp/src/xmpp_util.erl failed
_build/default/lib/xmpp/include/xmpp.hrl:29: can't find include file "fxml.hrl"

However, when I compile this module separately, it works: 但是,当我分别编译此模块时,它可以工作:

$ cd _build/default/lib/xmpp
$ rebar3 compile
===> Fetching rebar3_hex ({pkg,<<"rebar3_hex">>,<<"3.1.0">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/rebar3_hex-3.1.0.tar
===> Compiling rebar3_hex
===> Verifying dependencies...
===> Fetching fast_xml ({pkg,<<"fast_xml">>,<<"1.1.18">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/fast_xml-1.1.18.tar
===> Fetching pc ({pkg,<<"pc">>,<<"1.4.0">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/pc-1.4.0.tar
===> Compiling pc
===> Fetching stringprep ({pkg,<<"stringprep">>,<<"1.0.7">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/stringprep-1.0.7.tar
===> Fetching p1_utils ({pkg,<<"p1_utils">>,<<"1.0.6">>})
===> Downloaded package, caching at /Users/marcp/.cache/rebar3/hex/default/packages/p1_utils-1.0.6.tar
===> Skipping p1_utils (from {pkg,<<"p1_utils">>,<<"1.0.6">>,
                                     <<"EF0951DDF38E92B7E479AF4B8DC950DF76AF8C1030432EF68B7FD7AD17C436FE">>}) as an app of the same name has already been fetched
===> Compiling p1_utils
===> Compiling fast_xml
===> Compiling /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/xmpp/_build/default/lib/fast_xml/c_src/fxml.c
===> Compiling /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/xmpp/_build/default/lib/fast_xml/c_src/fxml_stream.c
===> Linking /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/xmpp/_build/default/lib/fast_xml/priv/lib/fxml.so
===> Linking /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/xmpp/_build/default/lib/fast_xml/priv/lib/fxml_stream.so
===> Compiling stringprep
===> Compiling /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/xmpp/_build/default/lib/stringprep/c_src/stringprep.cpp
===> Linking /Users/marcp/Desktop/erlang-test/myapp/_build/default/lib/xmpp/_build/default/lib/stringprep/priv/lib/stringprep.so
===> Compiling xmpp

How can I find out what's going on? 我怎么知道发生了什么事? Is the rebar.config.script of the xmpp library to blame? rebar.config.script xmpp库的rebar.config.script吗?

It turns out the xmpp cannot be compiled with rebar3 out of the box. 事实证明xmpp无法使用开箱即用的rebar3进行编译。 I've opened an issue on GitHub . 我已经在GitHub上发布了一个问题

As a workaround adding the following to my rebar.config file worked: 解决方法是,将以下内容添加到我的rebar.config文件中:

{overrides, [
    {add, xmpp, [{erl_opts, [{i, "_build/default/lib/fast_xml/include"}]}]}
]}.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM