Ssl 0.7.0 compilation fails on windows - any workaround?

Hi,

I am trying to install various web packages, all relying more or less on ssl, whose compilation fails on windows :

#=== ERROR while compiling ssl.0.7.0 ==========================================#
# context     2.2.1 | win32/x86_64 | ocaml.5.2.0 | https://opam.ocaml.org#8582dee8ae9e16724d00de6220a5f0d2080647aa
# path        ~\AppData\Local\opam\default\.opam-switch\build\ssl.0.7.0
# command     ~\AppData\Local\opam\default\bin\dune.exe build -p ssl -j 3 @install
# exit-code   1
# env-file    ~\AppData\Local\opam\log\ssl-33452-756d51.env
# output-file ~\AppData\Local\opam\log\ssl-33452-756d51.out
### output ###
# ssl_stubs.c:1321:3: warning: implicit declaration of function ‘ASN1_TIME_to_tm’; did you mean ‘ASN1_TIME_set’? [-Wimplicit-function-declaration]
# [...]
#       |   ^~~~~~~~~~~~~~~
#       |   ASN1_TIME_set
# ssl_stubs.c:1321:19: warning: implicit declaration of function ‘X509_get0_notBefore’; did you mean ‘X509_get_notBefore’? [-Wimplicit-function-declaration]
#  1321 |   ASN1_TIME_to_tm(X509_get0_notBefore(cert), &t);
#       |                   ^~~~~~~~~~~~~~~~~~~
#       |                   X509_get_notBefore
# ssl_stubs.c: In function ‘ocaml_ssl_get_expiration_date’:
# ssl_stubs.c:1333:19: warning: implicit declaration of function ‘X509_get0_notAfter’; did you mean ‘X509_get_notAfter’? [-Wimplicit-function-declaration]
#  1333 |   ASN1_TIME_to_tm(X509_get0_notAfter(cert), &t);
#       |                   ^~~~~~~~~~~~~~~~~~
#       |                   X509_get_notAfter



<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><>  đŸ« 
┌─ The following actions failed
│ λ build ssl 0.7.0
└─ 

It looks like this issue has already be reported here, and there. Latest investigation being here.

Is there a workaround meanwhile ?

You could try to install the tls package, which some packages like Cohttp support as alternate backend and given it is written in OCaml does not need OpenSSL.

Thank you for the hint. I tried but it failed with the same error.

Are you trying to do this in CI or locally? The trick is to install the test package for version 1.1.1w manually in the Cygwin installation being used by your opam root. I don’t recommend doing this routinely, but one can manually install packages by running Cygwin setup and pointing the root at %APPDATA%\Local\opam.cygwin\root

If it’s in CI, setup-ocaml has been updated with a mitigation for this issue.

I use it locally, on a windows box with the latest install. Although I have seen cygwin flying by during the install, I have no idea where the setup is sitting in your “kind a sandbox” setup
I don’t even know if it is call setup.exe or cygwin.exe. Help appreciated.

If you look in %LOCALAPPDATA%\opam\.cygwin there should be a setup-x86_64.exe program. You can run that and when it asks for the “Root Directory”, but the full path to %LOCALAPPDATA%\opam\.cygwin\root (%LOCALAPPDATA% will be something like C:\Users\you\AppData\Local). From the “Select Packages” dialog, you should be able to see the installed version of mingw64-x86_64-openssl (which is probably 1.0.2u+za-1) and you can then select 1.1.1w-0.1 manually.

1 Like

It worked ! Thank you !

1 Like

I can’t seem to progress past this, though I’m happy to have found a recent thread on it.

  1. I did “Install from internet”
  2. Use root directory as explained above

  1. Next until I arrive at select package list. I checked source and updated the dropdown to “Reinstall”

I still get the same build failure at ssl 0.7.0

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><>  đŸ«
⬇ retrieved dream.1.0.0~alpha7  (cached)
⬇ retrieved dream-httpaf.1.0.0~alpha3  (cached)
⬇ retrieved lwt_ssl.1.2.0  (cached)
⬇ retrieved ssl.0.7.0  (cached)
[ERROR] The compilation of ssl.0.7.0 failed at "dune build -p ssl -j 27 @install".

#=== ERROR while compiling ssl.0.7.0 ==========================================#
# context     2.3.0 | win32/x86_64 | ocaml.5.2.1 | https://opam.ocaml.org#727427c1e71db673d70869c8df4d678bf322632b
# path        ~\AppData\Local\opam\default\.opam-switch\build\ssl.0.7.0
# command     ~\AppData\Local\opam\default\bin\dune.exe build -p ssl -j 27 @install
# exit-code   1
# env-file    ~\AppData\Local\opam\log\ssl-170016-8ac70e.env
# output-file ~\AppData\Local\opam\log\ssl-170016-8ac70e.out
### output ###
# ssl_stubs.c:1321:3: warning: implicit declaration of function 'ASN1_TIME_to_tm'; did you mean 'ASN1_TIME_set'? [-Wimplicit-function-declaration]
# [...]
#       |   ^~~~~~~~~~~~~~~
#       |   ASN1_TIME_set
# ssl_stubs.c:1321:19: warning: implicit declaration of function 'X509_get0_notBefore'; did you mean 'X509_get_notBefore'? [-Wimplicit-function-declaration]
#  1321 |   ASN1_TIME_to_tm(X509_get0_notBefore(cert), &t);
#       |                   ^~~~~~~~~~~~~~~~~~~
#       |                   X509_get_notBefore
# ssl_stubs.c: In function 'ocaml_ssl_get_expiration_date':
# ssl_stubs.c:1333:19: warning: implicit declaration of function 'X509_get0_notAfter'; did you mean 'X509_get_notAfter'? [-Wimplicit-function-declaration]
#  1333 |   ASN1_TIME_to_tm(X509_get0_notAfter(cert), &t);
#       |                   ^~~~~~~~~~~~~~~~~~
#       |                   X509_get_notAfter

Thanks in advance for any help and guidance.

EDIT: I was picking the wrong ssl. The selection needed was for x64 (obvious in hindsight).
The dropdown showed 1.1.1w-0.1 before.

This is resolved for me now. Many thanks!