Skip to contentSkip to conversation

package/libmodsecurity: needs dynamic library with libcurl, libssh2 and mbedtls

PATCH In review Fabrice Fontaine 2 participants 3 messages Feb 19, 2023 – Feb 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 package/libmodsecurity: needs dynamic library with libcurl, libssh2 and mbedtls

Commit 9fc652a373034118535397fdd4042ab9f8fd7adf was incomplete as mbedtls can be pulled in libcurl through libssh2 resulting in the following build failure:

/home/autobuild/autobuild/instance-4/output-1/host/lib/gcc/powerpc64le-buildroot-linux-musl/11.3.0/../../../../powerpc64le-buildroot-linux-musl/bin/ld: /home/autobuild/autobuild/instance-4/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/lib//libmbedcrypto.a(md5.c.o): in function `mbedtls_md5_init':
md5.c:(.text+0x0): multiple definition of `mbedtls_md5_init'; ../../src/.libs/libmodsecurity.a(libmbedtls_la-md5.o):md5.c:(.text+0x0): first defined here

Fixes:
- http://autobuild.buildroot.org/results/4c235e46188f23d1a48297f4e5942cec7b25959a

---
Changes v2 -> v3:
- Fix syntax
Changes v1 -> v2:
- Update nginx-modsecurity

 package/libmodsecurity/Config.in    | 6 ++++--
 package/nginx-modsecurity/Config.in | 7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)
package/libmodsecurity/Config.in +4 -2
index b15d808759..027c62716c 100644
@@ -3,7 +3,8 @@ config BR2_PACKAGE_LIBMODSECURITY
 	depends on BR2_INSTALL_LIBSTDCPP
 	depends on BR2_TOOLCHAIN_HAS_THREADS
 	# libmodsecurity embeds several mbedtls source files
-	depends on !(BR2_STATIC_LIBS && BR2_PACKAGE_LIBCURL_MBEDTLS)
+	depends on !(BR2_STATIC_LIBS && (BR2_PACKAGE_LIBCURL_MBEDTLS \
+		|| (BR2_PACKAGE_LIBCURL && BR2_PACKAGE_LIBSSH2_MBEDTLS)))
 	select BR2_PACKAGE_PCRE2
 	help
 	  Libmodsecurity is one component of the ModSecurity
@@ -21,4 +22,5 @@ comment "libmodsecurity needs a toolchain w/ C++, threads"
 	depends on !BR2_INSTALL_LIBSTDCPP || !BR2_TOOLCHAIN_HAS_THREADS
 
 comment "libmodsecurity needs a toolchain w/ dynamic library"
-	depends on BR2_STATIC_LIBS && BR2_PACKAGE_LIBCURL_MBEDTLS
+	depends on BR2_STATIC_LIBS && (BR2_PACKAGE_LIBCURL_MBEDTLS \
+		|| (BR2_PACKAGE_LIBCURL && BR2_PACKAGE_LIBSSH2_MBEDTLS))
package/nginx-modsecurity/Config.in +5 -2
index 5cbe57a866..96ef7e88d5 100644
@@ -3,7 +3,9 @@ config BR2_PACKAGE_NGINX_MODSECURITY
 	depends on BR2_PACKAGE_NGINX_HTTP
 	depends on BR2_INSTALL_LIBSTDCPP # libmodsecurity
 	depends on BR2_TOOLCHAIN_HAS_THREADS # libmodsecurity
-	depends on !(BR2_STATIC_LIBS && BR2_PACKAGE_LIBCURL_MBEDTLS) # libmodsecurity
+	# libmodsecurity
+	depends on !(BR2_STATIC_LIBS && (BR2_PACKAGE_LIBCURL_MBEDTLS \
+		|| (BR2_PACKAGE_LIBCURL && BR2_PACKAGE_LIBSSH2_MBEDTLS)))
 	select BR2_PACKAGE_LIBMODSECURITY
 	help
 	  The ModSecurity-nginx connector is the connection
@@ -18,4 +20,5 @@ comment "nginx-modsecurity needs a toolchain w/ C++, threads"
 
 comment "nginx-modsecurity needs a toolchain w/ dynamic library"
 	depends on BR2_PACKAGE_NGINX_HTTP
-	depends on BR2_STATIC_LIBS && BR2_PACKAGE_LIBCURL_MBEDTLS
+	depends on BR2_STATIC_LIBS && (BR2_PACKAGE_LIBCURL_MBEDTLS \
+		|| (BR2_PACKAGE_LIBCURL && BR2_PACKAGE_LIBSSH2_MBEDTLS))
Signature · 6 lines
2.39.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hello Fabrice,

Quoted 10 lines · On Sun, 19 Feb 2023 18:24:40 +0100 Fabrice Fontaine…

Commit 9fc652a373034118535397fdd4042ab9f8fd7adf was incomplete as mbedtls can be pulled in libcurl through libssh2 resulting in the following build failure:

/home/autobuild/autobuild/instance-4/output-1/host/lib/gcc/powerpc64le-buildroot-linux-musl/11.3.0/../../../../powerpc64le-buildroot-linux-musl/bin/ld: /home/autobuild/autobuild/instance-4/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/lib//libmbedcrypto.a(md5.c.o): in function `mbedtls_md5_init':
md5.c:(.text+0x0): multiple definition of `mbedtls_md5_init'; ../../src/.libs/libmodsecurity.a(libmbedtls_la-md5.o):md5.c:(.text+0x0): first defined here

Fixes:
- http://autobuild.buildroot.org/results/4c235e46188f23d1a48297f4e5942cec7b25959a

Quoted 6 lines

---
Changes v2 -> v3:
- Fix syntax
Changes v1 -> v2:
- Update nginx-modsecurity

Isn't that a bit madness? If libmodsecurity has its copy of parts of mbedtls, but didn't take care of renaming the symbols, then ultimately what we should conclude is that using libmodsecurity in a statically linked configuration is not supported.

So I would advocate for simplifying the whole thing and just make libmodsecurity and its reverse dependencies depends on !BR2_STATIC_LIBS and be done with it.

What do you think?

Best regards,

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Hello,

Quoted 33 lines · Thomas Petazzoni

Hello Fabrice,

Quoted 5 lines · On Sun, 19 Feb 2023 18:24:40 +0100 Fabrice Fontaine…

Commit 9fc652a373034118535397fdd4042ab9f8fd7adf was incomplete as mbedtls can be pulled in libcurl through libssh2 resulting in the following build failure:

/home/autobuild/autobuild/instance-4/output-1/host/lib/gcc/powerpc64le-buildroot-linux-musl/11.3.0/../../../../powerpc64le-buildroot-linux-musl/bin/ld:
/home/autobuild/autobuild/instance-4/output-1/host/powerpc64le-buildroot-linux-musl/sysroot/usr/lib//libmbedcrypto.a(md5.c.o):
in function `mbedtls_md5_init':

Quoted 1 line

md5.c:(.text+0x0): multiple definition of `mbedtls_md5_init';

../../src/.libs/libmodsecurity.a(libmbedtls_la-md5.o):md5.c:(.text+0x0):
first defined here

Quoted 3 lines

Fixes:
-

http://autobuild.buildroot.org/results/4c235e46188f23d1a48297f4e5942cec7b25959a

Quoted 7 lines

---
Changes v2 -> v3:
- Fix syntax
Changes v1 -> v2:
- Update nginx-modsecurity

Isn't that a bit madness? If libmodsecurity has its copy of parts of mbedtls, but didn't take care of renaming the symbols, then ultimately what we should conclude is that using libmodsecurity in a statically linked configuration is not supported.

Quoted 6 lines

So I would advocate for simplifying the whole thing and just make libmodsecurity and its reverse dependencies depends on !BR2_STATIC_LIBS and be done with it.

What do you think?

OK, I'll send a v4

Quoted 9 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Best Regards,

Fabrice

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot