From: Hemanth Kumar M D <[email protected]>

Backport an upstream gnulib fix to avoid duplicate md5_* and sha1_*
symbol definitions when building with OpenSSL enabled.

Without this fix, lftp fails to link with errors such as:

  multiple definition of `md5_init_ctx'
  multiple definition of `sha1_init_ctx'

Link: https://github.com/lavv17/lftp/issues/743
Link: https://www.mail-archive.com/[email protected]/msg48445.html

Signed-off-by: Hemanth Kumar M D <[email protected]>
---
 .../lftp/files/gnulib-duplicate-symbols.patch | 40 +++++++++++++++++++
 .../recipes-connectivity/lftp/lftp_4.9.3.bb   |  5 ++-
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 
meta-networking/recipes-connectivity/lftp/files/gnulib-duplicate-symbols.patch

diff --git 
a/meta-networking/recipes-connectivity/lftp/files/gnulib-duplicate-symbols.patch
 
b/meta-networking/recipes-connectivity/lftp/files/gnulib-duplicate-symbols.patch
new file mode 100644
index 0000000000..220a095ff8
--- /dev/null
+++ 
b/meta-networking/recipes-connectivity/lftp/files/gnulib-duplicate-symbols.patch
@@ -0,0 +1,40 @@
+From: Jan Palus <[email protected]>
+Date: Sun, 17 Nov 2024 06:52:48 -0800
+Subject: [PATCH] {md5,sha1}-stream: avoid duplicate symbols
+
+When building with OpenSSL, *_init_ctx and other inline symbols are
+supposed to be provided by non *-stream compilation units. Drop the
+GL_OPENSSL_INLINE _GL_EXTERN_INLINE override from *-stream.c files so
+they don't re-emit those symbols as extern, causing duplicate symbol
+errors at link time when --whole-archive is used (as lftp does).
+
+Link: https://www.mail-archive.com/[email protected]/msg48445.html
+Upstream-Status: Backport 
[https://github.com/coreutils/gnulib/commit/353a3236d9328349c18ce2e4e984755cb4a76ea7]
+
+Signed-off-by: Jan Palus <[email protected]>
+Signed-off-by: Hemanth Kumar M D <[email protected]>
+
+--- a/lib/md5-stream.c
++++ b/lib/md5-stream.c
+@@ -22,9 +22,6 @@
+ #include <config.h>
+ 
+ /* Specification.  */
+-#if HAVE_OPENSSL_MD5
+-# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+-#endif
+ #include "md5.h"
+ 
+ #include <stdlib.h>
+--- a/lib/sha1-stream.c
++++ b/lib/sha1-stream.c
+@@ -24,9 +24,6 @@
+ #include <config.h>
+ 
+ /* Specification.  */
+-#if HAVE_OPENSSL_SHA1
+-# define GL_OPENSSL_INLINE _GL_EXTERN_INLINE
+-#endif
+ #include "sha1.h"
+ 
+ #include <stdlib.h>
diff --git a/meta-networking/recipes-connectivity/lftp/lftp_4.9.3.bb 
b/meta-networking/recipes-connectivity/lftp/lftp_4.9.3.bb
index 38bfa86751..3d838e6c42 100644
--- a/meta-networking/recipes-connectivity/lftp/lftp_4.9.3.bb
+++ b/meta-networking/recipes-connectivity/lftp/lftp_4.9.3.bb
@@ -6,7 +6,10 @@ SECTION = "console/network"
 LICENSE = "GPL-3.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
 
-SRC_URI = "http://lftp.yar.ru/ftp/lftp-${PV}.tar.bz2";
+SRC_URI = "http://lftp.yar.ru/ftp/lftp-${PV}.tar.bz2 \
+           file://gnulib-duplicate-symbols.patch \
+"
+
 SRC_URI[md5sum] = "c32e15b96c08f7f0b2d17efbceb00db8"
 SRC_URI[sha256sum] = 
"adceaef1bd21a38d07c973233fab603813c431f0a8dcbd23239fa9a41ae17b6e"
 
-- 
2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#127790): 
https://lists.openembedded.org/g/openembedded-devel/message/127790
Mute This Topic: https://lists.openembedded.org/mt/119988165/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to