asdf-vm / asdf-elixir

Elixir plugin for asdf version manager
https://github.com/asdf-vm/asdf
MIT License
473 stars 70 forks source link

When compiling from source, global erlang version is used #113

Open dylan-chong opened 2 years ago

dylan-chong commented 2 years ago

The local version of erlang should be used to compile elixir. This will prevent issues where you compile elixir after compiling erlang inside a repository with a different erlang version to the global, and encountering unexpected issues

Stratus3D commented 2 years ago

@dylan-chong sorry for the late reply here. Can you provide the output of asdf info, any .tool-versions files you used, and the sequence of steps you performed that caused this issue?

asdf should already use the Erlang version you specified in your .tool-versions file if you've set it and the shims have been generate (asdf reshim).

dylan-chong commented 2 years ago

Hi, this is specific to installing Elixir where the global erlang version differs from the local one inside a project. This I presume is because the cwd when installing erlang is outside the project, so the global version is used

> asdf info
OS:
Darwin Dylans-Work-MBP-M1.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:29:10 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T8101 arm64

SHELL:
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.

ASDF VERSION:
v0.9.0

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/opt/homebrew/Cellar/asdf/0.9.0/libexec

ASDF INSTALLED PLUGINS:
elixir                       https://github.com/asdf-vm/asdf-elixir.git master 8d018f2
erlang                       https://github.com/asdf-vm/asdf-erlang.git master 255743c
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 0237452
terraform                    https://github.com/asdf-community/asdf-hashicorp.git master 6739b2a
yarn                         https://github.com/twuni/asdf-yarn.git main 376c540

Dylan@Dylans-Work-MBP-M1:(improvement/consumer-process-message-in-fresh-process)~/Development/solve/solvedata/solve/api/src
> cat .tool-versions
erlang 24.2
elixir ref:v1.13.1

Dylan@Dylans-Work-MBP-M1:(improvement/consumer-process-message-in-fresh-process)~/Development/solve/solvedata/solve/api/src
> cat ~/.tool-versions
nodejs 14.18.0
elixir ref:v1.13.3
yarn 1.22.17
erlang 23.3.4.12
dylan-chong commented 2 years ago

You can also test this by unsetting the global erlang version in ~/.tool-versions

> asdf current
elixir          ref:v1.13.1     /Users/Dylan/Development/solve/solvedata/solve/api/src/.tool-versions
erlang          24.2            /Users/Dylan/Development/solve/solvedata/solve/api/src/.tool-versions
nodejs          14.18.0         /Users/Dylan/Development/solve/solvedata/.nvmrc
terraform       ______          No version is set. Run "asdf <global|shell|local> terraform <version>"
yarn            1.22.17         /Users/Dylan/.tool-versions

> asdf install elixir ref:v1.13.2
==> Checking whether specified Elixir reference exists...
==> Downloading v1.13.2 to /Users/Dylan/.asdf/downloads/elixir/ref-v1.13.2/elixir-ref-v1.13.2-src.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   137  100   137    0     0    582      0 --:--:-- --:--:-- --:--:--   603
100 2852k    0 2852k    0     0  1599k      0 --:--:--  0:00:01 --:--:-- 3533k
==> Making the release
rm -rf ebin
rm -rf lib/*/ebin
rm -rf lib/elixir/src/elixir_parser.erl
rm -rf lib/*/_build/
rm -rf lib/*/tmp/
rm -rf lib/elixir/test/ebin/
rm -rf lib/mix/test/fixtures/deps_on_git_repo/
rm -rf lib/mix/test/fixtures/git_rebar/
rm -rf lib/mix/test/fixtures/git_repo/
rm -rf lib/mix/test/fixtures/git_sparse_repo/
rm -f erl_crash.dump
rm -f man/elixir.1
rm -f man/elixir.1.bak
rm -f man/iex.1
rm -f man/iex.1.bak
No version is set for command erlc
Consider adding one of the following versions in your config file at /Users/Dylan/.tool-versions
erlang 24.1.7
erlang 24.2
make: *** [lib/elixir/src/elixir_parser.erl] Error 126
Build failed, cleaning...