Skip to contentSkip to conversation

package/libwebsockets: fix build without threads

PATCH New Yegor Yefremov 2 participants 2 messages Nov 6 – Nov 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/libwebsockets: fix build without threads

libwebsockets 5.x enables LWS_WITH_CACHE_BLOB by default, which pulls in lib/misc/diskcache.c. That file unconditionally includes <pthread.h>, although it doesn't use any pthread API, so the build fails on toolchains without thread support:

lib/misc/diskcache.c:28:10: fatal error: pthread.h: No such file or directory

     28 | #include <pthread.h>
        |          ^~~~~~~~~~~

Add a patch, sent upstream, dropping the unused include.

This issue has been present since commit 0b820f8e22a9 ("package/libwebsockets: bump to version 5.1.0"), as 5.1.0 is the first version building diskcache.c by default. No release is affected yet; the maintenance branches still use 4.x and are not affected.

Fixes:
https://autobuild.buildroot.org/results/b05ce330be76f6ef1a5e5688c043b031270d13a3

Fixes 0b820f8e22a936ca80a3c7c8eb862c7476f53a71 ("package/libwebsockets: bump to version 5.1.0")
Assisted-by Claude:claude-opus-5-5
---
 ...he-drop-the-unused-pthread.h-include.patch | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 package/libwebsockets/0001-diskcache-drop-the-unused-pthread.h-include.patch
package/libwebsockets/0001-diskcache-drop-the-unused-pthread.h-include.patch new file +40 -0
new file mode 100644
index 0000000000..1e6fe18610
@@ -0,0 +1,40 @@
+From f87eb8f2c398b3bf9aa390460d17c4c336fce0bc Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 6 Nov 2026 09:14:22 +0100
+Subject: [PATCH] diskcache: drop the unused pthread.h include
+
+diskcache.c includes <pthread.h> unconditionally, although it doesn't
+use any pthread API.
+
+Since commit be9221232 ("cache: file-backed blob lws-cache-ttl level
+and lhp document asset cache"), LWS_WITH_CACHE_BLOB is enabled by
+default and pulls in diskcache.c, so the default build now fails on
+toolchains without thread support, e.g. uClibc-ng with
+UCLIBC_HAS_THREADS disabled:
+
+  lib/misc/diskcache.c:28:10: fatal error: pthread.h: No such file or directory
+     28 | #include <pthread.h>
+        |          ^~~~~~~~~~~
+
+Drop the include. Where threads are needed, private-lib-core.h already
+includes <pthread.h> depending on LWS_MAX_SMP / LWS_WITH_SYS_SMD.
+
+Upstream: sent to Andy Green <[email protected]> on 2026-11-06
+Assisted-by: Claude:claude-opus-5-5
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ lib/misc/diskcache.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/lib/misc/diskcache.c b/lib/misc/diskcache.c
+index 4ea24b626..ee999923f 100644
+--- a/lib/misc/diskcache.c
++++ b/lib/misc/diskcache.c
+@@ -25,7 +25,6 @@
+ #if !defined(_GNU_SOURCE)
+ #define _GNU_SOURCE
+ #endif
+-#include <pthread.h>
+ 
+ #include <libwebsockets.h>
+ #include "private-lib-core.h"
Signature · 6 lines
2.34.1

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

PATCH v2 1/1 package/libwebsockets: fix build without threads

libwebsockets 5.x enables LWS_WITH_CACHE_BLOB by default, which pulls in lib/misc/diskcache.c. That file unconditionally includes <pthread.h>, although it doesn't use any pthread API, so the build fails on toolchains without thread support:

lib/misc/diskcache.c:28:10: fatal error: pthread.h: No such file or directory

     28 | #include <pthread.h>
        |          ^~~~~~~~~~~

Backport the upstream fix dropping the unused include.

This issue has been present since commit 0b820f8e22a9 ("package/libwebsockets: bump to version 5.1.0"), as 5.1.0 is the first version building diskcache.c by default. No release is affected yet; the maintenance branches still use 4.x and are not affected.

Fixes:
https://autobuild.buildroot.org/results/b05ce330be76f6ef1a5e5688c043b031270d13a3

Fixes 0b820f8e22a936ca80a3c7c8eb862c7476f53a71 ("package/libwebsockets: bump to version 5.1.0")
Assisted-by Claude:claude-opus-5-5

---
Changes v1 -> v2:
- replace the patch with the upstream commit, merged as is by Andy Green

 ...he-drop-the-unused-pthread.h-include.patch | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 package/libwebsockets/0001-diskcache-drop-the-unused-pthread.h-include.patch
package/libwebsockets/0001-diskcache-drop-the-unused-pthread.h-include.patch new file +40 -0
new file mode 100644
index 0000000000..36f38076d6
@@ -0,0 +1,40 @@
+From 89b3a2cc1795028183846ee07b86b019acfa3969 Mon Sep 17 00:00:00 2001
+From: Yegor Yefremov <[email protected]>
+Date: Fri, 6 Nov 2026 09:36:47 +0100
+Subject: [PATCH] diskcache: drop the unused pthread.h include
+
+diskcache.c includes <pthread.h> unconditionally, although it doesn't
+use any pthread API.
+
+Since commit be9221232 ("cache: file-backed blob lws-cache-ttl level
+and lhp document asset cache"), LWS_WITH_CACHE_BLOB is enabled by
+default and pulls in diskcache.c, so the default build now fails on
+toolchains without thread support, e.g. uClibc-ng with
+UCLIBC_HAS_THREADS disabled:
+
+  lib/misc/diskcache.c:28:10: fatal error: pthread.h: No such file or directory
+     28 | #include <pthread.h>
+        |          ^~~~~~~~~~~
+
+Drop the include. Where threads are needed, private-lib-core.h already
+includes <pthread.h> depending on LWS_MAX_SMP / LWS_WITH_SYS_SMD.
+
+Assisted-by: Claude:claude-opus-5-5
+Upstream: https://github.com/warmcat/libwebsockets/commit/89b3a2cc1795028183846ee07b86b019acfa3969
+Signed-off-by: Yegor Yefremov <[email protected]>
+---
+ lib/misc/diskcache.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/lib/misc/diskcache.c b/lib/misc/diskcache.c
+index 4ea24b6266..ee999923f4 100644
+--- a/lib/misc/diskcache.c
++++ b/lib/misc/diskcache.c
+@@ -25,7 +25,6 @@
+ #if !defined(_GNU_SOURCE)
+ #define _GNU_SOURCE
+ #endif
+-#include <pthread.h>
+ 
+ #include <libwebsockets.h>
+ #include "private-lib-core.h"
Signature · 6 lines
2.34.1

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