Following Phoenix Getting Started Guide, cannot compile dependency mint

Hello all!
I’ve been using elixir for a few months now and feel pretty comfortable in it. Now I wanted to checkout Phoenix LiveView, so I followed the getting started tutorial but I get stuck in “Up and Running”. (Up and Running — Phoenix v1.7.6). When I use the command mix ecto.create, it taps out with an error message

[… several other lines in the same file … ]
src/mint_shims.erl:204:1: Warning: function verify_hostname_match_loop/5 is unused
% 204| verify_hostname_match_loop(Refs0, Pres0, undefined, FailCB, Cert) →
% | ^

src/mint_shims.erl:227:1: Warning: function to_lower_ascii/1 is unused
% 227| to_lower_ascii({ip,_}=X) → X;
% | ^

src/mint_shims.erl:234:1: Warning: function to_string/1 is unused
% 234| to_string(S) when is_list(S) → S;
% | ^

could not compile dependency :mint, “mix compile” failed. Errors may have been logged above. You can recompile this dependency with “mix deps.compile mint”, update it with “mix deps.update mint” or clean it with “mix deps.clean mint”

I did that. I used mix deps.update mint, that works. But everytime I try to compile it, it fails with the same error message. I also tried to use a lower mint version (1.3 is needed because of Finch if I understand it correctly) - that did not work either, same error.

I checked the versions before starting as instructed

Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.14.5 (compiled with Erlang/OTP 24)

and I setup a local postgres DB and changed the config to match it (just the database name in fact). I am working on Ubuntu 22.04.2 LTS.

Unfortunately, google did not get me far. Do you have any ideas how to fix it? Any input is appreciated! If you have any questions or information I should provide, please say so, I will do my best.

Thank you! :blush:

I cannot replicate the behavior, I am running ubuntu 22.04 too.

Have you tried upgrading hex and

mix local.hex
mix archive.install hex phx_new

Also if you installed erlang using asdf, check that crypto is not in the list of the applications that is not installed, example output when installing otp-24:

APPLICATIONS DISABLED (See: /home/daniel/.asdf/plugins/erlang/kerl-home/builds/asdf_24.3.4.13/otp_build_24.3.4.13.log)
 * odbc           : ODBC library - link check failed

APPLICATIONS INFORMATION (See: /home/daniel/.asdf/plugins/erlang/kerl-home/builds/asdf_24.3.4.13/otp_build_24.3.4.13.log)
 * crypto         : Using OpenSSL 3.0 is not yet recommended for production code.
 * wx             : wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available
 *         wxWidgets must be installed on your system.
 *         Please check that wx-config is in path, the directory
 *         where wxWidgets libraries are installed (returned by
 *         'wx-config --libs' or 'wx-config --static --libs' command)
 *         is in LD_LIBRARY_PATH or equivalent variable and
 *         wxWidgets version is 3.0.2 or above.

Thank you for gettig back! I did both but the error still stands.

I haven’t installed erlang using asdf because my coworker told me not to. I installed elixir with asdf though.

Sadly I cannot give much support for pre-compiled versions as I never use them. I would recommend to check whether you have openssl1.1 and 3 installed, as in the default configuration erlang is dynamically linking the library from the system.

I’ll check that again but as far as I know they are there.
Thank you for taking time out of your day to help me :blush:

Try installing Erlang with asdf and see what happens.

unfortunately no changes :confused: I uninstalled everything and reinstalled it with asdf - same problem

Sometimes when I am desperate I just do rm -rf _build deps in the application directory and then do mix do deps.get, compile. It’s worth trying. :slight_smile:

What does your package manager tell you about installed OpenSSL versions?

What is the very first error listed? I just had this problem with Debian 12, and the first error was:

src/mint_shims.erl:37:14: can’t find include lib “public_key/include/public_key.hrl”
% 37| -include_lib(“public_key/include/public_key.hrl”).
% |

When I went looking for this file at /usr/lib/erlang/lib/public_key-1.13.2/include/public_key.hrl, I found the include directory was missing.

Doing a sudo apt install erlang-dev put the missing file in place and mint_shims.erl was able to compile.

Now I’m struggling with a completely different error with compiling cowlib, but that’s a different matter.


The next two issues I had on Debian 12 were…

  1. A 512MB Digital Ocean Droplet is too small to compile cowlib. I had to resize it to 1GB.
  2. I needed to sudo apt install erlang-xmerl.

After that, I was able to compile and create a release package with success!

1 Like

Hi all, coming back to this, I believe the issue comes from trying to create a phoenix project without installing erlang. I was actually able to use elixir before this without an erlang install. Hope this helps. I found this guide helpful: Installing Elixir and Erlang With ASDF | Pluralsight

Installing just the erlang-base package in Debian can cause this kind of mess - the BEAM isn’t aware that it’s been sliced up and weird failures result.

99.9% of the time you want to install the whole erlang package instead, which will install both of the subpackages you mentioned (among others).

1 Like

I had OPs error trying to run mix ecto.create using Amazon EC2 Ubuntu and your suggestion fixed it so thank you.

1 Like

Sorry, I totally forgot to update this post.
I ended up purging my system, uninstalling elixir and erlang and reinstalling everything with asdf. It turned out that I had some leftovers from my old erlang installation (probably prevented from clean up by skaffold because we use elixir in our work projects, too). Once I managed to clean up everything, I installed erlang first, then elixir, both with asdf. That worked perfectly and has been very stable for a while now. We’ve also changed all work projects to work with asdf, so now it’s very easy to switch between versions :slight_smile:

In detail I did the following:

  1. Uninstalled the ElixirLS VS Code extension and closed VS Code
  2. purged my local dev environment (we use skaffold)
  3. removed the folders deps, _build and .elixir_ls in their elixir folder
  4. uninstalled erlang and elixir with apt
  5. reinstalled erlang and elixir with asdf
  6. installed ElixirLS extension in VS Code and configured the extension to find the correct folder
  7. reinitialized my local dev environment

Thanks everybody for your input, I learned a lot!

P.S.: The ElixirLS extension wasn’t really working for me before I did all this, so cleaning everything up helped with that, too :slight_smile:


In the end, that worked. I had to clean up a bit more to really get the dependencies to reinstall correctly, but now it works like a charm and we even changed our work projects to go with asdf, too.