[PATCH] src/drivers/drivers.mak: add -D_GNU_SOURCE for libnl-tiny
Ivan Ivanov
qmastery16 at gmail.com
Sat Feb 28 11:15:48 PST 2026
[PATCH] src/drivers/drivers.mak: add -D_GNU_SOURCE for libnl-tiny
When building wpa_supplicant with some toolchains like musl libc
(e.g., from musl.cc project) and using libnl-tiny, compilation
fails because 'struct ucred' in netlink/msg.h is incomplete.
In musl, this structure is defined in sys/socket.h only inside an
"#ifdef _GNU_SOURCE" block, so the definition is hidden unless
_GNU_SOURCE is defined. Add -D_GNU_SOURCE to DRV_CFLAGS within the
CONFIG_LIBNL_TINY block to make the structure visible. This flag
is safe for other configurations and resolves errors such as:
error: field 'nm_creds' has incomplete type
error: invalid application of 'sizeof' to incomplete type 'struct ucred'
Signed off by: Ivan Ivanov <qmastery16 at gmail.com>
diff --git a/src/drivers/drivers.mak b/src/drivers/drivers.mak
index 5c819269f..160b53789 100644
--- a/src/drivers/drivers.mak
+++ b/src/drivers/drivers.mak
@@ -174,6 +174,7 @@ else
ifdef CONFIG_LIBNL_TINY
DRV_LIBS += -lnl-tiny
DRV_CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-tiny)
+ DRV_CFLAGS += -D_GNU_SOURCE
else
ifndef CONFIG_OSX
DRV_LIBS += -lnl
More information about the Hostap
mailing list