【问题标题】:LIbrary paths for mix compile process混合编译过程的库路径
【发布时间】:2019-09-09 00:53:12
【问题描述】:

从 brew 迁移到用于 Elixir 和 Erlang 的 asdf 版本控制工具后,我仍然无法编译我的旧项目:在编译过程中,它试图引用不存在的 Brew 的 Cellar lib 文件:

MacBook-Pro% mix test
==> gettext
Compiling 1 file (.erl)
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:59: illegal pattern
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:60: variable 'Error' is unbound
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:60: variable 'Stacktrace' is unbound
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:63: variable 'Stacktrace' unsafe in 'try' (line 60)
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:64: variable 'Error' unsafe in 'try' (line 60)
/usr/local/Cellar/erlang/21.3.2/lib/erlang/lib/parsetools-2.1.8/include/yeccpre.hrl:64: variable 'Stacktrace' unsafe in 'try' (line 60)
could not compile dependency :gettext, "mix compile" failed. You can recompile this dependency with "mix deps.compile gettext", update it with "mix deps.update gettext" or clean it with "mix deps.clean gettext"

即使没有任何/usr/local/Cellar/erlang 文件夹

混合使用外部 erlang 库的路径以及如何更改它以使用 asdf 的包?

【问题讨论】:

    标签: compilation erlang elixir elixir-mix


    【解决方案1】:

    Erlang 和 Elixir 使用来自 $PATH 环境变量的二进制文件和库,如下所述:https://elixir-lang.org/install.html#installing-erlang

    asdf 通常在$PATH 的末尾加载,这意味着如果您仍然通过 brew 安装了 Erlang 和 Elixir,它将首先加载。也就是说,请仔细检查是否通过 brew 安装了任何其他 Erlang 版本。可以通过brew uninstall erlang --force命令卸载所有版本

    还可以使用以下命令在项目的根目录中设置本地 Erlang 和 Elixir 版本:

    asdf local erlang 21.3.2
    asdf local elixir 1.8.1-otp-21
    

    根据您的环境更改版本。

    最后检查 asdf 是否使用命令asdf current 加载正确的版本。它应该显示如下内容:

    elixir         1.8.1-otp-21 (set by /path/to/project/.tool-versions)
    erlang         21.3.2   (set by /path/to/project/.tool-versions)
    

    作为最后的手段,请查看https://asdf-vm.com/#/core-manage-asdf-vm?id=having-issues

    【讨论】:

    • 请在此处添加链接中的相关部分。
    猜你喜欢
    • 2013-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-04
    • 1970-01-01
    • 2011-12-08
    • 1970-01-01
    • 2015-09-21
    相关资源
    最近更新 更多