package/libmicrohttpd: fix pthread detection
PATCH 1/2 package/libmicrohttpd: fix pthread detection
Fixes:
http://autobuild.buildroot.net/results/ceb802eea0fee5812efd717ae4cdbd9673d9507e/
Quoted from config.log:
conftest.c:32:26: error: #error "_REENTRANT must be defined"
--- package/libmicrohttpd/libmicrohttpd.mk | 3 +++ 1 file changed, 3 insertions(+)
package/libmicrohttpd/libmicrohttpd.mk +3 -0
@@ -22,4 +22,7 @@ LIBMICROHTTPD_LICENSE = LGPL-2.1+ or eCos LIBMICROHTTPD_CONF_OPTS += --disable-https endif +# fixes pthreads detection +LIBMICROHTTPD_CFLAGS += -D_REENTRANT + $(eval $(autotools-package))
Signature · 1 line
2.25.0
PATCH 2/2 package/libmicrohttpd: remove dependency on threads
Upstream added support for non-threaded builds:
https://git.gnunet.org/libmicrohttpd.git/commit/configure.ac?id=0eefd20ba370509d93fb7b0220e6d1c5739efac5
--- package/janus-gateway/Config.in | 1 - ...0001-daemon.c-fix-non-threaded-build.patch | 35 +++++++++++++++++++ package/libmicrohttpd/Config.in | 4 --- package/libmicrohttpd/libmicrohttpd.mk | 5 +++ 4 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 package/libmicrohttpd/0001-daemon.c-fix-non-threaded-build.patch
package/janus-gateway/Config.in +0 -1
@@ -77,7 +77,6 @@ comment "RabbitMQ transport needs a toolchain w/ dynamic library, threads" config BR2_PACKAGE_JANUS_GATEWAY_REST bool "REST (HTTP/HTTPS)" - depends on BR2_TOOLCHAIN_HAS_THREADS select BR2_PACKAGE_LIBMICROHTTPD comment "REST transport needs a toolchain w/ threads"
package/libmicrohttpd/0001-daemon.c-fix-non-threaded-build.patch new file +35 -0
@@ -0,0 +1,35 @@ +From 12e955560730b9caab0e73f693b6382413a8b48e Mon Sep 17 00:00:00 2001 +From: Bernd Kuhls <[email protected]> +Date: Tue, 24 Mar 2020 21:53:27 +0100 +Subject: [PATCH] daemon.c: fix non-threaded build + +insanity_level is available only for threaded builds. + +Patch sent upstream: https://bugs.gnunet.org/view.php?id=6135 + +Signed-off-by: Bernd Kuhls <[email protected]> +--- + src/microhttpd/daemon.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c +index 4f7c2108..51e9fd5b 100644 +--- a/src/microhttpd/daemon.c ++++ b/src/microhttpd/daemon.c +@@ -5086,12 +5086,12 @@ parse_options_va (struct MHD_Daemon *daemon, + daemon->uri_log_callback_cls = va_arg (ap, + void *); + break; ++#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) + case MHD_OPTION_SERVER_INSANITY: + daemon->insanity_level = (enum MHD_DisableSanityCheck) + va_arg (ap, + unsigned int); + break; +-#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) + case MHD_OPTION_THREAD_POOL_SIZE: + daemon->worker_pool_size = va_arg (ap, + unsigned int); +-- +2.25.0 +
package/libmicrohttpd/Config.in +0 -4
@@ -1,6 +1,5 @@ config BR2_PACKAGE_LIBMICROHTTPD bool "libmicrohttpd" - depends on BR2_TOOLCHAIN_HAS_THREADS help GNU libmicrohttpd is a small C library that makes it easy to run an HTTP server as part of another application.
@@ -21,6 +20,3 @@ comment "libmicrohttpd https support needs a toolchain w/ wchar, dynamic library depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS endif - -comment "libmicrohttpd needs a toolchain w/ threads" - depends on !BR2_TOOLCHAIN_HAS_THREADS
package/libmicrohttpd/libmicrohttpd.mk +5 -0
@@ -22,7 +22,12 @@ LIBMICROHTTPD_LICENSE = LGPL-2.1+ or eCos LIBMICROHTTPD_CONF_OPTS += --disable-https endif +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +LIBMICROHTTPD_CONF_OPTS += --with-threads=auto # fixes pthreads detection LIBMICROHTTPD_CFLAGS += -D_REENTRANT +else +LIBMICROHTTPD_CONF_OPTS += --with-threads=none +endif $(eval $(autotools-package))
Signature · 1 line
2.25.0
PATCH 1/2 package/libmicrohttpd: fix pthread detection
In reply to Bernd KuhlsHello,
package/libmicrohttpd/libmicrohttpd.mk LIBMICROHTTPD_LICENSE = LGPL-2.1+ or eCos · line 26
Quoted 2 lines · On Tue, 24 Mar 2020 22:00:40 +0100 Bernd Kuhls <[email protected]> wrote:
package/libmicrohttpd/libmicrohttpd.mk +2
-0+# fixes pthreads detection +LIBMICROHTTPD_CFLAGS += -D_REENTRANT
Thanks, but unfortunately this is not the proper fix. The proper fix is in gcc: when -pthread is passed, gcc should add -D_REENTRANT to the CFLAGS.
We have a patch for gcc 7.x to fix this for RISC-V:
package/gcc/7.5.0/0006-gcc-define-_REENTRANT-for-RISC-V-when-pthread-is-pas.patch
And this fix was merged in upstream gcc as of commit 75102502b3ee275c1d7aa8654dcb012e27c6a661.
We need the same fix for OpenRISC, i.e add:
#define CPP_SPEC "%{pthread:-D_REENTRANT}"
to gcc/config/or1k/linux.h.
Could you look into this instead, and report the bug to gcc ?
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com