Message ID | 1390073027-14239-11-git-send-email-s.martin49@gmail.com |
---|---|
State | Superseded |
Headers | show |
Samuel, All, On 2014-01-18 20:23 +0100, Samuel Martin spake thusly: > When building statically hostapd with openssl support, it is necessary > to add -lz to LIBS to avoid undefined symbols when linking against > libcrypto.a. > > Signed-off-by: Samuel Martin <s.martin49@gmail.com> Shouldn't we fix openssl's libcrypto.pc instead? Adding -lz to Libs.private should do the trick, I guess, no? Regards, Yann E. MORIN.
On Sat, Jan 18, 2014 at 9:05 PM, Yann E. MORIN <yann.morin.1998@free.fr> wrote: > Samuel, All, > > On 2014-01-18 20:23 +0100, Samuel Martin spake thusly: >> When building statically hostapd with openssl support, it is necessary >> to add -lz to LIBS to avoid undefined symbols when linking against >> libcrypto.a. >> >> Signed-off-by: Samuel Martin <s.martin49@gmail.com> > > Shouldn't we fix openssl's libcrypto.pc instead? > Adding -lz to Libs.private should do the trick, I guess, no? > Well, both openssl and hostapd use custom build-system (ie. handwritten configure script and makefiles)... What a pity! :-( - on the openssl side: when building the static library, the libcrypto.pc is wrong because of what Yann points out (no -lz in Libs.private); - on the hostapd side: they just don't care/check about linking against the static library of libcrypto, they just only add -lcrypto to the ldflags. So, the right fix would be fixing the *.pc generation in openssl and call pkg-config to set the cflags and ldflags in hostapd but add a host-pkgconf dependency. OTOH, the quickest fix is this patch... Any input about the preferred way to fix it is welcome. Regards,
diff --git a/package/hostapd/hostapd.mk b/package/hostapd/hostapd.mk index 0fbd8bc..a978094 100644 --- a/package/hostapd/hostapd.mk +++ b/package/hostapd/hostapd.mk @@ -32,6 +32,7 @@ endef # Try to use openssl if it's already available ifeq ($(BR2_PACKAGE_OPENSSL),y) HOSTAPD_DEPENDENCIES += openssl + HOSTAPD_LIBS += $(if $(BR2_PREFER_STATIC_LIB),-lcrypto -lz) define HOSTAPD_TLS_CONFIG $(SED) 's/\(#\)\(CONFIG_TLS=openssl\)/\2/' $(HOSTAPD_CONFIG) $(SED) 's/\(#\)\(CONFIG_EAP_PWD.*\)/\2/' $(HOSTAPD_CONFIG)
When building statically hostapd with openssl support, it is necessary to add -lz to LIBS to avoid undefined symbols when linking against libcrypto.a. Signed-off-by: Samuel Martin <s.martin49@gmail.com> --- package/hostapd/hostapd.mk | 1 + 1 file changed, 1 insertion(+)