我需要在OSX 10.10.5上构建Erlang R16B02并支持SSL,因此我可以使用crypto
应用程序。我已经用Homebrew安装了OpenSSL 0.9.8。运行openssl
> version
会产生以下结果:
$ openssl
OpenSSL> version
OpenSSL 0.9.8zg 14 July 2015
我能够构建并安装Erlang R16B02,但在尝试启动crypto
应用程序时,我始终遇到同样的错误:
1> crypto:start().
** exception error: undefined function crypto:start/0
2>
=ERROR REPORT==== 1-Feb-2016::14:19:17 ===
Unable to load crypto library. Failed with error:
"load_failed, Failed to load NIF library: 'dlopen(~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so, 2): Symbol not found: _AES_cbc_encrypt
Referenced from: ~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so
Expected in: flat namespace
in ~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so'"
OpenSSL might not be installed on this system.
=ERROR REPORT==== 1-Feb-2016::14:19:17 ===
The on_load function for module crypto returned {error,
{load_failed,
"Failed to load NIF library: 'dlopen(~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so, 2): Symbol not found: _AES_cbc_encrypt\n Referenced from: ~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so\n Expected in: flat namespace\n in ~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so'"}}
我试过调用其他函数,比如crypto:module_info()
,但我总是得到同样的错误。我使用asdf使用各种标志构建了Erlang R16B02。这里有几个我试过的组合:
Building with options: --enable-dynamic-ssl-lib --prefix=~/.asdf/installs/erlang/R16B02
Building with options: --with-ssl=/usr/local/opt/openssl --prefix=~/.asdf/installs/erlang/R16B02 # with-ssl points to the OpenSSL install
Building with options: --with-ssl --prefix=~/.asdf/installs/erlang/R16B02
所有这些都导致了同样的错误。当我试图弄清楚如何使用SSL构建Erlang时,我注意到一个奇怪的事情是--enable-darwin-64bit
和--enable-darwin-universal
标志导致构建失败。这似乎很奇怪,因为我在OSX上构建,所以似乎需要这些标志。
所以回顾一下:
crypto
模块中的任何函数时都会收到上述错误crypto
应用程序更新
我遇到了这个https://gist.github.com/ThePicard/7378417,所以我尝试了配置脚本中列出的几个选项,但我仍然遇到了同样的错误。
更新2
otool -L ~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so
打印出来:
~/.asdf/installs/erlang/R16B02/lib/erlang/lib/crypto-3.1/priv/lib/crypto.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1213.0.0)