Segmentation fault after update elixir and erlang

It works to me!!! Thanks a lot.

Hello, I have the same problem with my mac M1

louisclement@MacBook-Air-de-Louis T-POO-700-LIL_3 % iex
zsh: segmentation fault  iex

You guys should check if you (a) have Rosetta 2 and (b) are running the ARM version of Erlang/Elixir and not the Intel one.

1 Like

Also make sure the terminals donā€™t run using rosetta.

1 Like

This scenario is happening when someone migrates to a new ARM based MacBook from an Intel based one. I had encountered it - very difficult to even realise that this is happening as apple starts Rosetta emulation without any user preference (I remember that way - i might be wrong).

Its better to reset the home brew and start fresh when migrating to ARM based macbooks.

This post helped me diagnose when i was looking at asdf logs. I tried the usual wxwidgets, javac, etc without much help - i was not seeing any usual errors in the log. I was encountering segmentation fault and a search on google, github was returning 0 hits for this error. Thatā€™s when I realised that something else was wrong.

/bin/sh: line 1: 96426 Segmentation fault: 11  erlc -W -Werror +debug_info -DUSE_ESOCK=true -DENABLE_MEGACO_FLEX_SCANNER=true -DMEGACO_REENTRANT_FLEX_SCANNER=true -Dmegaco_parser_inline -pa /Users/home/.asdf/plugins/erlang/kerl-home/builds/asdf_24.0/otp_src_24.0/lib/et/ebin -pa /Users/home/.asdf/plugins/erlang/kerl-home/builds/asdf_24.0/otp_src_24.0/lib/megaco/ebin +'{parse_transform,sys_pre_attributes}' +'{attribute,insert,app_vsn,"megaco-4.0"}' -I../../include -o../../ebin megaco_flex_scanner_handler.erl
make[5]: *** [../../ebin/megaco_flex_scanner_handler.beam] Error 139
make[5]: *** Waiting for unfinished jobs....
/bin/sh: line 1: 96425 Segmentation fault: 11  erlc -W -Werror +debug_info -DUSE_ESOCK=true -DENABLE_MEGACO_FLEX_SCANNER=true -DMEGACO_REENTRANT_FLEX_SCANNER=true -Dmegaco_parser_inline -pa /Users/home/.asdf/plugins/erlang/kerl-home/builds/asdf_24.0/otp_src_24.0/lib/et/ebin -pa /Users/home/.asdf/plugins/erlang/kerl-home/builds/asdf_24.0/otp_src_24.0/lib/megaco/ebin +'{parse_transform,sys_pre_attributes}' +'{attribute,insert,app_vsn,"megaco-4.0"}' -I../../include -o../../ebin megaco_flex_scanner.erl

Finally I have uninstalled homebrew and installed it again. That fixed it. Resetting homebrew removed my default login shell - bash from homebrew. Another bump in the road - iTerm and terminal were erroring out. Had to switch to zsh and install homebrew and switch back to bash.

Post marked as solution does work (also one has to consider and plan things when removing homebrew):

1 Like

To anyone reading this thread and wondering, ā€œhow can I know for sure if my terminal is running in Rosetta mode?ā€ Hereā€™s an article that helped me.

Doesnā€™t seem quick and easy to find on Google, so thought Iā€™d share.

3 Likes

Hi community,

I recently did a software update and after updating, I canā€™t no longer run my Elixir Phoenix project ā€¦

18:56:$ iex
Segmentation fault: 11
18:56:$ elixir -v
Segmentation fault: 11
18:56:$ elixir
Usage: elixir [options] [.exs file] [data]

## General options

  -e "COMMAND"                 Evaluates the given command (*)
  -h, --help                   Prints this message (standalone)
  -r "FILE"                    Requires the given files/patterns (*)
  -S SCRIPT                    Finds and executes the given script in $PATH
  -pr "FILE"                   Requires the given files/patterns in parallel (*)
  -pa "PATH"                   Prepends the given path to Erlang code path (*)
  -pz "PATH"                   Appends the given path to Erlang code path (*)
  -v, --version                Prints Erlang/OTP and Elixir versions (standalone)
 # ...

Notice that i get Segmentation fault: 11 for almost everything except elixir.

Some infos:

  • I have tried to reinstall the whole brew
  • this is where my elixir is
18:58:$ which elixir
/opt/homebrew/bin/elixir

Thank you in advanced!!

Best wishes,
Jing Hui P.

Hi @enkr1 I would consider uninstalling and recompiling your Elixir and Erlang.

Hi @benwilson512,

I have tried multiple times and even deleted my brew and reinstall it. but still exists ā€¦

Update: Seems like it only happens to me ā€¦ my coworker just did a software update and nothing happensā€¦

I have been trying to reinstall everything (unsymlinked, delete folders, etc.) but no luck ā€¦

Please help. :frowning:

Native ARM vs. Rosetta, maybe? Seems to regularly catch people off-guard.

Native ARM.

I managed to somehow solve it by reinstalling everything including all the erl libs and elixir related libs as well as brew.

Thank you so much i think that is all.

I have no f**king clue why this happenedā€¦ Segmentation fault should not happen to elixir tho ā€¦

ā€¦ why?

Elixir isnā€™t segfaulting, the VM is segfaulting. Some underlying C library changed during the OS upgrade that is linked in, and so the installation is corrupted.

1 Like