【发布时间】:2013-06-22 18:36:46
【问题描述】:
我查看了 StackOverflow 上的问题,并在 Google 上搜索了一个在 rebar 中设置 Basic NIF 项目以包装 C++ 库的示例。
我曾经在 GitHub 上图书馆项目作为指导:
我的项目在这里:
https://github.com/project-z/emutton/
当我执行rebar compile && rebar eunit 时,eunit 测试失败,因为它找不到emtn.so:
$ rebar compile && rebar eunit
==> emutton (compile)
==> emutton (eunit)
undefined
*** test module not found ***
**emtn
=ERROR REPORT==== 25-Jun-2013::12:21:55 ===
The on_load function for module emtn returned {error,
{load_failed,
"Failed to load NIF library: 'dlopen(/.../source/emutton/priv/emtn.so, 2): image not found'"}}
=======================================================
Failed: 0. Skipped: 0. Passed: 0.
One or more tests were cancelled.
ERROR: One or more eunit tests failed.
ERROR: eunit failed while processing /.../source/emutton: rebar_abort
当我调用rebar compile 时,它只生成一个驱动文件emtn_drv.so 而没有emtn.so:
$ tree priv
priv
└── emtn_drv.so
0 directories, 1 file
我在c_src/build_deps.sh 中有一条回显语句,当我调用rebar clean 时看不到输出。它似乎表现得好像我的 pre_hook 和 post_hook 在 rebar.config 被完全忽略:
{pre_hooks, [{compile, "c_src/build_deps.sh"}]}.
{post_hooks, [{clean, "c_src/build_deps.sh clean"}]}.
rebar 无输出示例:
$ rebar compile
==> emutton (compile)
$ rebar clean
==> emutton (clean)
因为我已经克隆了 tuncer 的 RE2 绑定项目,并且当我执行 rebar compile 时,请查看他的 build_deps.sh 脚本的输出。我的权限和他的一致:
-rwxr-xr-x 1 ajl staff 891B Jun 25 12:30 c_src/build_deps.sh
知道我在这里缺少什么吗?我相信钢筋配置正确,可以调用脚本并进行编译。
【问题讨论】:
标签: erlang rebar erlang-nif