hostapd: fix static build failure
PATCH 1/1 hostapd: fix static build failure
libnl-3 uses threads and this isn't accounted for in hostapd (or libnl-3*.pc files for that matter - hostapd doesn't use pkg-config anyway).
Since linking order matters for static scenarios also throw in -lnl-3 into LIBS first since it gets appended to in hostapd makefiles to add libnl-3.
Fixes:
http://autobuild.buildroot.net/results/d4a/d4a9f44effeb08eda6c4b32764274ae81d185d5e/
--- package/hostapd/hostapd.mk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
package/hostapd/hostapd.mk +5 -4
@@ -10,13 +10,14 @@ HOSTAPD_SUBDIR = hostapd HOSTAPD_CONFIG = $(HOSTAPD_DIR)/$(HOSTAPD_SUBDIR)/.config HOSTAPD_DEPENDENCIES = libnl HOSTAPD_CFLAGS = $(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libnl3/ -HOSTAPD_LDFLAGS = $(TARGET_LDFLAGS) HOSTAPD_LICENSE = GPLv2/BSD-3c HOSTAPD_LICENSE_FILES = README -# libnl needs -lm (for rint) if linking statically +# libnl-3 needs -lm (for rint) and -lpthread if linking statically +# And library order matters hence stick -lnl-3 first since it's appended +# in the hostapd Makefiles as in LIBS+=-lnl-3 ... thus failing ifeq ($(BR2_PREFER_STATIC_LIB),y) -HOSTAPD_LDFLAGS += -lm +HOSTAPD_LIBS += -lnl-3 -lm -lpthread endif define HOSTAPD_LIBNL_CONFIG
@@ -93,7 +94,7 @@ endef define HOSTAPD_BUILD_CMDS $(TARGET_MAKE_ENV) CFLAGS="$(HOSTAPD_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS)" \ + LDFLAGS="$(TARGET_LDFLAGS)" LIBS="$(HOSTAPD_LIBS)" \ $(MAKE) CC="$(TARGET_CC)" -C $(@D)/$(HOSTAPD_SUBDIR) endef
Signature · 1 line
1.8.3.2
PATCH 1/1 hostapd: fix static build failure
Dear Gustavo Zacarias,
Quoted 23 lines · Gustavo Zacarias
libnl-3 uses threads and this isn't accounted for in hostapd (or libnl-3*.pc files for that matter - hostapd doesn't use pkg-config anyway).
Since linking order matters for static scenarios also throw in -lnl-3 into LIBS first since it gets appended to in hostapd makefiles to add libnl-3.Fixes:
http://autobuild.buildroot.net/results/d4a/d4a9f44effeb08eda6c4b32764274ae81d185d5e/Signed-off-by Gustavo Zacarias <[email protected]>--- package/hostapd/hostapd.mk | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)package/hostapd/hostapd.mk +0
-0@@ -10,13 +10,14 @@ HOSTAPD_SUBDIR = hostapd HOSTAPD_CONFIG = $(HOSTAPD_DIR)/$(HOSTAPD_SUBDIR)/.config HOSTAPD_DEPENDENCIES = libnl HOSTAPD_CFLAGS = $(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include/libnl3/
package/hostapd/hostapd.mk HOSTAPD_SUBDIR = hostapd · line 19
Quoted 10 lines
package/hostapd/hostapd.mk +3
-3-HOSTAPD_LDFLAGS = $(TARGET_LDFLAGS) HOSTAPD_LICENSE = GPLv2/BSD-3c HOSTAPD_LICENSE_FILES = README -# libnl needs -lm (for rint) if linking statically +# libnl-3 needs -lm (for rint) and -lpthread if linking statically +# And library order matters hence stick -lnl-3 first since it's appended +# in the hostapd Makefiles as in LIBS+=-lnl-3 ... thus failing ifeq ($(BR2_PREFER_STATIC_LIB),y) -HOSTAPD_LDFLAGS += -lm
So before this commit we were defining HOSTAPD_LDFLAGS...
package/hostapd/hostapd.mk endef · line 96
Quoted 9 lines
package/hostapd/hostapd.mk +1
-1+HOSTAPD_LIBS += -lnl-3 -lm -lpthread endif define HOSTAPD_LIBNL_CONFIG@@ -93,7 +94,7 @@ endef define HOSTAPD_BUILD_CMDS $(TARGET_MAKE_ENV) CFLAGS="$(HOSTAPD_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS)" \
but not using it? :-)
package/hostapd/hostapd.mk endef · line 100
Quoted 4 lines
package/hostapd/hostapd.mk +1
-0+ LDFLAGS="$(TARGET_LDFLAGS)" LIBS="$(HOSTAPD_LIBS)" \ $(MAKE) CC="$(TARGET_CC)" -C $(@D)/$(HOSTAPD_SUBDIR) endef
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 hostapd: fix static build failure
Quoted 5 lines · Thomas Petazzoni
So before this commit we were defining
HOSTAPD_LDFLAGS...Quoted 3 lines
+HOSTAPD_LIBS += -lnl-3 -lm -lpthread
endif
Quoted 8 lines
package/hostapd/hostapd.mk endef · line 96
Quoted 6 lines
define
HOSTAPD_LIBNL_CONFIGpackage/hostapd/hostapd.mk +0
-1@@ -93,7 +94,7 @@ endef define HOSTAPD_BUILD_CMDS $(TARGET_MAKE_ENV) CFLAGS="$(HOSTAPD_CFLAGS)" \ - LDFLAGS="$(TARGET_LDFLAGS)" \but not using it? :-)
Yes, there was brokeness!
Probably from the migration to hostapd-2.
Regards.
PATCH 1/1 hostapd: fix static build failure
In reply to Gustavo ZacariasQuoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Gustavo" == Gustavo Zacarias <[email protected]> writes:
libnl-3 uses threads and this isn't accounted for in hostapd (or libnl-3*.pc files for that matter - hostapd doesn't use pkg-config anyway).
Since linking order matters for static scenarios also throw in -lnl-3 into LIBS first since it gets appended to in hostapd makefiles to add libnl-3.Fixes:
http://autobuild.buildroot.net/results/d4a/d4a9f44effeb08eda6c4b32764274ae81d185d5e/
Committed, thanks.
Signature · 1 line
Bye, Peter Korsgaard