Yeah confirmed. You can build without megaco
and then the erlc
error just happens in a different spot.
Got the same issue as @edgar
Keep in mind that in order to get that error I had to point to XCode 15 using: sudo xcode-select --switch /Applications/Xcode-beta.app
I also tried compiling from the source:
$ git clone https://github.com/elixir-lang/elixir.git
$ cd elixir
$ make clean test
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 -rf lib/mix/test/fixtures/archive/ebin/
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
make: *** [lib/elixir/src/elixir_parser.erl] Bus error: 10
Also found a Github issue that reference this issue: Elixir broken on MacOS Sonoma · Issue #12684 · elixir-lang/elixir · GitHub
Which confirmed this was an erlang issue:
❯ erl
zsh: bus error erl
Then I tried the asdf approach: GitHub - asdf-vm/asdf-erlang: Erlang plugin for asdf version manager
asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
asdf install erlang 26.0.1
asdf global erlang 26.0.1
You might need to asdf reshim
YMMV.
After that erl
still results in bus error, not sure why, but I was able to compile, and run a repl with Elixir now:
❯ iex -S mix
Erlang/OTP 26 [erts-14.0.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]
Interactive Elixir (1.15.0) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
I’m able to build and run Erlang 26.0.1 installed using asdf
, however 25.3.2.5 won’t compile:
LD ../../priv/lib/aarch64-apple-darwin23.0.0/megaco_flex_scanner_drv.so
/bin/sh: line 1: 63768 Bus error: 10 erlc -W -Werror +debug_info -DENABLE_MEGACO_FLEX_SCANNER=true -DMEGACO_REENTRANT_FLEX_SCANNER=true -Dmegaco_parser_inline -pa /Users/aselder/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.5/otp_src_25.3.2.5/lib/et/ebin -pa /Users/aselder/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.5/otp_src_25.3.2.5/lib/megaco/ebin +'{parse_transform,sys_pre_attributes}' +'{attribute,insert,app_vsn,"megaco-4.4.3"}' -I../../include -o../../ebin megaco_flex_scanner_handler.erl
gmake[5]: *** [/Users/aselder/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.5/otp_src_25.3.2.5/make/aarch64-apple-darwin23.0.0/otp.mk:136: ../../ebin/megaco_flex_scanner_handler.beam] Error 138
gmake[5]: *** Waiting for unfinished jobs....
/bin/sh: line 1: 63767 Bus error: 10 erlc -W -Werror +debug_info -DENABLE_MEGACO_FLEX_SCANNER=true -DMEGACO_REENTRANT_FLEX_SCANNER=true -Dmegaco_parser_inline -pa /Users/aselder/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.5/otp_src_25.3.2.5/lib/et/ebin -pa /Users/aselder/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.5/otp_src_25.3.2.5/lib/megaco/ebin +'{parse_transform,sys_pre_attributes}' +'{attribute,insert,app_vsn,"megaco-4.4.3"}' -I../../include -o../../ebin megaco_flex_scanner.erl
gmake[5]: *** [/Users/aselder/.asdf/plugins/erlang/kerl-home/builds/asdf_25.3.2.5/otp_src_25.3.2.5/make/aarch64-apple-darwin23.0.0/otp.mk:136: ../../ebin/megaco_flex_scanner.beam] Error 138
Looks like something with megaco. This is unfortunate because one of our dependencies (statix) doesn’t work with OTP 26 yet.
Same issue with erlang 25.3.2.6 using asdf
. I tried looking into compiling without megaco, but that doesn’t seem possible.
As per this comment recompiling Erlang 25 with JIT disabled seems to work:
KERL_CONFIGURE_OPTIONS="--disable-debug --disable-silent-rules --without-javac --enable-shared-zlib --enable-dynamic-ssl-lib --enable-threads --enable-kernel-poll --without-wx --enable-webview --enable-darwin-64bit --enable-gettimeofday-as-os-system-time --with-ssl=/opt/homebrew/opt/openssl@3 --disable-jit" asdf install erlang 25.3
Installing Erlang 25 with rtx also works if you disable JIT:
% cat .tool-versions
elixir 1.15.5-otp-25
erlang 25.3.2.6
% KERL_CONFIGURE_OPTIONS="--disable-jit" rtx install
it’s working
I’m also having this issue, but in my case I use nix as my package manager. Still figuring out how to “rebuild” everything from here
Thanks.
This worked for me:
KERL_CONFIGURE_OPTIONS="--disable-jit" asdf install erlang 25.2.2
No need to recompile, the elixir packages built using OTP26 work fine. try nixpkgs.legacyPackages.aarch64-darwin.beam.packages.erlang_26.elixir_1_15
here’s a stripped down flake.nix
that i use for my projects
# flake.nix
{
description = "Elixir on Sonoma";
outputs = { self, nixpkgs }:
let
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
beamPkgs = pkgs.beam.packages.erlang_26;
in
{
devShells.aarch64-darwin.default = pkgs.mkShell {
buildInputs = with
[
pkgs.darwin.apple_sdk.frameworks
];
[
beamPkgs.elixir_1_15
pkgs.sqlite
Foundation
CoreServices
AppKit
];
};
apps.aarch64-darwin.iex = {
type = "app";
program = "${beamPkgs.elixir_1_15}/bin/iex";
};
apps.aarch64-darwin.mix = {
type = "app";
program = "${beamPkgs.elixir_1_15}/bin/mix";
};
packages.aarch64-darwin.default = beamPkgs.elixir_1_15;
};
}
I installed Erlang 25 because the emqtt library I’m using is not compatible with 26.
Ok, that’s fine! I’ll try it!
Edit: I do got the elixir/erlang binaries to work using the erlang 26, however it seems that the elixir-ls binary stills seem to be broken even on the last release 0.16.0:
running /nix/store/2i4xqwk4g0zk39dik4qvk0gsv0nqxbg2-elixir-ls-0.16.0/bin/launch.sh
Preffered shell is zsh, relaunching
Looking for ASDF install
ASDF install found in /opt/homebrew/opt/asdf/libexec/asdf.sh, sourcing
zsh: bus error elixir-ls
Looks like there was an issue I nixpkgs as well (erlang and elixir broken on macOS Sonoma · Issue #257880 · NixOS/nixpkgs · GitHub)
I’ve created a seperate issue for beam packages, since there is no workaround for those: Beam modules throw `bus error` in aarch64-darwin on macOS 14 Sonoma · Issue #258100 · NixOS/nixpkgs · GitHub
Same problem until i disabled jit with this. along with comments here. How to install Erlang and Elixir on macOS with Apple M1 Chip — DevHeroes
export KERL_CONFIGURE_OPTIONS=“–disable-debug --disable-silent-rules --disable-jit --enable-dynamic-ssl-lib --enable-gettimeofday-as-os-system-time --enable-kernel-poll --without-javac --without-wx --without-odbc”
export PATH=“/opt/homebrew/opt/openssl@1.1/bin:$PATH”
asdf install erlang 25.1.2
asdf_25.1.2 is not a kerl-managed Erlang/OTP installation
The asdf_25.1.2 build has been deleted
Extracting source code
Building Erlang/OTP 25.1.2 (asdf_25.1.2), please wait…
APPLICATIONS DISABLED (See:/.asdf/plugins/erlang/kerl-home/builds/asdf_25.1.2/otp_build_25.1.2.log)
- jinterface : Java compiler disabled by user
- wx : User gave --without-wx option
- odbc : User gave --without-odbc option
Building docs…
Erlang/OTP 25.1.2 (asdf_25.1.2) has been successfully built
Cleaning up compilation products for 25.1.2
Cleaned up compilation products for 25.1.2 under /Users/user/.asdf/plugins/erlang/kerl-home/builds
Erlang 25.1.2 is on, Erlang 26.1 had no issues but need to compliant with the repo
I’d suggest compiling elixir-ls yourself for now
MIX_ENV=prod mix elixir_ls.release -o ~/.local/share/elixir-ls/
I believe it’s mix elixir_ls.release2
nowadays, or at least that’s how I’ve been building it for a while now.
For anyone else who just upgraded to Sonoma and are having the same issues re-installing Erlang < 26 I found a workaround here OTP25 bus error on Mac OS Sonoma · Issue #7687 · erlang/otp · GitHub
For those who uses nix you acn easily override the configure flags for the erlang compiling, as I show in this example to make elixir-ls
work again:
I also add another solution for this.
In my case a simple brew upgrade; brew update
resolved the issue. Running Elixir 1.15.6 on OTP 26 on a M1, 2020.