解决编译elixir出现** (Mix) Could not compile dependency :ssl_verify_fun错误

当使用elixir时如果用到包含ssl模块的依赖时,就需要编译ssl_verify_fun。在ubuntu系统上首次编译经常会遇到如下错误:

==> ssl_verify_fun (compile)
Compiled src/ssl_verify_util.erl
Compiled src/ssl_verify_fingerprint.erl
src/ssl_verify_pk.erl:16: can't find include lib "public_key/include/public_key.hrl"
src/ssl_verify_pk.erl:52: record 'OTPCertificate' undefined
src/ssl_verify_pk.erl:53: record 'OTPTBSCertificate' undefined
src/ssl_verify_pk.erl:54: record 'OTPSubjectPublicKeyInfo' undefined
Compiling src/ssl_verify_pk.erl failed:
ERROR: compile failed while processing /home/pi/blog_spider/deps/ssl_verify_fun: rebar_abort
** (Mix) Could not compile dependency :ssl_verify_fun, "/home/pi/.mix/rebar compile skip_deps=true deps_dir="/home/pi/blog_spider/_build/dev/lib"" command failed. You can recompile this dependency with "mix deps.compile ssl_verify_fun", update it with "mix deps.update ssl_verify_fun" or clean it with "mix deps.clean ssl_verify_fun"

其实提示中很明显的指出了编译erlang模块缺少头文件public_key.hrl,但mix工具给出的报错帮助其实是无用的,重新下载依赖或者更新依赖都是没有用的。只需要安装erlang-dev就能解决该问题

apt-get update
apt-get install erlang-dev

该问题大多数只出现在ubuntu系统上

猜你喜欢

转载自blog.csdn.net/u011031257/article/details/80827732