diff mbox

package/libevent: fix static build

Message ID 1424035980-17049-1-git-send-email-romain.naour@openwide.fr
State Superseded
Headers show

Commit Message

Romain Naour Feb. 15, 2015, 9:33 p.m. UTC
For some reason, libevent silently fail to enable openssl support
even when it's explicitly requested.

Somes flags are missing when checking for zlib and openssl.

Fixes:
http://autobuild.buildroot.net/results/713/71362af474461e99b7c188a316aa644a0faaad2e

Signed-off-by: Romain Naour <romain.naour@openwide.fr>
---
 .../0002-Fix-openssl-check-for-static-build.patch  | 93 ++++++++++++++++++++++
 package/libevent/libevent.mk                       |  1 +
 2 files changed, 94 insertions(+)
 create mode 100644 package/libevent/0002-Fix-openssl-check-for-static-build.patch

Comments

Thomas Petazzoni Feb. 23, 2015, 6 p.m. UTC | #1
Dear Romain Naour,

On Sun, 15 Feb 2015 22:33:00 +0100, Romain Naour wrote:
> For some reason, libevent silently fail to enable openssl support
> even when it's explicitly requested.
> 
> Somes flags are missing when checking for zlib and openssl.
> 
> Fixes:
> http://autobuild.buildroot.net/results/713/71362af474461e99b7c188a316aa644a0faaad2e
> 
> Signed-off-by: Romain Naour <romain.naour@openwide.fr>

Do you have a defconfig that exhibits the build failure? I've tried the
following minimal defconfig, and it builds fine here:

BR2_bfin=y
BR2_BINFMT_FLAT=y
BR2_COMPILER_PARANOID_UNSAFE_PATH=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_INIT_NONE=y
# BR2_PACKAGE_BUSYBOX is not set
BR2_PACKAGE_OPENSSL=y
BR2_PACKAGE_LIBEVENT=y
# BR2_TARGET_ROOTFS_TAR is not set

Thanks,

Thomas
Romain Naour Feb. 23, 2015, 6:11 p.m. UTC | #2
Hi Thomas,

----- Mail original -----
| De: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>
| À: "Romain Naour" <romain.naour@openwide.fr>
| Cc: buildroot@buildroot.org
| Envoyé: Lundi 23 Février 2015 19:00:40
| Objet: Re: [Buildroot] [PATCH] package/libevent: fix static build
| 
| Dear Romain Naour,
| 
| On Sun, 15 Feb 2015 22:33:00 +0100, Romain Naour wrote:
| > For some reason, libevent silently fail to enable openssl support
| > even when it's explicitly requested.
| > 
| > Somes flags are missing when checking for zlib and openssl.
| > 
| > Fixes:
| > http://autobuild.buildroot.net/results/713/71362af474461e99b7c188a316aa644a0faaad2e
| > 
| > Signed-off-by: Romain Naour <romain.naour@openwide.fr>
| 
| Do you have a defconfig that exhibits the build failure? I've tried
| the
| following minimal defconfig, and it builds fine here:
| 

Can you try to build libwebsock with your config ?

Sorry, I meant libwebsock fix static build.

libevent break libwebsock's build because libevent_openssl.pc is not
installed.

Best regards,
Romain

| BR2_bfin=y
| BR2_BINFMT_FLAT=y
| BR2_COMPILER_PARANOID_UNSAFE_PATH=y
| BR2_TOOLCHAIN_EXTERNAL=y
| BR2_INIT_NONE=y
| # BR2_PACKAGE_BUSYBOX is not set
| BR2_PACKAGE_OPENSSL=y
| BR2_PACKAGE_LIBEVENT=y
| # BR2_TARGET_ROOTFS_TAR is not set
| 
| Thanks,
| 
| Thomas
| --
| Thomas Petazzoni, CTO, Free Electrons
| Embedded Linux, Kernel and Android engineering
| http://free-electrons.com
|
diff mbox

Patch

diff --git a/package/libevent/0002-Fix-openssl-check-for-static-build.patch b/package/libevent/0002-Fix-openssl-check-for-static-build.patch
new file mode 100644
index 0000000..6db0c4d
--- /dev/null
+++ b/package/libevent/0002-Fix-openssl-check-for-static-build.patch
@@ -0,0 +1,93 @@ 
+From 17e7b2bca663d0f434d35ecc3b3ecead49669ecf Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@openwide.fr>
+Date: Sun, 15 Feb 2015 19:43:11 +0100
+Subject: [PATCH] Fix openssl check for static build
+
+For some reason, AC_SEARCH_LIBS([inflateEnd], [z] forget to link with -lz
+
+config.log:
+configure:12914: checking for library containing inflateEnd
+configure:12945: Path/to/usr/bin/arm-linux-gcc -o conftest    -Os -g2 -static -Wall -fno-strict-aliasing   -static conftest.c  >&5
+/tmp/cc4iscfI.o: In function `main':
+Path/to/libevent-2.0.22-stable/conftest.c:36: undefined reference to `inflateEnd'
+collect2: error: ld returned 1 exit status
+
+Ditto for AC_SEARCH_LIBS([SSL_new], [ssl] (forget to link with -lssl -lcrypto
+and -lz)
+
+config.log:
+configure:13015: checking for library containing SSL_new
+configure:13046: Path/to/usr/bin/arm-linux-gcc -o conftest    -Os -g2 -static -Wall -fno-strict-aliasing   -static conftest.c  >&5
+/tmp/cc65AA50.o: In function `main':
+Path/to/libevent-2.0.22-stable/conftest.c:38: undefined reference to `SSL_new'
+collect2: error: ld returned 1 exit status
+
+Also add $(ZLIB_LIBS) when linking with ../libevent_openssl.la.
+
+Signed-off-by: Romain Naour <romain.naour@openwide.fr>
+---
+ configure.ac       | 6 +++---
+ sample/Makefile.am | 2 +-
+ test/Makefile.am   | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index d42edd8..814bd01 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -147,7 +147,7 @@ if test "x$ac_cv_header_zlib_h" = "xyes"; then
+ dnl Determine if we have zlib for regression tests
+ dnl Don't put this one in LIBS
+ save_LIBS="$LIBS"
+-LIBS=""
++LIBS="-lz"
+ ZLIB_LIBS=""
+ have_zlib=no
+ AC_SEARCH_LIBS([inflateEnd], [z],
+@@ -175,7 +175,7 @@ AC_CHECK_HEADERS([openssl/bio.h])
+ 
+ if test "$enable_openssl" = "yes"; then
+ save_LIBS="$LIBS"
+-LIBS=""
++LIBS="-lssl -lcrypto $ZLIB_LIBS"
+ OPENSSL_LIBS=""
+ have_openssl=no
+ AC_SEARCH_LIBS([SSL_new], [ssl],
+@@ -183,7 +183,7 @@ AC_SEARCH_LIBS([SSL_new], [ssl],
+ 	OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD"
+ 	AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl])],
+ 	[have_openssl=no],
+-	[-lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD])
++	[$ZLIB_LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD])
+ LIBS="$save_LIBS"
+ AC_SUBST(OPENSSL_LIBS)
+ fi
+diff --git a/sample/Makefile.am b/sample/Makefile.am
+index c926f4e..37329ef 100644
+--- a/sample/Makefile.am
++++ b/sample/Makefile.am
+@@ -21,7 +21,7 @@ http_server_SOURCES = http-server.c
+ if OPENSSL
+ noinst_PROGRAMS += le-proxy
+ le_proxy_SOURCES = le-proxy.c
+-le_proxy_LDADD = $(LDADD) ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD}
++le_proxy_LDADD = $(LDADD) ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD} $(ZLIB_LIBS)
+ endif
+ 
+ verify:
+diff --git a/test/Makefile.am b/test/Makefile.am
+index 0253a49..5b1998e 100644
+--- a/test/Makefile.am
++++ b/test/Makefile.am
+@@ -72,7 +72,7 @@ regress_LDFLAGS = $(PTHREAD_CFLAGS)
+ 
+ if OPENSSL
+ regress_SOURCES += regress_ssl.c
+-regress_LDADD += ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD}
++regress_LDADD += ../libevent_openssl.la -lssl -lcrypto ${OPENSSL_LIBADD} $(ZLIB_LIBS)
+ endif
+ 
+ bench_SOURCES = bench.c
+-- 
+1.9.3
+
diff --git a/package/libevent/libevent.mk b/package/libevent/libevent.mk
index c50b1d2..d469bd2 100644
--- a/package/libevent/libevent.mk
+++ b/package/libevent/libevent.mk
@@ -11,6 +11,7 @@  LIBEVENT_INSTALL_STAGING = YES
 LIBEVENT_LICENSE = BSD-3c, OpenBSD
 LIBEVENT_LICENSE_FILES = LICENSE
 # For 0001-Disable-building-test-programs.patch
+# and 0002-Fix-openssl-check-for-static-build.patch
 LIBEVENT_AUTORECONF = YES
 
 define LIBEVENT_REMOVE_PYSCRIPT