简体   繁体   English

混合编译过程的库路径

[英]LIbrary paths for mix compile process

After moving from brew to asdf version control tool for Elixir and Erlang I still cant compile my old projects: in the compile process it tries to refer to non-existent Brew's Cellar lib files: 从Elixir和Erlang的brew转换为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"

even though there is no any /usr/local/Cellar/erlang folder 即使没有任何/usr/local/Cellar/erlang文件夹

where does the mix take the paths to external erlang libs and how to change that to use the asdf's bundles? 混合在哪里将使用外部erlang库的路径,以及如何更改它以使用asdf的包?

Erlang, and also Elixir use binaries and libs from your $PATH environment variable as described here: https://elixir-lang.org/install.html#installing-erlang Erlang以及Elixir都使用$PATH环境变量中的二进制文件和库文件,如下所述: https : //elixir-lang.org/install.html#installing-erlang

asdf usually is loaded at the end of your $PATH , which means that if you still have Erlang and Elixir installed via brew it's gonna be loaded first. 通常在$PATH的末尾加载asdf,这意味着如果仍然通过brew安装了Erlang和Elixir,则将首先加载它。 That said, please double check if any other Erlang version is installed via brew. 也就是说,请仔细检查是否通过brew安装了其他任何Erlang版本。 You can uninstall all versions with the command brew uninstall erlang --force 您可以使用brew uninstall erlang --force命令卸载所有版本。

Also set the local Erlang and Elixir versions in the root dir of your project with the commands: 还可以使用以下命令在项目的根目录中设置本地Erlang和Elixir版本:

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

Change versions according to your environment. 根据您的环境更改版本。

And finally check if asdf is loading the correct version with the command asdf current . 最后检查命令asdf current是否正在加载正确的版本。 It should display something like: 它应该显示如下内容:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM