riverrun / comeonin

Password hashing specification for the Elixir programming language

Home Page:https://hex.pm/packages/comeonin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Failed to load NIF library: no suitable image found. Did find _build/dev/lib/comeonin/priv/bcrypt_nif.so: mach-o, but built for simulator (not macOS)

sneakyness opened this issue · comments

Environment

  • Elixir & Erlang/OTP versions (elixir --version): Elixir 1.9.4 (compiled with Erlang/OTP 22)
  • Operating system: macOS 10.15.3
  • Xcode: 11.3.1 (11C504) (already ran xcode-select --install)

Current behavior

Getting this when trying to run

15:27:07.932 [warn]  The on_load function for module Elixir.Comeonin.Bcrypt returned:
{:error, {:load_failed, 'Failed to load NIF library: \'dlopen(/Users/sneakyness/Development/bacon/_build/dev/lib/comeonin/priv/bcrypt_nif.so, 2): no suitable image found.  Did find:\n\t/Users/sneakyness/Development/bacon/_build/dev/lib/comeonin/priv/bcrypt_nif.so: mach-o, but built for simulator (not macOS)\n\t/Users/sneakyness/Development/bacon/_build/dev/lib/comeonin/priv/bcrypt_nif.so: stat() failed with errno=35\''}}

 
15:27:09.047 [warn]  The on_load function for module Elixir.Comeonin.Bcrypt returned:
{:error, {:load_failed, 'Failed to load NIF library: \'dlopen(/Users/sneakyness/Development/bacon/_build/dev/lib/comeonin/priv/bcrypt_nif.so, 2): no suitable image found.  Did find:\n\t/Users/sneakyness/Development/bacon/_build/dev/lib/comeonin/priv/bcrypt_nif.so: mach-o, but built for simulator (not macOS)\n\t/Users/sneakyness/Development/bacon/_build/dev/lib/comeonin/priv/bcrypt_nif.so: stat() failed with errno=35\''}}

Assuming the relevant part is

Failed to load NIF library: /comeonin/priv/bcrypt_nif.so, no suitable image found.  
Did find: /comeonin/priv/bcrypt_nif.so: mach-o, but built for simulator (not macOS)

Expected behavior

It runs. It used to run, I'm not sure what has changed/broken since I ran it last

Additional information

  • Have tried variations of mix deps.clean --all && mix deps.get && mix deps.compile.
  • Already ran xcode-select --install

If you are using version 4 of comeonin, try running (cd deps/bcrypt_elixir && make clean && make).

If you are using an earlier version, try running (cd deps/comeonin && make clean && make).

Thanks for your time! Should I have both?

cd deps/bcrypt_elixir && make clean && make                                                                                                                                                                                 
rm -f priv/bcrypt_nif.so
mkdir -p priv
cc -g -O3 -Wall -Wno-format-truncation -I/usr/local/Cellar/erlang/22.2.3/lib/erlang/erts-10.6.2/include -Ic_src -fPIC -shared -dynamiclib -undefined dynamic_lookup c_src/bcrypt_nif.c c_src/blowfish.c -o priv/bcrypt_nif.so
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
1 warning generated.
ld: warning: -undefined dynamic_lookup is deprecated on iOS Simulator

and

cd deps/comeonin && make clean && make                                                                                                                                                                                       git:master*
make: *** No rule to make target `clean'.  Stop.

Issue persists. Seem to be using {:comeonin, "~> 2.5"}, in the config

I have looked online for information about the "mach-o, but built for simulator" error, but I do not use MacOS myself, and so I don't really understand a lot of the advice about this error. I think it would be a good idea for you to search for more information about this error yourself and let me know how you get on.

Checked a heap of those before posting this, couldn't find a solution or pin down a cause (that error message is unfortunately common going back 7+ years). That was my biggest motivator towards making this issue. I'm going to poke at it more tomorrow and will be sure to update this if I do find a solution. Thanks

Got this clang error while trying to do something else, which had much more useful google results:
clang: warning: using sysroot for 'iPhoneSimulator' but targeting 'MacOSX' [-Wincompatible-sysroot]

Restarting macOS, then doing a mix deps.clean --all && mix deps.get && mix deps.compile fixed it. I'm assuming Xcode left things in some sort of half installed state from an upgrade earlier in the day 🎉