Summary: | devel/libgit2: Build failure with openssl3x/libressl | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | Ports & Packages | Reporter: | Adam Weinberger <adamw> | ||||||
Component: | Individual Port(s) | Assignee: | Matthias Fechner <mfechner> | ||||||
Status: | Closed FIXED | ||||||||
Severity: | Affects Only Me | CC: | agh, apevnev, doctor, fixer, jakub_lach, rozhuk.im, tant.sinnister | ||||||
Priority: | --- | Flags: | bugzilla:
maintainer-feedback?
(mfechner) |
||||||
Version: | Latest | ||||||||
Hardware: | Any | ||||||||
OS: | Any | ||||||||
Bug Depends on: | 273961 | ||||||||
Bug Blocks: | |||||||||
Attachments: |
|
Dear Adam, yes it is known to me that libgit2 does not support openssl3 in the current version. This port is also used by www/gitlab-ce which I currently upgrade to 16.3: https://gitlab.fechner.net/mfechner/Gitlab/-/commits/16.3 It will bring libgit version 1.6 which maybe supports openssl3 (I do not have the possibility to test this). But the upgrade is currently blocked by a problem described here: https://gitlab.com/gitlab-org/gitlab/-/issues/410500 If you have any idea to fix the gitlab-ce asset compiliation I can push the upgrade of libgit2 together with gitlab-ce 16.3. (In reply to Matthias Fechner from comment #1) Just for the record, 1.6.4 also does not build with openssl3. Are you planning on upgrading the port to 1.7.1? Created attachment 244765 [details] patch This simple patch should fix this issue and https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273638 PS: I do not like that situation is gitlab centrist. (In reply to Ivan Rozhuk from comment #3) That did not fix the build. It still produces the same error, and the problem remains that libgit2 is linking against /usr/lib/libssl.so rather than /usr/local/lib/libssl.so (from USES=ssl). (In reply to Adam Weinberger from comment #4) At least it fix build with libressl: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273638 Have no Idea why it use openssl from base. Created attachment 244773 [details]
patch
Sorry, I copy-paste same name for replace, now patch should work.
*** Bug 273657 has been marked as a duplicate of this bug. *** *** Bug 273638 has been marked as a duplicate of this bug. *** Thanks for the patch. I will do some tests, please give me a little bit time for it. I don't think that the patch really fixes the problem, it can maybe more seen as a work-around which then maybe will cause run-time problem? I used now the definition: DEFAULT_VERSIONS=ssl=openssl31 and rebuild libgit2, here the full build log: https://pkg.fechner.net/data/132amd64-gitlab/2023-09-11_22h08m48s/logs/libgit2-1.6.4.log It clearly tells: -- Found OpenSSL: /usr/lib/libcrypto.so (found version "1.1.1t") But it should find openssl 3.1 in /usr/local/lib/... So there are more options required to set if ssl is not base. I will let it run this night a full build and will do some runtime tests the next days. Patch only fix "ld: error: undefined symbol: SSL_get1_peer_certificate". I have no idea why it links with other instance of openssl. Is other ports link correctly? I added now the following lines, which fixed the detection of openssl:
USES= cmake:testing cpe pkgconfig python:build ssl
USE_GITHUB= yes
USE_LDCONFIG= yes
# Fix problems with openssl3 and libressl, can be removed with libgit2 version 1.7
CFLAGS+= -DSSLv23_method=TLS_client_method \
-Dsk_num=OPENSSL_sk_num -Dsk_value=OPENSSL_sk_value \
-DSSL_get1_peer_certificate=SSL_get_peer_certificate
CMAKE_TESTING_ON= BUILD_TESTS
CMAKE_ARGS= -DREGEX_BACKEND=pcre2 -DUSE_HTTP_PARSER=system \
-DCMAKE_CTEST_ARGUMENTS="-E;'invasive|online'" \
-DOPENSSL_ROOT_DIR=${OPENSSLBASE} \
-DOPENSSL_ENGINES_DIR=${ENGINESDIR}
CMAKE_OFF= BUILD_TESTS
But now I have another error message:
ld: error: undefined symbol: SSL_get_peer_certificate
>>> referenced by openssl.c
>>> src/libgit2/CMakeFiles/libgit2.dir/streams/openssl.c.o:(openssl_connect)
>>> referenced by openssl.c
>>> src/libgit2/CMakeFiles/libgit2.dir/streams/openssl.c.o:(openssl_certificate)
>>> did you mean: SSL_get0_peer_certificate
I think there are more mapping required?
(In reply to Matthias Fechner from comment #12) 1. It does not change detection of OpenSSL, as far I know, only simple build fix. 2. I already try 1.7 and it requires these functions mapping to build. 3. -DSSL_get1_peer_certificate=SSL_get_peer_certificate - need to look inside .h where this defined, probably SSL_get1_peer_certificate or SSL_get_peer_certificate hidden/disabled by some #ifdef. This was only my suggested change, my system based on libressl and attached patch fix build for me. (In reply to Adam Weinberger from comment #0) I'm getting build failure with LibreSSL as well I think that maybe works. Need some days to test everything with different SSL libs, maybe someone can help me here: diff --git a/devel/libgit2/Makefile b/devel/libgit2/Makefile index 6077ec583236..efa32e0f6af8 100644 --- a/devel/libgit2/Makefile +++ b/devel/libgit2/Makefile @@ -19,13 +19,20 @@ LIB_DEPENDS= libpcre2-8.so:devel/pcre2 \ USES= cmake:testing cpe pkgconfig python:build ssl USE_GITHUB= yes USE_LDCONFIG= yes +# Fix problems with openssl3 and libressl, can be removed with libgit2 version 1.7 +#CFLAGS+= -DSSLv23_method=TLS_client_method \ +# -Dsk_num=OPENSSL_sk_num -Dsk_value=OPENSSL_sk_value \ +# -DSSL_get1_peer_certificate=SSL_get_peer_certificate CMAKE_TESTING_ON= BUILD_TESTS CMAKE_ARGS= -DREGEX_BACKEND=pcre2 -DUSE_HTTP_PARSER=system \ - -DCMAKE_CTEST_ARGUMENTS="-E;'invasive|online'" + -DCMAKE_CTEST_ARGUMENTS="-E;'invasive|online'" \ + -DOPENSSL_ROOT_DIR=${OPENSSLBASE} \ + -DOPENSSL_ENGINES_DIR=${ENGINESDIR} + CMAKE_OFF= BUILD_TESTS PLIST_SUB= DISTVERSION=${DISTVERSION} \ SHLIB_VER=${DISTVERSION:R} (In reply to Matthias Fechner from comment #15) Extended CMAKE_ARGS work for me. Ivan's patch did not (LibreSSL). The ${CMAKE_ARGS} solution in comment #15 also works for openssl-1.1.1w,1, the ${CFLAGS} solution does not. (In reply to jakub_lach from comment #14) For me and for user in: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273638 libressl build issue fixed. Do you use libressl-devel? A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=44751f5f02191e232afe5c327cad3d50382ba497 commit 44751f5f02191e232afe5c327cad3d50382ba497 Author: Matthias Fechner <mfechner@FreeBSD.org> AuthorDate: 2023-09-13 05:48:02 +0000 Commit: Matthias Fechner <mfechner@FreeBSD.org> CommitDate: 2023-09-13 05:48:57 +0000 devel/libgit2: fix build problem with openssl3 and libressl Make cmake aware of the selected ssl lib PR: 273609 devel/libgit2/Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (In reply to Ivan Rozhuk from comment #18) Hi, no I use regular LibreSSL; I had linker error which after applying your patch changed to different one iirc (libgit2 was trying to link base openssl anyway). Worked perfectly for me. Thank you!! |
I'm getting the following, with DEFAULT_VERSIONS+= ssl=openssl31. Note that it seems to be linking against /usr/lib/libssl.so, which probably isn't right. I'm assuming the same problem would occur with ssl=openssl30. Do you get the same thing, or is it just me? [ 98% 186/186] /usr/local/bin/cmake -E cmake_symlink_library libgit2.so.1.5.2 libgit2.so.1.5 libgit2.so && : samu: job failed with status 1: : && /ccache/libexec/ccache/cc -D_GNU_SOURCE -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -Wall -Wextra -fvisibility=hidden -fPIC -Wdocumentation -Wno-documentation-deprecated-sync -Wno-missing-field-initializers -Wmissing-declarations -Wstrict-aliasing -Wstrict-prototypes -Wdeclaration-after-statement -Wshift-count-overflow -Wunused-const-variable -Wunused-function -Wint-conversion -Wc11-extensions -Wformat -Wformat-security -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DNDEBUG -Wl,-rpath,/usr/local/lib -fstack-protector-strong src/util/CMakeFiles/util.dir/alloc.c.o src/util/CMakeFiles/util.dir/allocators/failalloc.c.o src/util/CMakeFiles/util.dir/allocators/stdalloc.c.o src/util/CMakeFiles/util.dir/allocators/win32_leakcheck.c.o src/util/CMakeFiles/util.dir/date.c.o src/util/CMakeFiles/util.dir/filebuf.c.o src/util/CMakeFiles/util.dir/fs_path.c.o src/util/CMakeFiles/util.dir/futils.c.o src/util/CMakeFiles/util.dir/hash.c.o src/util/CMakeFiles/util.dir/net.c.o src/util/CMakeFiles/util.dir/pool.c.o src/util/CMakeFiles/util.dir/posix.c.o src/util/CMakeFiles/util.dir/pqueue.c.o src/util/CMakeFiles/util.dir/rand.c.o src/util/CMakeFiles/util.dir/regexp.c.o src/util/CMakeFiles/util.dir/runtime.c.o src/util/CMakeFiles/util.dir/sortedcache.c.o src/util/CMakeFiles/util.dir/str.c.o src/util/CMakeFiles/util.dir/strmap.c.o src/util/CMakeFiles/util.dir/thread.c.o src/util/CMakeFiles/util.dir/tsort.c.o src/util/CMakeFiles/util.dir/utf8.c.o src/util/CMakeFiles/util.dir/util.c.o src/util/CMakeFiles/util.dir/varint.c.o src/util/CMakeFiles/util.dir/vector.c.o src/util/CMakeFiles/util.dir/wildmatch.c.o src/util/CMakeFiles/util.dir/zstream.c.o src/util/CMakeFiles/util.dir/unix/map.c.o src/util/CMakeFiles/util.dir/unix/realpath.c.o src/util/CMakeFiles/util.dir/hash/collisiondetect.c.o src/util/CMakeFiles/util.dir/hash/sha1dc/sha1.c.o src/util/CMakeFiles/util.dir/hash/sha1dc/ubc_check.c.o src/util/CMakeFiles/util.dir/hash/openssl.c.o src/libgit2/CMakeFiles/libgit2.dir/annotated_commit.c.o src/libgit2/CMakeFiles/libgit2.dir/apply.c.o src/libgit2/CMakeFiles/libgit2.dir/attr.c.o src/libgit2/CMakeFiles/libgit2.dir/attr_file.c.o src/libgit2/CMakeFiles/libgit2.dir/attrcache.c.o src/libgit2/CMakeFiles/libgit2.dir/blame.c.o src/libgit2/CMakeFiles/libgit2.dir/blame_git.c.o src/libgit2/CMakeFiles/libgit2.dir/blob.c.o src/libgit2/CMakeFiles/libgit2.dir/branch.c.o src/libgit2/CMakeFiles/libgit2.dir/buf.c.o src/libgit2/CMakeFiles/libgit2.dir/cache.c.o src/libgit2/CMakeFiles/libgit2.dir/checkout.c.o src/libgit2/CMakeFiles/libgit2.dir/cherrypick.c.o src/libgit2/CMakeFiles/libgit2.dir/clone.c.o src/libgit2/CMakeFiles/libgit2.dir/commit.c.o src/libgit2/CMakeFiles/libgit2.dir/commit_graph.c.o src/libgit2/CMakeFiles/libgit2.dir/commit_list.c.o src/libgit2/CMakeFiles/libgit2.dir/config.c.o src/libgit2/CMakeFiles/libgit2.dir/config_cache.c.o src/libgit2/CMakeFiles/libgit2.dir/config_entries.c.o src/libgit2/CMakeFiles/libgit2.dir/config_file.c.o src/libgit2/CMakeFiles/libgit2.dir/config_mem.c.o src/libgit2/CMakeFiles/libgit2.dir/config_parse.c.o src/libgit2/CMakeFiles/libgit2.dir/config_snapshot.c.o src/libgit2/CMakeFiles/libgit2.dir/crlf.c.o src/libgit2/CMakeFiles/libgit2.dir/delta.c.o src/libgit2/CMakeFiles/libgit2.dir/describe.c.o src/libgit2/CMakeFiles/libgit2.dir/diff.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_driver.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_file.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_generate.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_parse.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_print.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_stats.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_tform.c.o src/libgit2/CMakeFiles/libgit2.dir/diff_xdiff.c.o src/libgit2/CMakeFiles/libgit2.dir/email.c.o src/libgit2/CMakeFiles/libgit2.dir/errors.c.o src/libgit2/CMakeFiles/libgit2.dir/fetch.c.o src/libgit2/CMakeFiles/libgit2.dir/fetchhead.c.o src/libgit2/CMakeFiles/libgit2.dir/filter.c.o src/libgit2/CMakeFiles/libgit2.dir/graph.c.o src/libgit2/CMakeFiles/libgit2.dir/hashsig.c.o src/libgit2/CMakeFiles/libgit2.dir/ident.c.o src/libgit2/CMakeFiles/libgit2.dir/idxmap.c.o src/libgit2/CMakeFiles/libgit2.dir/ignore.c.o src/libgit2/CMakeFiles/libgit2.dir/index.c.o src/libgit2/CMakeFiles/libgit2.dir/indexer.c.o src/libgit2/CMakeFiles/libgit2.dir/iterator.c.o src/libgit2/CMakeFiles/libgit2.dir/libgit2.c.o src/libgit2/CMakeFiles/libgit2.dir/mailmap.c.o src/libgit2/CMakeFiles/libgit2.dir/merge.c.o src/libgit2/CMakeFiles/libgit2.dir/merge_driver.c.o src/libgit2/CMakeFiles/libgit2.dir/merge_file.c.o src/libgit2/CMakeFiles/libgit2.dir/message.c.o src/libgit2/CMakeFiles/libgit2.dir/midx.c.o src/libgit2/CMakeFiles/libgit2.dir/mwindow.c.o src/libgit2/CMakeFiles/libgit2.dir/netops.c.o src/libgit2/CMakeFiles/libgit2.dir/notes.c.o src/libgit2/CMakeFiles/libgit2.dir/object.c.o src/libgit2/CMakeFiles/libgit2.dir/object_api.c.o src/libgit2/CMakeFiles/libgit2.dir/odb.c.o src/libgit2/CMakeFiles/libgit2.dir/odb_loose.c.o src/libgit2/CMakeFiles/libgit2.dir/odb_mempack.c.o src/libgit2/CMakeFiles/libgit2.dir/odb_pack.c.o src/libgit2/CMakeFiles/libgit2.dir/offmap.c.o src/libgit2/CMakeFiles/libgit2.dir/oid.c.o src/libgit2/CMakeFiles/libgit2.dir/oidarray.c.o src/libgit2/CMakeFiles/libgit2.dir/oidmap.c.o src/libgit2/CMakeFiles/libgit2.dir/pack-objects.c.o src/libgit2/CMakeFiles/libgit2.dir/pack.c.o src/libgit2/CMakeFiles/libgit2.dir/parse.c.o src/libgit2/CMakeFiles/libgit2.dir/patch.c.o src/libgit2/CMakeFiles/libgit2.dir/patch_generate.c.o src/libgit2/CMakeFiles/libgit2.dir/patch_parse.c.o src/libgit2/CMakeFiles/libgit2.dir/path.c.o src/libgit2/CMakeFiles/libgit2.dir/pathspec.c.o src/libgit2/CMakeFiles/libgit2.dir/proxy.c.o src/libgit2/CMakeFiles/libgit2.dir/push.c.o src/libgit2/CMakeFiles/libgit2.dir/reader.c.o src/libgit2/CMakeFiles/libgit2.dir/rebase.c.o src/libgit2/CMakeFiles/libgit2.dir/refdb.c.o src/libgit2/CMakeFiles/libgit2.dir/refdb_fs.c.o src/libgit2/CMakeFiles/libgit2.dir/reflog.c.o src/libgit2/CMakeFiles/libgit2.dir/refs.c.o src/libgit2/CMakeFiles/libgit2.dir/refspec.c.o src/libgit2/CMakeFiles/libgit2.dir/remote.c.o src/libgit2/CMakeFiles/libgit2.dir/repository.c.o src/libgit2/CMakeFiles/libgit2.dir/reset.c.o src/libgit2/CMakeFiles/libgit2.dir/revert.c.o src/libgit2/CMakeFiles/libgit2.dir/revparse.c.o src/libgit2/CMakeFiles/libgit2.dir/revwalk.c.o src/libgit2/CMakeFiles/libgit2.dir/signature.c.o src/libgit2/CMakeFiles/libgit2.dir/stash.c.o src/libgit2/CMakeFiles/libgit2.dir/status.c.o src/libgit2/CMakeFiles/libgit2.dir/strarray.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/mbedtls.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/openssl.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/openssl_dynamic.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/openssl_legacy.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/registry.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/socket.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/stransport.c.o src/libgit2/CMakeFiles/libgit2.dir/streams/tls.c.o src/libgit2/CMakeFiles/libgit2.dir/submodule.c.o src/libgit2/CMakeFiles/libgit2.dir/sysdir.c.o src/libgit2/CMakeFiles/libgit2.dir/tag.c.o src/libgit2/CMakeFiles/libgit2.dir/threadstate.c.o src/libgit2/CMakeFiles/libgit2.dir/trace.c.o src/libgit2/CMakeFiles/libgit2.dir/trailer.c.o src/libgit2/CMakeFiles/libgit2.dir/transaction.c.o src/libgit2/CMakeFiles/libgit2.dir/transport.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/auth.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/auth_negotiate.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/auth_ntlm.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/credential.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/credential_helpers.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/git.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/http.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/httpclient.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/local.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/smart.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/smart_pkt.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/smart_protocol.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/ssh.c.o src/libgit2/CMakeFiles/libgit2.dir/transports/winhttp.c.o src/libgit2/CMakeFiles/libgit2.dir/tree-cache.c.o src/libgit2/CMakeFiles/libgit2.dir/tree.c.o src/libgit2/CMakeFiles/libgit2.dir/worktree.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xdiffi.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xemit.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xhistogram.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xmerge.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xpatience.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xprepare.c.o src/libgit2/CMakeFiles/libgit2.dir/xdiff/xutils.c.o deps/ntlmclient/CMakeFiles/ntlmclient.dir/ntlm.c.o deps/ntlmclient/CMakeFiles/ntlmclient.dir/util.c.o deps/ntlmclient/CMakeFiles/ntlmclient.dir/unicode_builtin.c.o deps/ntlmclient/CMakeFiles/ntlmclient.dir/crypt_openssl.c.o src/cli/CMakeFiles/git2_cli.dir/cmd.c.o src/cli/CMakeFiles/git2_cli.dir/cmd_cat_file.c.o src/cli/CMakeFiles/git2_cli.dir/cmd_clone.c.o src/cli/CMakeFiles/git2_cli.dir/cmd_hash_object.c.o src/cli/CMakeFiles/git2_cli.dir/cmd_help.c.o src/cli/CMakeFiles/git2_cli.dir/main.c.o src/cli/CMakeFiles/git2_cli.dir/opt.c.o src/cli/CMakeFiles/git2_cli.dir/opt_usage.c.o src/cli/CMakeFiles/git2_cli.dir/progress.c.o src/cli/CMakeFiles/git2_cli.dir/unix/sighandler.c.o -o git2_cli -Wl,-rpath,/usr/local/lib: /usr/lib/libssl.so /usr/lib/libcrypto.so /usr/local/lib/libhttp_parser.so /usr/local/lib/libpcre2-8.so /usr/lib/libz.so -lrt -lpthread && : ld: error: undefined symbol: SSL_get1_peer_certificate >>> referenced by openssl.c >>> src/libgit2/CMakeFiles/libgit2.dir/streams/openssl.c.o:(openssl_connect) >>> referenced by openssl.c >>> src/libgit2/CMakeFiles/libgit2.dir/streams/openssl.c.o:(openssl_certificate) >>> did you mean: SSL_get_peer_certificate >>> defined in: /usr/lib/libssl.so cc: error: linker command failed with exit code 1 (use -v to see invocation) samu: subcommand failed ===> Compilation failed unexpectedly. Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer. *** Error code 1 Stop. make: stopped in /usr/ports/devel/libgit2