Fl4m3Ph03n1x

Fl4m3Ph03n1x

Cannot compile ssl_verify_fun in Windows 11 for Elixir

Background

I have a phoenix application in Windows 11. Unfortunately for me, I cannot compile the application because of a dependency error in Windows.

What I tried

First I tried the downloading Erlang from the official website (Downloads - Erlang/OTP), and Elixir
1.15.4 for OTP 26 (Installing Elixir - The Elixir programming language)

Unfortunately for me, I was greeted with an error when running mix phx.server.

$ mix deps.compile ssl_verify_fun ==> ssl_verify_fun Compiling 7 files (.erl) src/ssl_verify_hostname.erl:16: can't find include lib "public_key/include/public_key.hrl" 

So, this lead me into this Elixir thread where the same issue happens for Ubuntu:

The solution found was for the user to install a special erlang package for Ubuntu, erlang-dev. However, since I am on Windows, I don’t really have that option.

So I removed both Erlang and Elixir and installed them using scoop, hoping the older versions of both Elixir and Erlang available there would be free of this issue.

With scoop I am now using:

elixir 1.15.4 main 2023-07-27 10:27:04 erlang 25.3.2.4 main 2023-07-27 10:10:31 

Error

However, this still does not fix the issue, as I am greeted with a barrage of errors:

==> ssl_verify_fun Compiling 7 files (.erl) src/ssl_verify_fingerprint.erl:15:14: can't find include lib "public_key/include/public_key.hrl" % 15| -include_lib("public_key/include/public_key.hrl"). % | ^ src/ssl_verify_pk.erl:14:14: can't find include lib "public_key/include/public_key.hrl" % 14| -include_lib("public_key/include/public_key.hrl"). % | ^ src/ssl_verify_fun_cert_helpers.erl:13:14: can't find include lib "public_key/include/public_key.hrl" % 13| -include_lib("public_key/include/public_key.hrl"). % | ^ src/ssl_verify_fingerprint.erl:27:26: record 'OTPCertificate' undefined % 27| -spec verify_fun(Cert :: #'OTPCertificate'{}, % | ^ src/ssl_verify_pk.erl:26:26: record 'OTPCertificate' undefined % 26| -spec verify_fun(Cert :: #'OTPCertificate'{}, % | ^ src/ssl_verify_fun_cert_helpers.erl:23:34: undefined macro 'id-ce-subjectAltName' % 23| AltSubject = select_extension(?'id-ce-subjectAltName', Extensions), % | ^ src/ssl_verify_fingerprint.erl:29:39: record 'Extension' undefined % 29| {extension, #'Extension'{}}, InitialUserState :: term()) -> % | ^ src/ssl_verify_pk.erl:28:39: record 'Extension' undefined % 28| {extension, #'Extension'{}}, InitialUserState :: term()) -> % | ^ src/ssl_verify_hostname.erl:16:14: can't find include lib "public_key/include/public_key.hrl" % 16| -include_lib("public_key/include/public_key.hrl"). % | ^ src/ssl_verify_fun_cert_helpers.erl:9:2: function extract_dns_names/1 undefined % 9| -export([extract_dns_names/1, % | ^ src/ssl_verify_fingerprint.erl:52:39: record 'OTPCertificate' undefined % 52| -spec verify_cert_fingerprint(Cert :: #'OTPCertificate'{}, Fingerprint :: fingerprint()) -> % | ^ src/ssl_verify_pk.erl:51:30: record 'OTPCertificate' undefined % 51| -spec verify_cert_pk(Cert :: #'OTPCertificate'{}, Pk :: pk()) -> % | ^ src/ssl_verify_hostname.erl:28:26: record 'OTPCertificate' undefined % 28| -spec verify_fun(Cert :: #'OTPCertificate'{}, % | ^ src/ssl_verify_fun_cert_helpers.erl:19:2: spec for undefined function extract_dns_names/1 % 19| -spec extract_dns_names(Cert :: #'OTPCertificate'{}) -> [] | [string()]. % | ^ src/ssl_verify_hostname.erl:30:39: record 'Extension' undefined % 30| {extension, #'Extension'{}}, InitialUserState :: term()) -> % | ^ src/ssl_verify_fun_cert_helpers.erl:19:33: record 'OTPCertificate' undefined % 19| -spec extract_dns_names(Cert :: #'OTPCertificate'{}) -> [] | [string()]. % | ^ src/ssl_verify_hostname.erl:46:36: record 'OTPCertificate' undefined % 46| -spec verify_cert_hostname(Cert :: #'OTPCertificate'{}, Hostname :: hostname()) -> % | ^ src/ssl_verify_fun_cert_helpers.erl:32:26: record 'OTPCertificate' undefined % 32| -spec extract_cn(Cert :: #'OTPCertificate'{}) -> {error, no_common_name} | {ok, string()} | {error, invalid}. % | ^ src/ssl_verify_hostname.erl:76:38: record 'OTPCertificate' undefined % 76| Cert :: #'OTPCertificate'{}, % | ^ src/ssl_verify_fun_cert_helpers.erl:34:17: record 'OTPCertificate' undefined % 34| TBSCert = Cert#'OTPCertificate'.tbsCertificate, % | ^ src/ssl_verify_fun_cert_helpers.erl:35:32: record 'OTPTBSCertificate' undefined % 35| {rdnSequence, List} = TBSCert#'OTPTBSCertificate'.subject, % | ^ src/ssl_verify_fun_cert_helpers.erl:38:26: record 'OTPCertificate' undefined % 38| -spec extract_pk(Cert :: #'OTPCertificate'{}) -> {error, no_common_name} | #'SubjectPublicKeyInfo'{}. % | ^ src/ssl_verify_fun_cert_helpers.erl:38:76: record 'SubjectPublicKeyInfo' undefined % 38| -spec extract_pk(Cert :: #'OTPCertificate'{}) -> {error, no_common_name} | #'SubjectPublicKeyInfo'{}. % | ^ src/ssl_verify_fun_cert_helpers.erl:40:17: record 'OTPCertificate' undefined % 40| TBSCert = Cert#'OTPCertificate'.tbsCertificate, % | ^ src/ssl_verify_fun_cert_helpers.erl:41:26: record 'OTPTBSCertificate' undefined % 41| PublicKeyInfo = TBSCert#'OTPTBSCertificate'.subjectPublicKeyInfo, % | ^ src/ssl_verify_fun_cert_helpers.erl:42:16: record 'OTPSubjectPublicKeyInfo' undefined % 42| PublicKeyInfo#'OTPSubjectPublicKeyInfo'.subjectPublicKey. % | ^ src/ssl_verify_fun_cert_helpers.erl:48:24: record 'Extension' undefined % 48| -spec extensions_list([#'Extension'{}] | asn1_NOVALUE) -> [] | [#'Extension'{}]. ean it with "mix deps.clean ssl_verify_fun"n, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile ssl_verify_fun --force", update it with "mix deps.update ssl_verify_fun" or cl% | ^ src/ssl_verify_fun_cert_helpers.erl:48:65: record 'Extension' undefined % 48| -spec extensions_list([#'Extension'{}] | asn1_NOVALUE) -> [] | [#'Extension'{}]. % | ^ src/ssl_verify_fun_cert_helpers.erl:55:39: record 'Extension' undefined % 55| -spec select_extension(Id :: term(), [#'Extension'{}]) -> undefined | #'Extension'{}. % | ^ src/ssl_verify_fun_cert_helpers.erl:55:71: record 'Extension' undefined % 55| -spec select_extension(Id :: term(), [#'Extension'{}]) -> undefined | #'Extension'{}. % | ^ src/ssl_verify_fun_cert_helpers.erl:57:28: record 'Extension' undefined % 57| Matching = [Extension || #'Extension'{extnID = ExtId} = Extension <- Extensions, ExtId =:= Id], % | ^ src/ssl_verify_fun_cert_helpers.erl:57:84: variable 'ExtId' is unbound % 57| Matching = [Extension || #'Extension'{extnID = ExtId} = Extension <- Extensions, ExtId =:= Id], % | ^ src/ssl_verify_fun_cert_helpers.erl:75:15: record 'AttributeTypeAndValue' undefined % 75| extract_cn2([[#'AttributeTypeAndValue'{type={2, 5, 4, 3}, % | ^ src/ssl_verify_fun_cert_helpers.erl:77:39: variable 'CN' is unbound % 77| ssl_verify_fun_encodings:get_string(CN); % | ^ src/ssl_verify_fun_cert_helpers.erl:49:1: Warning: function extensions_list/1 is unused % 49| extensions_list(E) -> % | ^ src/ssl_verify_fun_cert_helpers.erl:56:1: Warning: function select_extension/2 is unused % 56| select_extension(Id, Extensions) -> % | ^ src/ssl_verify_fun_cert_helpers.erl:64:1: Warning: function extract_dns_names_from_alt_names/2 is unused % 64| extract_dns_names_from_alt_names([ExtValue | Rest], Acc) -> % | ^ 

At this point, given my setup is on Windows, I don’t know what else to try.

Question

How can I fix this issue?

Marked As Solved

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Answer

After some more digging I found out this issue:

Which represents my problem. Basically Elixir does not check the correct paths for the missing file:

Now, there is a possible workaround for this issue. By forcing your application to use a more updated version of the dependency in question (ssl_verify_fun), you can add this to your mix.exs file:

{:ssl_verify_fun, “~> 1.1.7”, manager: :rebar3, override: true}

However, I don’t really like this. If tomorrow the same thing happens, you have to overwrite again. And when overwrites start conflicting with each other, then you really have a problem.

In my case, I found which application was using the old version of ssl_verify_fun by looking at mix.lock. It was hackney.

However, instead of going through every dependency and trying to fix it, I took the more nuclear approach. I deleted my mix.lock and then run mix deps.update --all.

This forced some older dependencies to update. After that a simple mix deps.get fixed the issue and mix phx.server worked.

You can find more information in the Elixir Forum thread:

Also Liked

kokolegorille

kokolegorille

Sometime removing mix.lock and _build, deps folders is helping in dev.

But it might not be recommended otherwise :slight_smile:

Glad You find a solution to your problem.

Where Next?

Popular Backend topics Top

wolf4earth
At work we plan to replace a totally overkill Kafka instance with a combination of SNS and SQS. I don’t want to get into a discussion on ...
New
Fl4m3Ph03n1x
Background While playing around with dialyzer, typespecs and currying, I was able to create an example of a false positive in dialyzer. ...
New
Fl4m3Ph03n1x
Background I am trying to up my Functional Programming (FP) skills and one of the things that newcomers first learn in FP is the Option T...
New
JimmyCarterSon
Hello, I am. very new to Elixir lang I have only been doing it for about 2 weeks. I recently started following this tutorial todo list, ...
New
Ora2pgnewbie
Wanted to check if there is a UI available to use Ora2pg tool.
New
Fl4m3Ph03n1x
Background I am a fan of dialyzer and friends (looking at Gradient) and I try to have sepcs in my code as much as I can. To this end, I a...
New
sona11
If isReachable throws an IOException in Java, what is the right step to do and why? The application, I believe, should halt the process ...
New
harwind
I received this error for a binary search programme in C, despite the fact that it requested for inputs and produced the right output. Th...
/c
New
harwind
I’m presently working on a backend development project to build a RESTful API using Python and Flask. The Scaler backend developer site h...
New
Fl4m3Ph03n1x
Background I have a release file inside a tarball. However I want the final release to have some additional files and to move things aro...
New

Other popular topics Top

AstonJ
Or looking forward to? :nerd_face:
483 11078 254
New
Rainer
My first contact with Erlang was about 2 years ago when I used RabbitMQ, which is written in Erlang, for my job. This made me curious and...
New
AstonJ
Do the test and post your score :nerd_face: :keyboard: If possible, please add info such as the keyboard you’re using, the layout (Qw...
New
dimitarvp
Small essay with thoughts on macOS vs. Linux: I know @Exadra37 is just waiting around the corner to scream at me “I TOLD YOU SO!!!” but I...
New
AstonJ
If you get Can't find emacs in your PATH when trying to install Doom Emacs on your Mac you… just… need to install Emacs first! :lol: bre...
New
New
First poster: joeb
The File System Access API with Origin Private File System. WebKit supports new API that makes it possible for web apps to create, open,...
New
Help
I am trying to crate a game for the Nintendo switch, I wanted to use Java as I am comfortable with that programming language. Can you use...
New
PragmaticBookshelf
Programming Ruby is the most complete book on Ruby, covering both the language itself and the standard library as well as commonly used t...
New
sir.laksmana_wenk
I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc. However, I don’t...
New