0

我有一个 erlang 项目,我将为它生成一个独立的 erlang escript,为此我使用了rebar escriptize,在我的 rebar.conf 中添加了所有依赖项以及其他一些选项,如您所见

{erl_opts, [{parse_transform, lager_transform}]}.
{lib_dirs,["deps"]}.

{deps, [
{'lager', ".*", {
  git, "git://github.com/basho/lager.git", {tag, "2.0.0"}}
},
{'cowboy', ".*", {
    git, "git://github.com/ninenines/cowboy.git", {tag, "2.0.0-pre.1"}}
},
{'jsx', ".*", {
    git, "git://github.com/talentdeficit/jsx.git", {tag, "v2.0.4"}}
}
]}.


{escript_emu_args, "%%! -smp auto\n"}.
{escript_emu_args, "%%! -pz ../dir-of-some-beams\n"}.
{escript_name, "multiscreen_ws_app"}.
{escript_incl_apps,   [sasl,stdlib,kernel,ranch,crypto,cowlib,cowboy,asn1,public_key,ssl,jsx,compiler    ,syntax_tools,lager,goldrush]}.

当然,我在主模块中创建了一个 main 方法来启动脚本。当我使用escript multiscreen_ws_app命令运行生成的脚本时,我看到我的程序输出很好,但是当我收到我的第一个 websocket 包并尝试解密它 BAM 时,它只是不起作用,我收到消息:

17:03:30.222 [error] Unable to load crypto library. Failed with error:
"load_failed, Failed to load NIF library c:/Users/alessandro.herculano/Music/mul
tiscreen_ws_app/crypto/priv/lib/crypto: 'Couldn't load the specified method
ecificado.'"
OpenSSL might not be installed on this system.

奇怪的事实是它试图在我的脚本文件中搜索,就像它是一个文件夹一样!c:/Users/alessandro.herculano/Music/multiscreen_ws_app/crypto/priv/lib/crypto 但multiscreen_ws_app是我的脚本文件!我该怎么做才能让我的脚本在另一个预定义的位置搜索它?

--------一些可能很重要的点----

  • 我在 Windows 8 x64 机器上运行它
  • 当我不使用脚本运行它时,我的应用程序运行得很好
  • 我已经尝试在我的 main 顶部使用code:add_pathz来指示加密文件夹,但它也不起作用。
4

1 回答 1

0

刚刚找到解决方案,我的错,只需从 escript_incl_apps 列表中删除“crypto”即可解决问题。

于 2015-10-06T20:23:52.037 回答