haskell-cryptography / HsOpenSSL

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

Undefined references at build-time: How to diagnose? #73

Closed Kleidukos closed 1 year ago

Kleidukos commented 1 year ago

I am looking at an excerpt from Servant's CI that reads:

servant-http-streams> /home/runner/.stack/snapshots/x86_64-linux-tinfo6
/56b3fcb84982f013f91c3bba340a6ce16510bb53707b2db3c5de7acb17a328cb/8.10.4/lib/x86_64-linux-ghc-8.10.4/
HsOpenSSL-0.11.7.1-7zNQfhMHQ8IBUiEb0198cp/libHSHsOpenSSL-0.11.7.1-7zNQfhMHQ8IBUiEb0198cp.a
(Session.o):function HsOpenSSLzm0zi11zi7zi1zm7zzNQfhMHQ8IBUiEb0198cp_OpenSSLziSession_zdwio_info:
 error: undefined reference to 'SSL_get_peer_certificate'

https://github.com/haskell-servant/servant/actions/runs/3669289436/jobs/6203013983#step:7:660

@vshabanov How could I proceed to determine why it is happening?

Kleidukos commented 1 year ago

This line seems at fault:

if OPENSSL_VERSION_PREREQ(3,0)

at https://github.com/haskell-cryptography/HsOpenSSL/blob/2b57dfe7471d17922eacbda967e680a2c5c47d28/OpenSSL/Session.hsc#L771

vshabanov commented 1 year ago

Can you check whether e18303a6a233baa05ec782b5e76a65dc20f934dd fixes this issue?

Kleidukos commented 1 year ago

Awesome!! This issue is fixed :)

Kleidukos commented 1 year ago

@vshabanov Need help for a release? :)

Kleidukos commented 1 year ago

@vshabanov :heart: Thank you so much!

ulysses4ever commented 1 year ago

I seem to be hitting the same problem when trying to build hackage-cli with GHC 9.2 (and 9.4) on Ubuntu 22.04. I have HsOpenSSL-0.11.7.5 in the plan, which, I assume got all the fixes mentioned in this thread. What could be my problem? The build log is here.