EXLA.NIF.start_log_sink/1 Issue - Works on Ubuntu but not on MacBook M2

I’ve encountered an issue with EXLA when trying to run it on my MacBook with the M2 chip. While my application works flawlessly on an Ubuntu computer, it runs into problems on my MacBook due to an issue related to EXLA.NIF.start_log_sink/1. The error suggests that the EXLA.NIF module hasn’t been compiled properly or is unavailable.

Error:
** (Mix) Could not start application exla: EXLA.Application.start(:normal, ) returned an error: shutdown: failed to start child: EXLA.Logger
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function EXLA.NIF.start_log_sink/1 is undefined (module EXLA.NIF is not available)
(exla 0.6.0) EXLA.NIF.start_log_sink(#PID<0.430.0>)
(exla 0.6.0) lib/exla/logger.ex:12: EXLA.Logger.init/1
(stdlib 5.0.2) gen_server.erl:962: :gen_server.init_it/2
(stdlib 5.0.2) gen_server.erl:917: :gen_server.init_it/6
(stdlib 5.0.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

I’m running this inside a Docker container based on the Elixir:latest image. Despite the environment being containerized, there seems to be a difference in behavior between the MacBook M2 and the Ubuntu machine. If needed, I can share the Dockerfile or any other relevant configuration.

UPDATE:
I fixed the error updating gcc.
But know i have the following error:
[info] TfrtCpuClient created.
‘+fp-armv8’ is not a recognized feature for this target (ignoring feature)
‘+lse’ is not a recognized feature for this target (ignoring feature)
‘+neon’ is not a recognized feature for this target (ignoring feature)
‘+crc’ is not a recognized feature for this target (ignoring feature)
‘+crypto’ is not a recognized feature for this target (ignoring feature)
‘+fp-armv8’ is not a recognized feature for this target (ignoring feature)
‘+lse’ is not a recognized feature for this target (ignoring feature)
‘+neon’ is not a recognized feature for this target (ignoring feature)
‘+crc’ is not a recognized feature for this target (ignoring feature)
‘+crypto’ is not a recognized feature for this target (ignoring feature)
‘+fp-armv8’ is not a recognized feature for this target (ignoring feature)
‘+lse’ is not a recognized feature for this target (ignoring feature)
‘+neon’ is not a recognized feature for this target (ignoring feature)
‘+crc’ is not a recognized feature for this target (ignoring feature)
‘+crypto’ is not a recognized feature for this target (ignoring feature)
‘+fp-armv8’ is not a recognized feature for this target (ignoring feature)
‘+lse’ is not a recognized feature for this target (ignoring feature)
‘+neon’ is not a recognized feature for this target (ignoring feature)
‘+crc’ is not a recognized feature for this target (ignoring feature)
‘+crypto’ is not a recognized feature for this target (ignoring feature)
Segmentation fault

I have a similar problem but with the opposite configuration. I am trying to execute example from EXLA documentation:

fun = fn a, b -> Nx.add(a, b) end
left = Nx.tensor(1, type: {:u, 8})
right = Nx.tensor([1, 2, 3], type: {:u, 16})
EXLA.jit(fun).(left, right)

which works on MacBook Air M2 but when I try to run it in the application built in the Docker for Ubuntu 22.04 (ARM) it crashes with the same error message given in UPDATE part altogether with the segmentation fault at the end.

I wanted to debug it with gdb but could not find core dump file anywhere.

The issue was fixed in the new version of exla, here is the PR with the solution: Add Docker build script for Linux ARM by jonatanklosko · Pull Request #60 · elixir-nx/xla · GitHub