kenny-evitt

kenny-evitt

`Unable to load crypto library` error on macOS after running some Homebrew commands

I commented on this Elixir lang GitHub issue:

I just observed this error today. I hadn’t seen it before. I installed both Erlang and Elixir via asdf, long before today. My specific error:

$ mix dialyzer
Compiling 1 file (.ex)
Finding suitable PLTs
Checking PLT...
[:asn1, :certifi, :compiler, :connection, :crontab, :crypto, :db_connection, :decimal, :ecto, :ecto_sql, :elixir, :hackney, :idna, :jason, :kernel, :logger, :metrics, :mimerl, :pane, :postgrex, :public_key, :scribe, :ssl, :ssl_verify_fun, :stdlib, :telemetry, :tzdata, :unicode_util_compat]

10:45:53.045 [error] Unable to load crypto library. Failed with error:
":load_failed, Failed to load NIF library: 'dlopen(/Users/kenny/.asdf/installs/erlang/22.2.1/lib/crypto-4.6.3/priv/lib/crypto.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /Users/kenny/.asdf/installs/erlang/22.2.1/lib/crypto-4.6.3/priv/lib/crypto.so
  Reason: image not found'"
OpenSSL might not be installed on this system.


10:45:53.050 [warn]  The on_load function for module crypto returned:
{:error, {:load_failed, 'Failed to load NIF library: \'dlopen(/Users/kenny/.asdf/installs/erlang/22.2.1/lib/crypto-4.6.3/priv/lib/crypto.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n  Referenced from: /Users/kenny/.asdf/installs/erlang/22.2.1/lib/crypto-4.6.3/priv/lib/crypto.so\n  Reason: image not found\''}}

** (UndefinedFunctionError) function :crypto.hash/2 is undefined (module :crypto is not available)
    (crypto) :crypto.hash(:sha, <<131, 116, 0, 0, 0, 22, 100, 0, 7, 99, 101, 114, 116, 105, 102, 105, 104, 7, 100, 0, 3, 104, 101, 120, 100, 0, 7, 99, 101, 114, 116, 105, 102, 105, 109, 0, 0, 0, 5, 50, 46, 53, 46, 49, 109, 0, 0, 0, 64, 56, ...>>)
    lib/mix/tasks/dialyzer.ex:384: Mix.Tasks.Dialyzer.dependency_hash/0
    lib/mix/tasks/dialyzer.ex:247: Mix.Tasks.Dialyzer.check_plt/1
    lib/mix/tasks/dialyzer.ex:172: Mix.Tasks.Dialyzer.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:79: Mix.CLI.run_task/2

What I did do recently – yesterday – was install the Homebrew docutils package. I had to ‘overwrite links’ for some Python files/libraries – apparently, because of the impending Python 2 EOL, Homebrew is working on removing Python 2 dependencies.

I wonder if OpenSSL – the version I have installed – depends on those Python 2 libraries.

It seems now, based on replies to my comment in that same GitHub issue, the Homebrew inadvertently messed-up Erlang.

This existing post on this forum seems to cover my error:

In that post, several people confirmed that uninstalling and re-installing Erlang via asdf resolved the error. I’m going to try that now.

Marked As Solved

kenny-evitt

kenny-evitt

Uninstalling and re-installing Erlang via asdf did the trick!

Also Liked

pdgonzalez872

pdgonzalez872

Awesome! Let’s see what happens after a fresh reinstall.

But, you mentioned that it was Python that was crying, correct?

Where we discussed this before: https://github.com/elixir-lang/elixir/issues/5453

kenny-evitt

kenny-evitt

This trick has worked now for two separate Elixir projects, both of which were broken by these errors.

monte

monte

Hi! I seem to have run into the same issue, however, the uninstalling and reinstalling Erlang with asdf does not resolve it, even if I specify the path to my version of openssl:

export KERL_CONFIGURE_OPTIONS="--with-ssl=$(brew --prefix openssl)"

Like @kenny-evitt I set up Elixir and Erlang long ago using asdf and it was working great until yesterday. The only change I made before things stopped working that seems like it could have caused this was installing emacs using brew. Now running any mix task an almost identical error to Kenny’s:

17:24:54.491 [error] Unable to load crypto library. Failed with error:
":load_failed, Failed to load NIF library: 'dlopen(/usr/local/Cellar/erlang/21.2.4/lib/erlang/lib/crypto-4.4/priv/lib/crypto.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib
  Referenced from: /usr/local/Cellar/erlang/21.2.4/lib/erlang/lib/crypto-4.4/priv/lib/crypto.so
  Reason: image not found'"
OpenSSL might not be installed on this system.

17:24:54.492 [warn]  The on_load function for module crypto returned:
{:error, {:load_failed, 'Failed to load NIF library: \'dlopen(/usr/local/Cellar/erlang/21.2.4/lib/erlang/lib/crypto-4.4/priv/lib/crypto.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib\n  Referenced from: /usr/local/Cellar/erlang/21.2.4/lib/erlang/lib/crypto-4.4/priv/lib/crypto.so\n  Reason: image not found\''}}

It seems like --with-ssl isn’t having any effect. I’m pretty sure that the brew update/install I did deleted openssl 1.0, I assume to force the upgrade to 1.1. I only have v1.1 installed.

I have tried using Kerl directly and several different versions of Erlang & Elixir with ‘–with-ssl’ specified. I keep getting the same error looking for libcrypto.1.0.0.dylib instead of libcrypto.1.1.0.dylib. I am on OS X Catalina (10.15.4) and XCode 11.4.1. I upgraded my XCode while trying to fix this since I was on a old version and getting warnings.

Anybody have any ideas why ‘–with-ssl’ isn’t working for specifying the version of OpenSSL? Am I missing something? It doesn’t seem like it is a linking problem (although brew does give me the same warning about refusing to link openssl@1.1).

I’ve also tried messing around with CFLAGS & tried setting LDFLAGS & CPPFLAGS but haven’t had any luck.

monte

monte

I was able to install using pure brew without a problem, so I am out of the woods for now (with versions 1.10.3 & 22.3.4).

Any insight that helps get asdf working again would still be appreciated. Without asdf I am likely to run into version issues down the road when switching between apps.

kylevsteger

kylevsteger

I had the same issue and reinstalling erlang didn’t help. I wound up removing my asdf install rm -rf ~/.asdf and reinstalling from git via their docs

Where Next?

Popular in Questions Top

joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 45766 226
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 42633 214
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

We're in Beta

About us Mission Statement