Trouble installing Erlang via asdf on new M2 mac

I just got my new M2 macbook pro in the mail! Excited to get going with it but am having trouble installing Erlang…

I installed asdf through the official git method per their website. I then did the before erlang plugin install instructions on the readme and installed the plugin. Then I tried to install erlang and it just sits at the build step… it’s been there for hours without failing. I assume something has gone wrong but am unsure of how to check? Any help is appreciated.

You could try to find if asdf has something like verbose flags, otherwise you can clone the git repository and try to compile it yourself. Note that compilation process is quite resource hungry and might take from 10 to 20 minutes on an idle machine.

Check if you use the actual ARM version of the terminal, whether you are not using Rosetta by mistake etc.

The usual stuff.

The log should be located somewhere in .asdf directory. Can’t say where exactly as for longer time I’m using prebuild releases for Ubuntu.

That’s a pretty old version of Erlang. To make sure it’s not an issue with asdf, try:

asdf install erlang 25.2

which has probably been compiled with the apple silicon binary slice.

If installing erlang 25.2 is fine, then you will definitely have to compile 23.3.4.9.

You can also try taking out the asdf middleman and use kerl directly.

1 Like

Hi,

You might be facing this issue https://github.com/asdf-vm/asdf-erlang/issues/141. I had the same issue couple of weeks before and this comment solved the problem for mehttps://github.com/asdf-vm/asdf-erlang/issues/141#issuecomment-689084393, hope it helps

1 Like

This worked! Thank you!

Also, thanks to everyone else who responded. I did install later versions (25.2) with asdf and it worked perfectly. I was looking at compiling directly but then decided to try @adamu solution of copying from homebrew install and that now works.

A few months ago I installed on M2 with the following flags

Just to clarify, my suggestion was to use kerl.

There are multiple levels of abstraction when installing Erlang from source.

  1. Compile it directly
  2. Use kerl, which is a utility script that helps you compile and manage multiple versions.
  3. Use asdf, which is a wrapper around kerl that makes things simpler still, but harder to debug when they go wrong.

Isn’t build log enough? In asdf-erlang repository there are few issues with it used, for example:

The path to build log in this case would be: $HOME/.asdf/plugins/erlang/kerl-home/builds/asdf_23.3.4.9/otp_build_23.3.4.9.log

No, the build log sometimes does not contain all the information, or the information is not useful. I made the switch after I was experiencing failures that failed with asdf-erlang using the same kerl version with the same build options, but worked using kerl directly.

If you add another dependency in the pipeline, there are more things that can go wrong :slight_smile: Rather than spend time trying to figure out what went wrong and if it’s related to asdf-erlang or the wiring between asdf-erlang and kerl, now I just use kerl and want to point out that’s an option to others.

Hmm, the Twitter page does not exist anymore. Could you post the complete options list, please?

I have the same also with M1 at Sonoma 14.1.2.
The previous versions have been installed without issues:

~ asdf list elixir
 *1.15.6-otp-25
  1.16.0-otp-25

But when trying to install 26.2.1 it fails:

asdf install erlang 26.2.1                   
asdf_26.2.1 is not a kerl-managed Erlang/OTP installation
The asdf_26.2.1 build has been deleted
Extracting source code
Building Erlang/OTP 26.2.1 (asdf_26.2.1), please wait...
APPLICATIONS DISABLED (See: /Users/serguei/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.1/otp_build_26.2.1.log)
 * odbc           : ODBC library - link check failed

DOCUMENTATION INFORMATION (See: /Users/serguei/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.1/otp_build_26.2.1.log)
 * documentation  : 
 *                  fop is missing.
 *                  Using fakefop to generate placeholder PDF files.

Build failed.
      _gen_digest in libei.a[2](ei_connect.o)
      _gen_digest in libei.a[2](ei_connect.o)
      _recv_challenge_ack in libei.a[2](ei_connect.o)
      _recv_challenge_ack in libei.a[2](ei_connect.o)
      ...
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/Users/serguei/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.1/otp_src_26.2.1/lib/erl_interface/bin/aarch64-apple-darwin23.1.0/erl_call] Error 1
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [erl_interface] Error 2

I tried to apply this fix using KERL_CONFIGURE_OPTIONS , but still no success.

I also tried to set these options from the CLI in the Terminal before installing Erlang 26:

export KERL_CONFIGURE_OPTIONS="--disable-debug --disable-silent-rules --enable-dynamic-ssl-lib --enable-gettimeofday-as-os-system-time --enable-kernel-poll --without-javac --without-wx --without-odbc"
...
asdf install erlang 26.2.1

but it failed again :(.

This is what I have saved in my personal notes:

export KERL_CONFIGURE_OPTIONS="--disable-debug --disable-silent-rules --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-threads --enable-kernel-poll --enable-wx --enable-webview --enable-darwin-64bit --enable-gettimeofday-as-os-system-time"

I see that in the tweet José Valim also added --with-ssl=/opt/... which implies that you pass the path to SSL lib on your machine… (but for some reason, I’m running without it… probably with whatever comes by default)

Thank you for the suggestion. I tried it again with the above options, but it failed:

➜  ~ export KERL_CONFIGURE_OPTIONS="--disable-debug --disable-silent-rules --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-threads --enable-kernel-poll --enable-wx --enable-webview --enable-darwin-64bit --enable-gettimeofday-as-os-system-time"
➜  ~ asdf install erlang latest
asdf_26.2.1 is not a kerl-managed Erlang/OTP installation
The asdf_26.2.1 build has been deleted
Extracting source code
Building Erlang/OTP 26.2.1 (asdf_26.2.1), please wait...
APPLICATIONS DISABLED (See: /Users/serguei/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.1/otp_build_26.2.1.log)
 * jinterface     : Java compiler disabled by user
 * odbc           : ODBC library - link check failed

Build failed.
      _gen_digest in libei.a[2](ei_connect.o)
      _gen_digest in libei.a[2](ei_connect.o)
      _recv_challenge_ack in libei.a[2](ei_connect.o)
      _recv_challenge_ack in libei.a[2](ei_connect.o)
      ...
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [/Users/serguei/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.1/otp_src_26.2.1/lib/erl_interface/bin/aarch64-apple-darwin23.2.0/erl_call] Error 1
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [erl_interface] Error 2

Please see /Users/serguei/.asdf/plugins/erlang/kerl-home/builds/asdf_26.2.1/otp_build_26.2.1.log for full details.
Removing all artifacts except the logfile
(Use KERL_AUTOCLEAN=0 to keep build on failure, if desired)
Cleaning up compilation products for asdf_26.2.1
Cleaned up compilation products for asdf_26.2.1 under /Users/serguei/.asdf/plugins/erlang/kerl-home/builds

Maybe later on, I’ll uninstall the previously installed Erlang versions and try to install the latest first.