I am following a summary of instructions to get elixir installed on M1 via the asdf
VM on this stackoverflow post . I have tried a couple of different things related to Kerl
environment variables to get the following to work
~ » asdf install erlang latest 11:18:15
asdf_25.0.2 is not a kerl-managed Erlang/OTP installation
The asdf_25.0.2 build has been deleted
Extracting source code
Building Erlang/OTP 25.0.2 (asdf_25.0.2), please wait...
Build failed.
gmake[5]: Leaving directory '/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/lib/megaco/src/flex'
gmake[4]: *** [/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/make/run_make.mk:35: opt] Error 2
gmake[4]: Leaving directory '/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/lib/megaco/src/flex'
gmake[3]: *** [/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/make/otp_subdir.mk:29: opt] Error 2
gmake[3]: Leaving directory '/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/lib/megaco/src'
gmake[2]: *** [/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/make/otp_subdir.mk:29: opt] Error 2
gmake[2]: Leaving directory '/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/lib/megaco'
gmake[1]: *** [/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/make/otp_subdir.mk:29: opt] Error 2
gmake[1]: Leaving directory '/Users/Joey/.asdf/plugins/erlang/kerl-home/builds/asdf_25.0.2/otp_src_25.0.2/lib'
gmake: *** [Makefile:511: libs] Error 2
The best guide I found for installing Erlang and Elixir on an M1 Mac with ASDF is this one by Yamazaki Susumu. I recommend it especially because it makes use of all CPU cores.
The guide is from December 2021, but it worked for me in February/March and I’ve been able to keep updating Erlang and Elixir within ASDF with all cores still firing, including the latest Erlang 25 release that gives a real speed boost to M1s with its JIT support.
hlx
June 27, 2022, 7:45am
3
This works for me:
$ 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 --with-ssl=/opt/homebrew/opt/openssl@3" asdf install erlang 25.0.2
❯ sysctl -a | grep machdep.cpu
machdep.cpu.cores_per_package: 10
machdep.cpu.core_count: 10
machdep.cpu.logical_per_package: 10
machdep.cpu.thread_count: 10
machdep.cpu.brand_string: Apple M1 Max
The options came from a tweet of Jose, one I cannot seem to find quickly
1 Like
adamu
June 27, 2022, 10:46pm
4
I wrote that Stack Overflow answer, and I can still build OTP 25 on an M1 Mac using those instructions.
There is not much info in the logs you provided. Is there not a more detailed log that tells you more information about whats going wrong?
My guess is you skipped a step listed in the make sure to read the "Before asdf install"
point.
Actually I’m having problems myself recently building with asdf-erlang with KERL_BUILD_DOCS
set, which I wrote about here . However, it works when I use kerl directly, not asdf
. I wonder if your error is related? There could be an asdf bug.
Unfortunately building Erlang is a complex process and there are readmes to be read and choices to be made. The foolproof “just do this” ways are good until they break, then you’re back to reading readmes and setting environment variables anyway.
1 Like
I did my best to follow all the instructions there, and have double checked that I did have all those packages installed before running asdf install
. I still get the same results. I will try the above linked article on dev.to
and see if I have any luck.
About half my team is on M1 vs Intel Macs. I have never had a problem running Elixir/Erlang, but others have.
The problems range from asdf
not installing, to Elixir compilation being very slow.
As someone else mentioned, this is what seemed to fix it for everyone:
$ echo $KERL_CONFIGURE_OPTIONS
--disable-debug --disable-silent-rules --enable-dynamic-ssl-lib --enable-hipe --enable-shared-zlib --enable-smp-support --enable-threads --enable-wx --with-ssl=/opt/homebrew/opt/openssl@1.1 --without-javac --enable-darwin-64bit --enable-kernel-poll --with-dynamic-trace=dtrace
Oh, I just remembered, there is an issue with exwidgets
…
opened 03:57PM - 14 Apr 22 UTC
closed 03:42PM - 26 Apr 22 UTC
team:PS
bug
**Describe the bug**
```
clang++ -c -g -Wall -fPIC -g -O2 -mmacosx-version-m… in=12 -Wno-deprecated-declarations -fno-strict-aliasing -D_MACOSX -D_THREAD_SAFE -D_REENTRANT -O1 -I/usr/local/lib/wx/include/osx_cocoa-unicode-3.1 -I/usr/local/include/wx-3.1 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DHAVE_OPENGL_GL_H=1 -DHAVE_OPENGL_GLU_H=1 -DWXE_WEBVIEW=1 -DHAVE_GL_SUPPORT=1 -DHAVE_GLINTPTR=1 -DHAVE_GLINTPTRARB=1 -DHAVE_GLCHAR=1 -DHAVE_GLCHARARB=1 -DHAVE_GLHALFARB=1 -DHAVE_GLINT64EXT=1 -DHAVE_WX_STC_STC_H=1 -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/emulator/beam -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/include -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/include/x86_64-apple-darwin21.4.0 -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/include/internal -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/include/internal/x86_64-apple-darwin21.4.0 -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/emulator/sys/unix -I/private/tmp/erlang-20220414-68498-1dkkpkl/otp_src_24.3.3/erts/emulator/sys/common gen/wxe_wrapper_8.cpp -o x86_64-apple-darwin21.4.0/wxe_wrapper_8.o
gen/wxe_wrapper_5.cpp:2165:29: error: taking the address of a temporary object of type 'wxBitmap' [-Waddress-of-temporary]
const wxBitmap * Result = &This->GetBitmap();
^~~~~~~~~~~~~~~~~~
1 error generated.
make[3]: *** [x86_64-apple-darwin21.4.0/wxe_wrapper_5.o] Error 1
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [opt] Error 2
make[1]: *** [opt] Error 2
make: *** [libs] Error 2
```
**To Reproduce**
Using homebrew tree with changes from https://github.com/Homebrew/homebrew-core/pull/99206/files (The only change actually required to reproduce the issue is https://github.com/Homebrew/homebrew-core/pull/99206/commits/65fc10a50c449deb1af962fc077167855ac75fef)
```
brew install --build-from-source wxwidgets
brew install --build-from-source erlang
```
What it actually runs internally to build `erlang` is
```
./configure --disable-debug --disable-silent-rules --enable-dynamic-ssl-lib --enable-hipe --enable-shared-zlib --enable-smp-support --enable-threads --enable-wx --with-ssl=/opt/homebrew/opt/openssl@1.1 --without-javac --enable-darwin-64bit --enable-kernel-poll --with-dynamic-trace=dtrace --disable-option-checking --cache-file=/dev/null
make
```
against wxWidgets configured with `--enable-clipboard --enable-controls --enable-dataviewctrl --enable-display --enable-dnd --enable-graphics_ctx --enable-std_string --enable-svg --enable-unicode --enable-webviewwebkit --with-expat --with-libjpeg --with-libpng --with-libtiff --with-opengl --with-zlib --disable-precomp-headers --disable-monolithic --with-osx_cocoa --with-libicon`
**Expected behavior**
No build errors
**Affected versions**
OTP-24
**Additional context**
This effectively blocks wxWidgets update in Homebrew
ali
July 30, 2022, 7:59pm
7
I just setup erlang 25.0.3 and elixir 1.13.4 on my m1 mbp using asdf
package manager without any issue. Observer works flawlessly.
There was an issue with wxwidgets
3.1.x which is now resolved in latest version 3.2.x
I followed following steps
brew install kerl
brew install wxwidgets
.kerlrc in ~
KERL_CONFIGURE_OPTIONS="--disable-debug --without-javac --enable-dynamic-ssl-lib --enable-shared-zlib --enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --with-wx"
KERL_BUILD_DOCS=yes
installed eralng and elixir
asdf install erlang 25.0.3
asdf global erlang 25.0.3
asdf install elixir 1.13.4-otp-25
asdf global elixir 1.13.4-otp-25
4 Likes