Install Erlang with asdf on m1 MacBook

I have asdf installed with the all the dependencies mentioned on the site. I am able to successfully installed and use different versions of elixir, but when it comes to Erlang I am unable to install any version with asdf. I tried 21.x and also 22.x versions. I have latest Erlang version installed with brew and it’s working. I got the below error when I try to install any version.

 asdf install erlang 22.0                                         
 Downloading kerl...
 asdf_22.0 is not a kerl-managed Erlang/OTP installation
No build named asdf_22.0
Downloading OTP-22.0.tar.gz to /Users/weiswise/.asdf/plugins/erlang/kerl-home/archives...
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                              Dload  Upload   Total   Spent    Left  Speed
100   120  100   120    0     0    200      0 --:--:-- --:--:-- --:--:--   200
100 52.2M    0 52.2M    0     0  1495k      0 --:--:--  0:00:35 --:--:-- 1568k
Extracting source code
Building Erlang/OTP 22.0 (asdf_22.0), please wait...
Configure failed.
checking size of int... 0
checking size of long... 0
checking size of long long... 0
checking size of __int64... 0
checking size of __int128_t... 0
checking whether byte ordering is bigendian... no
checking whether double word ordering is middle-endian... yes
configure: error: cannot build emulator since no thread library was found
ERROR: /Users/weiswise/.asdf/plugins/erlang/kerl-home/builds/asdf_22.0/otp_src_22.0/erts/configure         failed!
./configure: line 343: kill: (-60536) - No such process

I think Erlang 21.x and 22.x are not supported on apple silicon Macs, at least not all the versions that’s why it’s not installing.
I tried with version 23.3.4 stable build and asdf is able to install it successfully.
I tried with 22.3.4.19 stable build and asdf is also able to install it without any issue.

For this issue

           ./configure: line 343: kill: (-60536) - No such process

add the below line in your bash or zsh file.

            CFLAGS="-O2 -g"

Also add this line in the bash or zsh

           KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac"

So, asdf is working fine, the only issue is arm base architecture of MacBook.
I am leaving the post here, so that anyone in the future can get help from here.

Thank you.

2 Likes

I don’t have an m1 Mac, but ran into tons of issues and none of the posts in the 24.0.1 released topic worked. Turns out it has something to do with the version of Kerl used by ASDF installs. See this post Erlang OTP-24.0.1 released! - #17 by drl123. There is a workaround linked there that worked for me on Mojave. Maybe it will work for you too.

I’ve got an M1 MacBook running Monterey 12.3.1 and experiencing the same issue. @script I tried the same exports in my zsh file as you listed but it didn’t do the trick do for me.

Could you point to where you discovered your fix?

Here’s my console output

asdf_22.3.4.2 is not a kerl-managed Erlang/OTP installation
The asdf_22.3.4.2 build has been deleted
Extracting source code
Building Erlang/OTP 22.3.4.2 (asdf_22.3.4.2), please wait..
Build failed.
checking size of long long... 0
checking size of __int64... 0
checking size of __int128_t... 0
checking whether byte ordering is bigendian... no
checking whether double word ordering is middle-endian... yes
configure: error: cannot build emulator since no thread library was found
ERROR: /Users/neil.crawford/.asdf/plugins/erlang/kerl-home/builds/asdf_22.3.4.2/otp_src_22.3.4.2/erts/configure failed!
./configure: line 343: kill: (-41014) - No such process
make: *** No rule to make target `is_cross_configured'. Stop.
make: *** No rule to make target `all'. Stop.

Erlang/OTP 22.3.4.2 doesn’t work with M1 Macs.

If it is an option, you can use OTP >= 22.3.4.16.
The Apple Silicon build was fixed in that release.

3 Likes

I’ve also got an M1 MacBook running Monterey 12.3.1, and a couple days ago I successfully installed Erlang 24.3.4 with wxWidgets using asdf. I did struggle for a couple of days trying to solve some wxWidgets issues, and I posted an issue on github about my problems:

When I first attempted the install, I was running Monterey 12.2.1, and I stupidly agreed to a system update, which bumped me up to Monterey 12.3.1, and the next day I tried some things to correct the wxWidgets problems, and suddenly the install worked.

Even though the initial output poined to some issues with wxWidgets, I think erlang 24.3.4 installed successfully on the first go:

...
...
APPLICATIONS INFORMATION (See: /Users/7stud/.asdf/plugins/erlang/kerl-home/builds/asdf_24.3.4/otp_build_24.3.4.log)
 * crypto         : Using OpenSSL 3.0 is not yet recommended for production code.
 * wx             : wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
 *         wxWidgets must be installed on your system.
 *         Please check that wx-config is in path, the directory
 *         where wxWidgets libraries are installed (returned by
 *         'wx-config --libs' or 'wx-config --static --libs' command)
 *         is in LD_LIBRARY_PATH or equivalent variable and
 *         wxWidgets version is 3.0.2 or above.

Erlang/OTP 24.3.4 (asdf_24.3.4) has been successfully built
Cleaning up compilation products for 
Cleaned up compilation products for  under /Users/7stud/.asdf/plugins/erlang/kerl-home/builds
1 Like

Thanks a million, this solved my issue, once I bumped up my version then I had no further problems :white_check_mark:

1 Like

FYI, I was able to backport fixes to an older version (22.0.7) and create OTP binaries on my M1 machine with that (if anyone’s interested). I don’t think you can do it with kerl/asdf but directly from source is possible Commits · smocherla-brex/otp · GitHub

If anyone’s interested, these are the steps


export PATH=$PATH:<path/to/wx-install>/bin
cd $OTP_SOURCE_DIR`Preformatted text`
# Ensure we have autoconf version 2.69, latest Mac has 2.71 which does not work with OTP 22.0.7
./otp_build autoconf
# To deal with error described here https://github.com/asdf-vm/asdf-erlang/issues/164#issuecomment-695103295
export CFLAGS="-O2 -Wno-error=implicit-function-declaration"
./configure --with-ssl=$(brew --prefix openssl@1.1) --without-javac --disable-debug --enable-m64-build --prefix=~/repos/otp-22.0.7-fork-release
make
make install
# this has the pre-built binaries we need.
cd ~/repos/otp-22.0.7-fork-release/lib/erlang/
1 Like

Changing from 24.1.7 to 24.3.4 resolved my issue. Ventura + M1. Observer is working as well.

1 Like