Open bradschwartz opened 1 month ago
Summarizing from discussion over Discord:
mirrord
is built as a universal binary for Mac devices. This is why when you run a command to print the architecture, it will give results that look like it's running either as 32-bit or 64-bit x86 machine:
$ mirrord exec -- uname -p
i386
$ mirrord exec -- uname -m
x86_64
What's most likely happening is that bcrypt is then building an x86 shared object:
$ file _build/dev/lib/bcrypt_elixir/priv/bcrypt_nif.so
_build/dev/lib/bcrypt_elixir/priv/bcrypt_nif.so: Mach-O 64-bit dynamically linked shared library x86_64
and mix is having issues loading that properly once it tries to run any relevant commands.
The best workaround is to precompile dependencies mix deps.compile
in advance of starting up the process via mirrord
.
Bug Description
A Bcrypt hashing library for Elixir seems to have troubled when it is compiled by a process that is being run via
mirrord
. It is implemented as a NIF (FFI) and requires a C compiler to build. It seems like when I build my dependencies locally outside of mirrord, things work properly, but if I use mirrord without having pre-compiled the library is not compiling successfully (but fails silently until runtime).Steps to Reproduce
mix deps.get
rm -rf _build
mirrord exec -- iex -S mix
Bcrypt.Base.gen_salt(4, false)
Backtrace
Relevant Logs
Your operating system and version
Darwin Brad-Schwartz.lan 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Local process
/Users/brad.schwartz/.asdf/shims/iex: Bourne-Again shell script text executable, ASCII text
Local process version
Erlang/OTP 25 [erts-13.2.2.1] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] IEx 1.14.5 (compiled with Erlang/OTP 24)
Additional Info
I've tried setting
skip_build_tools: false
and that didn't do anything.