* [Buildroot] [PATCH] irssi: add patch to fix static linking
@ 2017-03-21 3:45 Rodrigo Rebello
2017-03-21 8:41 ` Arnout Vandecappelle
2017-03-21 21:51 ` Thomas Petazzoni
0 siblings, 2 replies; 4+ messages in thread
From: Rodrigo Rebello @ 2017-03-21 3:45 UTC (permalink / raw)
To: buildroot
An upstream change which removed the option to build Irssi without SSL
support (v1.0.0 and later) also eliminated the use of PKG_CHECK_MODULES
to find the OpenSSL library, relying only on a test with AC_CHECK_LIB
for that purpose.
This unfortunately broke static linking since the flag to link with
zlib, used by OpenSSL, is missed completely.
The newly added patch therefore adds PKG_CHECK_MODULES back into the
configure script.
Fixes:
http://autobuild.buildroot.net/results/e8b51f65525246d1205a26859d418393aaebf48c/
http://autobuild.buildroot.net/results/35d952b3b36e295723bf8ed1badb4c9439201822/
http://autobuild.buildroot.net/results/ea8af1458edf3ce0e2b1c444d2ae29ac1e5d2fbf/
[...]
Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
---
...-to-using-pkg-config-to-check-for-OpenSSL.patch | 77 ++++++++++++++++++++++
| 3 +
2 files changed, 80 insertions(+)
create mode 100644 package/irssi/0001-Get-back-to-using-pkg-config-to-check-for-OpenSSL.patch
diff --git a/package/irssi/0001-Get-back-to-using-pkg-config-to-check-for-OpenSSL.patch b/package/irssi/0001-Get-back-to-using-pkg-config-to-check-for-OpenSSL.patch
new file mode 100644
index 000000000..0ce44f935
--- /dev/null
+++ b/package/irssi/0001-Get-back-to-using-pkg-config-to-check-for-OpenSSL.patch
@@ -0,0 +1,77 @@
+From ed0c2c1b9504a99a6dcc3c0f5de3b3a1c0232758 Mon Sep 17 00:00:00 2001
+From: Rodrigo Rebello <rprebello@gmail.com>
+Date: Mon, 20 Mar 2017 13:17:42 -0300
+Subject: [PATCH] Get back to using pkg-config to check for OpenSSL
+
+Commit 6300dfec7 removed the option to disable SSL support from the
+configure script since it became a requirement, but it also removed the
+use of pkg-config for finding the OpenSSL library and its dependencies.
+
+This had the unfortunate consequence of breaking the correct detection
+of library flags in many static linking scenarios. In some cases, for
+example, OpenSSL might have been built with zlib, which requires `-lz`
+to be passed to the linker when doing a static link of the irssi
+executable. Thus, pkg-config becomes an invaluable tool in such
+situations, since no guessing work is needed as the OpenSSL .pc file
+provides all the necessary flags.
+
+So, this patch re-inserts the PKG_CHECK_MODULES macro in the configure
+script when looking for OpenSSL. The test using AC_CHECK_LIB remains,
+but only as a last resort in case the one using pkg-config fails.
+
+Also, because the macro AM_PATH_GLIB_2_0 contains an unconditional call
+to PKG_PROG_PKG_CONFIG, the OpenSSL checks are moved so that they come
+after the Glib ones in order to avoid doubly checking for the pkg-config
+binary (PKG_CHECK_MODULES skips that check if it has been performed
+before, but PKG_PROG_PKG_CONFIG does not).
+
+Upstream status: submitted
+https://github.com/irssi/irssi/pull/677
+
+Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
+---
+ configure.ac | 21 +++++++++++++++------
+ 1 file changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 02b33497..9f191d3f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -231,11 +231,6 @@ if test "x$want_socks" = "xyes"; then
+ fi
+
+ dnl **
+-dnl ** OpenSSL checks
+-dnl **
+-AC_CHECK_LIB([ssl], [SSL_library_init])
+-
+-dnl **
+ dnl ** fe-text checks
+ dnl **
+
+@@ -276,7 +271,21 @@ if test -z "$GLIB_LIBS"; then
+ AC_ERROR([GLIB is required to build irssi.])
+ fi
+
+-LIBS="$LIBS $GLIB_LIBS -lssl -lcrypto"
++LIBS="$LIBS $GLIB_LIBS"
++
++dnl **
++dnl ** OpenSSL checks
++dnl **
++PKG_CHECK_MODULES([OPENSSL], [openssl], [
++ CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
++ LIBS="$LIBS $OPENSSL_LIBS"
++], [
++ AC_CHECK_LIB([ssl], [SSL_library_init], [
++ LIBS="$LIBS -lssl -lcrypto"
++ ], [
++ AC_MSG_ERROR([The OpenSSL library was not found])
++ ])
++])
+
+ dnl **
+ dnl ** curses checks
+--
+2.11.0
+
--git a/package/irssi/irssi.mk b/package/irssi/irssi.mk
index 7df7bbc44..dfb1e2878 100644
--- a/package/irssi/irssi.mk
+++ b/package/irssi/irssi.mk
@@ -13,6 +13,9 @@ IRSSI_LICENSE = GPLv2+
IRSSI_LICENSE_FILES = COPYING
IRSSI_DEPENDENCIES = host-pkgconf libglib2 ncurses openssl
+# We're patching configure.ac, so we need to autoreconf
+IRSSI_AUTORECONF = YES
+
IRSSI_CONF_OPTS = \
--disable-glibtest \
--with-ncurses=$(STAGING_DIR)/usr \
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] irssi: add patch to fix static linking
2017-03-21 3:45 [Buildroot] [PATCH] irssi: add patch to fix static linking Rodrigo Rebello
@ 2017-03-21 8:41 ` Arnout Vandecappelle
2017-03-21 22:25 ` Rodrigo Rebello
2017-03-21 21:51 ` Thomas Petazzoni
1 sibling, 1 reply; 4+ messages in thread
From: Arnout Vandecappelle @ 2017-03-21 8:41 UTC (permalink / raw)
To: buildroot
On 21-03-17 04:45, Rodrigo Rebello wrote:
> An upstream change which removed the option to build Irssi without SSL
> support (v1.0.0 and later) also eliminated the use of PKG_CHECK_MODULES
> to find the OpenSSL library, relying only on a test with AC_CHECK_LIB
> for that purpose.
>
> This unfortunately broke static linking since the flag to link with
> zlib, used by OpenSSL, is missed completely.
>
> The newly added patch therefore adds PKG_CHECK_MODULES back into the
> configure script.
>
> Fixes:
>
> http://autobuild.buildroot.net/results/e8b51f65525246d1205a26859d418393aaebf48c/
> http://autobuild.buildroot.net/results/35d952b3b36e295723bf8ed1badb4c9439201822/
> http://autobuild.buildroot.net/results/ea8af1458edf3ce0e2b1c444d2ae29ac1e5d2fbf/
> [...]
>
> Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
Excellent patch!
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
One question though...
> ---
[snip]
> ++dnl **
> ++dnl ** OpenSSL checks
> ++dnl **
> ++PKG_CHECK_MODULES([OPENSSL], [openssl], [
> ++ CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
> ++ LIBS="$LIBS $OPENSSL_LIBS"
> ++], [
> ++ AC_CHECK_LIB([ssl], [SSL_library_init], [
> ++ LIBS="$LIBS -lssl -lcrypto"
Is it useful to fall back to the non-pkg-config case? Due to glib2, pkg-config
is a hard requirement now, so this would only be to support pre-pkg-config
openssl versions, and I believe those are so ancient that they likely would
break API. I didn't actually check that, however.
Regards,
Arnout
> ++ ], [
> ++ AC_MSG_ERROR([The OpenSSL library was not found])
> ++ ])
> ++])
> +
> + dnl **
> + dnl ** curses checks
> +--
> +2.11.0
> +
> diff --git a/package/irssi/irssi.mk b/package/irssi/irssi.mk
> index 7df7bbc44..dfb1e2878 100644
> --- a/package/irssi/irssi.mk
> +++ b/package/irssi/irssi.mk
> @@ -13,6 +13,9 @@ IRSSI_LICENSE = GPLv2+
> IRSSI_LICENSE_FILES = COPYING
> IRSSI_DEPENDENCIES = host-pkgconf libglib2 ncurses openssl
>
> +# We're patching configure.ac, so we need to autoreconf
> +IRSSI_AUTORECONF = YES
> +
> IRSSI_CONF_OPTS = \
> --disable-glibtest \
> --with-ncurses=$(STAGING_DIR)/usr \
>
--
Arnout Vandecappelle arnout at mind be
Senior Embedded Software Architect +32-16-286500
Essensium/Mind http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] irssi: add patch to fix static linking
2017-03-21 3:45 [Buildroot] [PATCH] irssi: add patch to fix static linking Rodrigo Rebello
2017-03-21 8:41 ` Arnout Vandecappelle
@ 2017-03-21 21:51 ` Thomas Petazzoni
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2017-03-21 21:51 UTC (permalink / raw)
To: buildroot
Hello,
On Tue, 21 Mar 2017 00:45:53 -0300, Rodrigo Rebello wrote:
> An upstream change which removed the option to build Irssi without SSL
> support (v1.0.0 and later) also eliminated the use of PKG_CHECK_MODULES
> to find the OpenSSL library, relying only on a test with AC_CHECK_LIB
> for that purpose.
>
> This unfortunately broke static linking since the flag to link with
> zlib, used by OpenSSL, is missed completely.
>
> The newly added patch therefore adds PKG_CHECK_MODULES back into the
> configure script.
>
> Fixes:
>
> http://autobuild.buildroot.net/results/e8b51f65525246d1205a26859d418393aaebf48c/
> http://autobuild.buildroot.net/results/35d952b3b36e295723bf8ed1badb4c9439201822/
> http://autobuild.buildroot.net/results/ea8af1458edf3ce0e2b1c444d2ae29ac1e5d2fbf/
> [...]
>
> Signed-off-by: Rodrigo Rebello <rprebello@gmail.com>
> ---
> ...-to-using-pkg-config-to-check-for-OpenSSL.patch | 77 ++++++++++++++++++++++
> package/irssi/irssi.mk | 3 +
> 2 files changed, 80 insertions(+)
> create mode 100644 package/irssi/0001-Get-back-to-using-pkg-config-to-check-for-OpenSSL.patch
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Buildroot] [PATCH] irssi: add patch to fix static linking
2017-03-21 8:41 ` Arnout Vandecappelle
@ 2017-03-21 22:25 ` Rodrigo Rebello
0 siblings, 0 replies; 4+ messages in thread
From: Rodrigo Rebello @ 2017-03-21 22:25 UTC (permalink / raw)
To: buildroot
Arnout,
2017-03-21 5:41 GMT-03:00 Arnout Vandecappelle <arnout@mind.be>:
>
> Is it useful to fall back to the non-pkg-config case? Due to glib2, pkg-config
> is a hard requirement now, so this would only be to support pre-pkg-config
> openssl versions, and I believe those are so ancient that they likely would
> break API. I didn't actually check that, however.
>
I had originally considered discarding the non-pkg-config method
entirely, but since the upstream commit that touched that part of the
configure script and caused the regression explicitly preserved the
test involving AC_CHECK_LIB, I thought that maybe the author had a
good reason for that, like supporting old OpenSSL versions, as you
said, which still work with the current version of Irssi.
Anyway, let's see if the Irssi devs will mention anything in that
regard when they review the PR I've submitted.
Thanks for reviewing this, by the way!
Regards,
Rodrigo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-21 22:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-21 3:45 [Buildroot] [PATCH] irssi: add patch to fix static linking Rodrigo Rebello
2017-03-21 8:41 ` Arnout Vandecappelle
2017-03-21 22:25 ` Rodrigo Rebello
2017-03-21 21:51 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox