mix deps.get failed (seems missing ssl?)
Asked Answered
T

3

19

I'm sorry but I'm new to Elixir. while building phoenix application, mix deps.get failed with an error.

% mix deps.get
Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? [Yn] y
** (MatchError) no match of right hand side value: {:error, {:ssl, {'no such file or directory', 'ssl.app'}}}
    (mix) lib/mix/utils.ex:409: Mix.Utils.read_httpc/1
    (mix) lib/mix/utils.ex:354: Mix.Utils.read_path/2
    (mix) lib/mix/local.ex:107: Mix.Local.read_path!/2
    (mix) lib/mix/local.ex:86: Mix.Local.find_matching_versions_from_signed_csv!/2
    (mix) lib/mix/tasks/local.hex.ex:23: Mix.Tasks.Local.Hex.run/1
    (mix) lib/mix/dep/loader.ex:140: Mix.Dep.Loader.with_scm_and_app/4
    (mix) lib/mix/dep/loader.ex:98: Mix.Dep.Loader.to_dep/3
    (elixir) lib/enum.ex:1043: anonymous fn/3 in Enum.map/2
%

erlang and elixir has been installed via kerl and asdf. and my installation log is here http://otiai10.hatenablog.com/entry/2016/02/03/154953

envirionment

  • MacOS: 10.11.2
  • Erlang: 18.0
  • Elixir: 1.1.1

What is happening and what should I do?

Ti answered 3/2, 2016 at 7:27 Comment(5)
can you install hex manually by running "mix local.hex" ?Michey
thanks for comment! Running mix local.hex gives the same error output :( Does it seems like an error while installing Hex, right?Ti
Seems like it. Maybe you installed Erlang without SSL. Then you should explicitly install "erlang-ssl" packege. Also "asdf" manual says that you should "OS X: Install these via homebrew automake autoconf openssl libyaml readline libxslt libtool unixodbc". Maybe this will help.Michey
Thank! I tried building Erlang with --enable-dynamic-ssl-lib option, but it resulted in the same. Then I want to try --with-ssl, but do you have any idea where to specify openssl lib PATH on MacOS?Ti
--with-ssl=/usr/local/opt/opensslMichey
T
7

As @biletskyy answered, it was missing of SSL on Erlang installed via kerl, unlike via brew.

If you want to build Erlang with ssl via kerl, you should pass KERL_CONFIGURE_OPTIONS like below

KERL_CONFIGURE_OPTIONS="--with-ssl=/usr/local/opt/openssl" kerl build 18.0 18.0-foo

Then install Elixir via asdf. The mix command would work well.

Thanks to @biletskyy

Ti answered 3/2, 2016 at 9:29 Comment(1)
The asdf erlang plugin page lists this as pitfall when installing erlang on OSX: github.com/asdf-vm/…Maloney
S
27

In case you arent using kerl and you already did brew install openssl, they added ERLANG_OPENSSL_PATH option to asdf so you can do

asdf plugin-update erlang
ERLANG_OPENSSL_PATH="/usr/local/opt/openssl" asdf install erlang 21.1
Smallwood answered 28/10, 2018 at 13:58 Comment(0)
T
7

As @biletskyy answered, it was missing of SSL on Erlang installed via kerl, unlike via brew.

If you want to build Erlang with ssl via kerl, you should pass KERL_CONFIGURE_OPTIONS like below

KERL_CONFIGURE_OPTIONS="--with-ssl=/usr/local/opt/openssl" kerl build 18.0 18.0-foo

Then install Elixir via asdf. The mix command would work well.

Thanks to @biletskyy

Ti answered 3/2, 2016 at 9:29 Comment(1)
The asdf erlang plugin page lists this as pitfall when installing erlang on OSX: github.com/asdf-vm/…Maloney
F
0

I wasn't using asdf and had this same problem. I typically used brew, but for erlang, I was using evm so I could have multiple versions.

This seemed to help me: https://github.com/robisonsantos/evm/issues/28

I was using EVM and needed to point it to openssl in order to get mix deps.get to work. In my case, I was on OTP 21.2, so I did this:

evm uninstall OTP_21.2
evm install OTP_21.2 --with-ssl=/usr/local/opt/openssl

All was right with the world after that. I could run mix deps.get once I did this.

Fadein answered 8/2, 2019 at 20:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.