1

您好,我正在为 mongooseim(ejabberd fork)聊天编写模块,我想要一些来自 github 的外部库。我将它添加到钢筋配置中。

    {jsx, ".*", {git, "git://github.com/talentdeficit/jsx", {branch, "master"}}}

它正在下载到 /deps 目录,而当我运行项目时出现以下错误:call to undefined function jsx:encode

我找到 /ebin 目录复制的目录(/dev/lib/ebin)并从那里的 jsx 复制 ebin 目录。然后功能是可访问的。每次都手动做是不可能的,我怎么能用钢筋做呢?谢谢你。

更新: 我实际上是用 make dev rel 构建的:

发生以下情况:

devrel: $(DEVNODES)

$(DEVNODES): rebar deps compile deps_dev
    @echo "building $@"
    (cd rel && ../rebar generate -f target_dir=../dev/mongooseim_$@ overlay_vars=./reltool_vars/$@_vars.config)
    cp apps/ejabberd/src/*.erl `ls -dt dev/mongooseim_$@/lib/ejabberd-2.1.8*/ebin/ | head -1`
ifeq ($(shell uname), Linux)
    cp -R `dirname $(shell readlink -f $(shell which erl))`/../lib/tools-* dev/mongooseim_$@/lib/
else
    cp -R `which erl`/../../lib/tools-* dev/mongooseim_$@/lib/
endif
4

1 回答 1

3

为了向 mongooseim 添加依赖项,您应该首先将其添加到rebar.config

{deps, [
    {cuesport, ".*", {git, "git://github.com/goj/cuesport.git", {branch, "master"}}},
    {redo, ".*", {git, "git://github.com/JacobVorreuter/redo.git", {branch, "master"}}},
    {exml, "2.1.4", {git, "git://github.com/esl/exml.git", {tag, "2.1.4"}}},
    {lager, ".*", {git, "git://github.com/basho/lager.git"}},
    {cowboy, "0.8.6", {git, "git://github.com/extend/cowboy.git", "0.8.6"}},
    {folsom, ".*", {git, "git://github.com/boundary/folsom.git", {branch, "master"}}},
    {mochijson2, ".*", {git, "git://github.com/bjnortier/mochijson2.git", {branch, "master"}}},
    {alarms, ".*", {git, "git://github.com/chrzaszcz/alarms.git", {branch, "master"}}},
    {p1_cache_tab, ".*", {git, "git://github.com/processone/cache_tab"}},
    {p1_stringprep, ".*", {git, "git://github.com/processone/stringprep.git", "9e9e0f8dbe6a70ef36e1d4436b458ca5a77fbcfb"}},
    My dependency-->{jsx, ".*", {git, "git://github.com/talentdeficit/jsx", {branch, "master"}}}
]}.

那么当你这样做时,make它应该被下载到/deps目录中。

然后看一下 /rel/reltool.config 文件。

在这里你可以找到类似的东西:

{sys, [ ...
   {app, inets, [{incl_cond, include}]},
   {app, exml, [{incl_cond, include}]},
   {app, ranch, [{incl_cond, include}]},
   {app, cowboy, [{incl_cond, include}]},
   {app, bear, [{incl_cond, include}]},
   {app, folsom, [{incl_cond, include}]},
   {app, mochijson2, [{incl_cond, include}]},
   {app, syntax_tools, [{incl_cond, include}]},
   {app, p1_cache_tab, [{incl_cond, include}]},
   {app, alarms, [{incl_cond, include}]},
   My dependency->{app, jsx, [{incl_cond, include}]}
}

你的依赖应该有效。查看rel/mongooseim/libdev/mongooseim_odbc*/lib目录。就我而言,其中有带有ebin目录的 jsx-2.0.1。

于 2014-08-18T10:40:33.093 回答