haskell-cryptography / HsOpenSSL

OpenSSL binding for Haskell
http://hackage.haskell.org/package/HsOpenSSL
Creative Commons Zero v1.0 Universal
22 stars 33 forks source link

Cross compile for Raspberry (armv6l-unknown-linux-musleabihf) with haskell.nix #60

Closed MiguelGArgiles closed 3 years ago

MiguelGArgiles commented 3 years ago

Hello

I am trying to cross-compile HsOpenSSL for Raspberry using haskell.nix. Everything works well cross compiling for Win64 and statically linking with Musl but it fails for raspberry.

I am trying to cross-compile HsOpenSSL-0.11.6.2 linked with Openssl-1.1.1g but it gives the following error:

OpenSSL/Cipher.hsc:20:7: error:
    Not in scope: ‘aesCTR’
    Perhaps you meant ‘aesCBC’ (line 94)
   |
20 |     , aesCTR
   |       ^^^^^^

Included opensslv.h has the following definition:

# define OPENSSL_VERSION_NUMBER  0x1010107fL
# define OPENSSL_VERSION_TEXT    "OpenSSL 1.1.1g  21 Apr 2020"

It seems to be related with OPENSSL_VERSION_NUMBER flag. Although, i am linking with Openssl 1.1.1g it seems that this flag indicate a previous version and, in any case, I do not understand the error because aesCTR should be defined if OPENSSL_VERSION_NUMBER indicates a previous version.

I understand that it a complex problem involving several tools as haskell.nix and cross compile but any indication would be great to find the root cause of the problem.

Thanks

vshabanov commented 3 years ago

Try HsOpenSSL-0.11.7. There was incorrect #include "HsOpenSSL.h" which come after #if OPENSSL_VERSION_NUMBER and hence not worked correctly. It's fixed in the latest version.

MiguelGArgiles commented 3 years ago

It works perfectly, thank you so much