Bug 260216 - devel/libgit2 1.3.0 fails to build, error: static declaration of 'HMAC_CTX_cleanup' follows non-static declaration
Summary: devel/libgit2 1.3.0 fails to build, error: static declaration of 'HMAC_CTX_cl...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Matthias Fechner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-04 14:24 UTC by lysfjord.daniel
Modified: 2022-01-06 18:58 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (mfechner)


Attachments
poudriere build log for devel/libgit2-1.3.0 (219.21 KB, text/plain)
2021-12-04 14:24 UTC, lysfjord.daniel
no flags Details
quick and dirty patch (457 bytes, patch)
2021-12-04 16:35 UTC, lysfjord.daniel
no flags Details | Diff
patch-deps_ntlmclient_crypt__openssl.c (450 bytes, patch)
2021-12-04 17:03 UTC, lysfjord.daniel
no flags Details | Diff
working patch.. (420 bytes, patch)
2021-12-12 04:15 UTC, lysfjord.daniel
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description lysfjord.daniel 2021-12-04 14:24:56 UTC
Created attachment 229894 [details]
poudriere build log for devel/libgit2-1.3.0

libgit2-1.3.0 fails to build, probably due to DEFAULT_VERSIONS+= ssl=libressl, with the following error:

/wrkdirs/usr/ports/devel/libgit2/work/libgit2-1.3.0/deps/ntlmclient/crypt_openssl.c:49:20: error: static declaration of 'HMAC_CTX_cleanup' follows non-static declaration
static inline void HMAC_CTX_cleanup(HMAC_CTX *ctx)
                   ^
/usr/local/include/openssl/hmac.h:90:6: note: previous declaration is here
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
     ^
Attached is build log from poudriere.
Comment 1 lysfjord.daniel 2021-12-04 16:23:09 UTC
Seems like openssl deprecated the HMAC_CTX_cleanup for public use, and it was removed from hmac.h in ... 2015? The last commit to libressl hmac.h was four years ago.

'though, this code, as a lot of other code, is littered with explicit OPENSSL_VERSION_NUMBER checks *sigh*

Issue caused by commit 5158b0b70ade89268b22b7c388802b5f5b6debce in libgit2.
Comment 2 lysfjord.daniel 2021-12-04 16:35:17 UTC
Created attachment 229899 [details]
quick and dirty patch

It compiles, but if the ntlm part works? I don't know..
Comment 3 lysfjord.daniel 2021-12-04 17:03:21 UTC
Created attachment 229900 [details]
patch-deps_ntlmclient_crypt__openssl.c

Probably a heaps better way of doing it..
Comment 4 Matthias Fechner freebsd_committer 2021-12-06 06:20:33 UTC
Could you please try to get this fixed upstream (please add a link to the merge request and maybe issue here)?
If they accept it, I will include it and will do a new release, so we do not have to wait for a new version of libgit2.

Thanks.
Comment 5 lysfjord.daniel 2021-12-06 17:06:47 UTC
Bug report@ https://github.com/libgit2/libgit2/issues/6134
Comment 6 Ivan Rozhuk 2021-12-11 06:10:39 UTC
> #ifndef HMAC_CTX_cleanup

This patch does not work!
Function is not define and this will always FALSE.
Comment 7 lysfjord.daniel 2021-12-12 04:15:18 UTC
Created attachment 230051 [details]
working patch..

Working patch, but a less-than elegant solution..
Comment 8 dave 2022-01-04 17:57:44 UTC
Confirming this is still present. (Using Q12022)
Comment 9 lysfjord.daniel 2022-01-05 20:22:55 UTC
Fix merged upstream:

https://github.com/libgit2/libgit2/pull/6157
Comment 10 commit-hook freebsd_committer 2022-01-06 09:25:23 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=7679b30c466be8599a546a85bed877cb7128508d

commit 7679b30c466be8599a546a85bed877cb7128508d
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2022-01-06 08:19:44 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2022-01-06 09:24:23 +0000

    devel/libgit2: fix linking with libressl

    Patch upstream:
    https://github.com/libgit2/libgit2/pull/6157

    PR:             260216
    Reported by:    lysfjord.daniel@smokepit.net

 .../files/patch-deps_ntlmclient_crypt__openssl.c (new)        | 11 +++++++++++
 1 file changed, 11 insertions(+)
Comment 11 commit-hook freebsd_committer 2022-01-06 18:56:07 UTC
A commit in branch 2022Q1 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=e201bec79bd22afa624cea27910268c4137945ef

commit e201bec79bd22afa624cea27910268c4137945ef
Author:     Matthias Fechner <mfechner@FreeBSD.org>
AuthorDate: 2022-01-06 08:19:44 +0000
Commit:     Matthias Fechner <mfechner@FreeBSD.org>
CommitDate: 2022-01-06 18:55:06 +0000

    devel/libgit2: fix linking with libressl

    Patch upstream:
    https://github.com/libgit2/libgit2/pull/6157

    PR:             260216
    Reported by:    lysfjord.daniel@smokepit.net

    (cherry picked from commit 7679b30c466be8599a546a85bed877cb7128508d)

 .../files/patch-deps_ntlmclient_crypt__openssl.c (new)        | 11 +++++++++++
 1 file changed, 11 insertions(+)
Comment 12 Matthias Fechner freebsd_committer 2022-01-06 18:58:50 UTC
(In reply to lysfjord.daniel from comment #9)
Thanks a lot for the effort!
I added the patch.