wallyfoo

wallyfoo

I was using asdf to install the latest Apple Silicon compiled versions of Erlang and Elixir to use on a Phoenix project that employs the new gen-auth stuff.

When running elixir 1.11.2-otp-23 + Erlang 23.2.1 for Apple Silicon, bcrypt_elixir fails to compile, noting it needs Erlang 20 or better. The bcrypt.nif never gets created.

When I revert back to my last Intel version of Erlang, 23.0.3, I can rebuild the project and the bcrypt.nif gets created. Keeping Apple or Intel Elixir makes no difference. It comes down to the Erlang base system.

So, what comes next? The maintainer of bcrypt_elixir recommended I post here since it doesn’t seem to be his problem – maybe something with the elixir_make process? I admit I’m still a newbie in this ecosystem, so I’m at a roadblock for where to go to seek the knowledge to get this resolved. I expect I’m not the only person this will affect.

Showing Posts 1 to 10

LostKobrakai

LostKobrakai

With bcrypt_elixir you’re not compiling elixir, but C. The error you posted in the github issue on for bcrypt_elixir does indeed suggest there’s some issue with the C related tooling, which may be something elixir_make can adjust for.

wallyfoo

wallyfoo OP

Brill. Thanks. I’ll pop over there and see what I can see.

wallyfoo

wallyfoo OP

This where I admit I’m an idiot and post the solution for others who didn’t already figure this out.

This was a VSCode problem. Everything was working as intended, but a race condition of a sort was breaking my needed flow.

My VSCode was launched. It’s the intel build, and it’s running the ElixirLS extension (jakebecker version).

I knew I needed to rebuild, so I rm -fr my deps and _build directories.

When VSCode was running in the background, after I deleted the deps directory, it re-fetched the dependencies automatically. The Intel versions, however that works. Rebuilding resulted in the mismatched versions of the bcrypt_nif.so, and Phoenix freaked the hell out when I tried to do any user authentication.

When I completely quit VSCode and built from the terminal after deleting the deps and _build directories, everything fetched and elixir_bcrypt built for the proper architecture.

I didn’t realize that VSCode was using its spawned Intel beam process to correctly fetch those deps according to its architecture. I wanted to share in case someone else has a brain fart like I did. I’ll probably switch to the VSCode insiders arm64 version until the main release gets the Apple Silicon treatment. Or maybe it’s finally time to switch to emacs.

16
Post #3
Nicd

Nicd

I just ran into this same issue. I build my project in Vagrant but I had left VSCode open looking at the shared folder, so it fetched the host OS NIFs when I was trying to build them inside Vagrant. Learned my lesson, close VSCode when building the release! :slight_smile:

aswinmohanme

aswinmohanme

I had posted a previous solution which was only a temporary one. The error resurfaced after some time. To get rid of it,

  • rm -rf deps _build
  • mix deps.get
  • mix deps.compile

Do these steps from a separate Silicon terminal instance.

I had the Intel version of NeoVim running. I installed the latest Apple Silicon one, followed the above steps and voila the error went away.

johnknott

johnknott

I just ran into this, because I switched to iTerm2 and for whatever reason that defaults to launching in x86 mode.

You can change this in the menu: iTerm2 → Preferences → Profiles → General and change “Login Shell” to “Command” and then enter “arch -arm64 $SHELL”. No idea why this isn’t default…

tuddman

tuddman

same issue - with SQLite blowing up with errors on an Apple Silicon (recompiled with elixir 1.13)
Solution for me:

most important part: is to do the following in a vanilla Terminal.app window (not iTerm!)

- rm -rf _build/*
- rm -rf deps/*
- mix deps.get
- mix deps.compile

and poof - compilation errors went away. Can now go back to running iex in an iTerm window no problem.

olivermt

olivermt

Is there no way to run vscode in arm mode?

wallyfoo

wallyfoo OP

https://code.visualstudio.com

If you’ve never downloaded the universal build, you’ll probably need to do so. I don’t know if the built-in update mechanism will update your x86 build to the universal one. If you’re having problems like this, I suspect VSCode doesn’t change tracks automatically.

sergio

sergio

This was the solution for me.

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews