[PATCH] src/drivers/drivers.mak: add -D_GNU_SOURCE for libnl-tiny
Ivan Ivanov
qmastery16 at gmail.com
Fri Mar 6 13:55:14 PST 2026
Dear friends,
Please let me know if any changes are needed or this one-liner patch
is already fine
Best regards,
Ivan Ivanov aka qmastery
On Sat, Feb 28, 2026 at 10:15 PM Ivan Ivanov <qmastery16 at gmail.com> wrote:
>
> [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