Skip to contentSkip to conversation

package/lldpd: disable use of libbsd

PATCH New Yann E. MORIN 3 participants 8 messages Aug 14, 2016 – Aug 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/lldpd: disable use of libbsd

libbsd installs .pc files that contain -isystem /usr/include/bsd, but -isystem is not munged by pkg-config, so we end up using /usr/include/bsd which are not suitable for the target. And breaks big time (see failures, below).

But using libbsd is completely optional. In fact, our lldpd.mk did not even express the dependency on libbsd, so we may well have had builds without libbsd.

The functionality brought in by using libbsd is very minor, so we just make lldpd not use libbsd at all. There is no --disable-libbsd or such, so we just patch it out of configure.ac.

Fixes:

    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
    [...]
---
 .../0002-configure-do-not-check-for-libbsd.patch   | 62 ++++++++++++++++++++++
 package/lldpd/lldpd.mk                             |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +62 -0
new file mode 100644
index 0000000..b89b442
@@ -0,0 +1,62 @@
+From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 14 Aug 2016 12:15:17 +0200
+Subject: [PATCH] configure: do not check for libbsd
+
+libbsd causes build issues because it .pc file is borked: it contains
+-isystem in CFLAGS, which is not munged by pkg-config, so we end up
+using the headers of the build machine, causing all sorts of hard to
+debug trouble at build time.
+
+lldpd uses libbsd to a few helper functions, but has fallback in case
+libbsd is not available. The only feature that is lost when not using
+libbsd is that the neighbour name is no longer displayed in the
+/proc/self/cmdline. As the author of lldpd said on IRC: "people should
+survive! ;-)"
+
+So we just remove the detection of libbsd altogether.
+
+Fixes:
+    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
+    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
+    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
+    [...]
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+---
+ configure.ac | 19 -------------------
+ 1 file changed, 19 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dd723b0..45498ce 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -165,25 +165,6 @@ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+ AC_FUNC_FORK
+ 
+-# Some functions can be in libbsd
+-PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
+-  _save_CFLAGS="$CFLAGS"
+-  _save_LIBS="$LIBS"
+-  CFLAGS="$CFLAGS $libbsd_CFLAGS"
+-  LIBS="$LIBS $libbsd_LIBS"
+-  AC_MSG_CHECKING([if libbsd can be linked correctly])
+-  AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+-    [
+-      AC_MSG_RESULT(yes)
+-      LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
+-      LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
+-    ],[
+-      AC_MSG_RESULT(no)
+-      CFLAGS="$_save_CFLAGS"
+-      LIBS="$_save_LIBS"
+-    ])
+-], [:])
+-
+ # setproctitle may have an _init function
+ AC_REPLACE_FUNCS([setproctitle])
+ AC_CHECK_FUNCS([setproctitle_init])
+-- 
+2.7.4
+
package/lldpd/lldpd.mk +1 -1
index 924f2db..008d4bf 100644
@@ -9,7 +9,7 @@ LLDPD_SITE = http://media.luffy.cx/files/lldpd
 LLDPD_DEPENDENCIES = host-pkgconf libevent
 LLDPD_LICENSE = ISC
 LLDPD_LICENSE_FILES = README.md
-# 0001-build-make-generation-of-atom-glue-compatible-with-o.patch
+# Touching configure.ac and Makefile.am in our patches:
 LLDPD_AUTORECONF = YES
 
 # Detection of c99 support in configure fails without WCHAR. To enable
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/2 package/lldpd: explicit optional dependency

check is an optional depenency of lldpd, so we must depend on it when it is enabled.

---
 package/lldpd/lldpd.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/lldpd/lldpd.mk +4 -0
index 008d4bf..f3f047f 100644
@@ -12,6 +12,10 @@ LLDPD_LICENSE_FILES = README.md
 # Touching configure.ac and Makefile.am in our patches:
 LLDPD_AUTORECONF = YES
 
+ifeq ($(BR2_PACKAGE_CHECK),y)
+LLDPD_DEPENDENCIES += check
+endif
+
 # Detection of c99 support in configure fails without WCHAR. To enable
 # automatic detection of c99 support by configure, we need to enable
 # WCHAR in toolchain. But actually we do not need WCHAR at lldpd
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 package/lldpd: explicit optional dependency

Quoted 5 lines · Yann E. MORIN

check is an optional depenency of lldpd, so we must depend on it when it is enabled.

However, while you're at it, there also seems to be a hidden dependency on
valgrind:

AC_CHECK_HEADERS([valgrind/valgrind.h])

Regards,
Arnout

Quoted 20 lines
---
 package/lldpd/lldpd.mk | 4 ++++
 1 file changed, 4 insertions(+)
package/lldpd/lldpd.mk +4 -0
index 008d4bf..f3f047f 100644
@@ -12,6 +12,10 @@ LLDPD_LICENSE_FILES = README.md
 # Touching configure.ac and Makefile.am in our patches:
 LLDPD_AUTORECONF = YES
 
+ifeq ($(BR2_PACKAGE_CHECK),y)
+LLDPD_DEPENDENCIES += check
+endif
+
 # Detection of c99 support in configure fails without WCHAR. To enable
 # automatic detection of c99 support by configure, we need to enable
 # WCHAR in toolchain. But actually we do not need WCHAR at lldpd
Signature · 6 lines
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
#3 lore raw

PATCH 1/2 package/lldpd: disable use of libbsd

In reply to Yann E. MORIN
Quoted 1 line · Yann E. MORIN

libbsd installs .pc files that contain -isystem /usr/include/bsd, but

Actually, only libbsd-overlay.pc does that.

Quoted 1 line

-isystem is not munged by pkg-config, so we end up using /usr/include/bsd

I'm not sure what pkg-config does, I can only say that it's not munged by pkgconf.

Quoted 8 lines

which are not suitable for the target. And breaks big time (see failures, below).

But using libbsd is completely optional. In fact, our lldpd.mk did not even express the dependency on libbsd, so we may well have had builds without libbsd.

The functionality brought in by using libbsd is very minor, so we just

It would be nice to mention _what_ functionality it brings.

Quoted 11 lines

make lldpd not use libbsd at all. There is no --disable-libbsd or such, so we just patch it out of configure.ac.

Fixes:

    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
    [...]

Note that this fix leaves any other users of libbsd out to dry. However, we
only have netcat-openbsd and libedit at the moment that declare a dependency on libbsd, and these don't use libbsd-overlay, so it seems to be OK.

Quoted 12 lines
---
 .../0002-configure-do-not-check-for-libbsd.patch   | 62 ++++++++++++++++++++++
 package/lldpd/lldpd.mk                             |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +0 -0
new file mode 100644
index 0000000..b89b442

package/lldpd/0002-configure-do-not-check-for-libbsd.patch line 6

Quoted 6 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +6 -0
@@ -0,0 +1,62 @@
+From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 14 Aug 2016 12:15:17 +0200
+Subject: [PATCH] configure: do not check for libbsd
+
+libbsd causes build issues because it .pc file is borked: it contains

libbsd -> libbsd-overlay
it -> its

package/lldpd/0002-configure-do-not-check-for-libbsd.patch line 11

Quoted 5 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +5 -0
+-isystem in CFLAGS, which is not munged by pkg-config, so we end up
+using the headers of the build machine, causing all sorts of hard to
+debug trouble at build time.
+
+lldpd uses libbsd to a few helper functions, but has fallback in case

to -> for
fallback -> fallbacks

Quoted 56 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +51 -0
+libbsd is not available. The only feature that is lost when not using
+libbsd is that the neighbour name is no longer displayed in the
+/proc/self/cmdline. As the author of lldpd said on IRC: "people should
+survive! ;-)"
+
+So we just remove the detection of libbsd altogether.
+
+Fixes:
+    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
+    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
+    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
+    [...]
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+---
+ configure.ac | 19 -------------------
+ 1 file changed, 19 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dd723b0..45498ce 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -165,25 +165,6 @@ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+ AC_FUNC_FORK
+ 
+-# Some functions can be in libbsd
+-PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
+-  _save_CFLAGS="$CFLAGS"
+-  _save_LIBS="$LIBS"
+-  CFLAGS="$CFLAGS $libbsd_CFLAGS"
+-  LIBS="$LIBS $libbsd_LIBS"
+-  AC_MSG_CHECKING([if libbsd can be linked correctly])
+-  AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+-    [
+-      AC_MSG_RESULT(yes)
+-      LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
+-      LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
+-    ],[
+-      AC_MSG_RESULT(no)
+-      CFLAGS="$_save_CFLAGS"
+-      LIBS="$_save_LIBS"
+-    ])
+-], [:])
+-
+ # setproctitle may have an _init function
+ AC_REPLACE_FUNCS([setproctitle])
+ AC_CHECK_FUNCS([setproctitle_init])
+-- 
+2.7.4
+
package/lldpd/lldpd.mk +0 -0
index 924f2db..008d4bf 100644

package/lldpd/lldpd.mk LLDPD_SITE = http://media.luffy.cx/files/lldpd · line 12

Quoted 5 lines
package/lldpd/lldpd.mk +1 -1
@@ -9,7 +9,7 @@ LLDPD_SITE = http://media.luffy.cx/files/lldpd
 LLDPD_DEPENDENCIES = host-pkgconf libevent
 LLDPD_LICENSE = ISC
 LLDPD_LICENSE_FILES = README.md
-# 0001-build-make-generation-of-atom-glue-compatible-with-o.patch
+# Touching configure.ac and Makefile.am in our patches:

I actually find it quite convenient if the comment states which patch(es) touch
the autotools files, but ATM we don't do that very often, so OK.

Only spelling mistakes so

Regards,
Arnout

Quoted 4 lines
package/lldpd/lldpd.mk +0 -0
 LLDPD_AUTORECONF = YES
 
 # Detection of c99 support in configure fails without WCHAR. To enable
Signature · 6 lines
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
#4 lore raw

PATCH 1/2 package/lldpd: disable use of libbsd

Arnout, All,

On 2016-08-14 22:26 +0200, Arnout Vandecappelle spake thusly:

Quoted 3 lines · Yann E. MORIN
Quoted 1 line

libbsd installs .pc files that contain -isystem /usr/include/bsd, but

Actually, only libbsd-overlay.pc does that.

Right.

Quoted 2 lines
Quoted 1 line

-isystem is not munged by pkg-config, so we end up using /usr/include/bsd

I'm not sure what pkg-config does, I can only say that it's not munged by pkgconf.

Well, that's what I said, no?

Quoted 9 lines
Quoted 8 lines

which are not suitable for the target. And breaks big time (see failures, below).

But using libbsd is completely optional. In fact, our lldpd.mk did not even express the dependency on libbsd, so we may well have had builds without libbsd.

The functionality brought in by using libbsd is very minor, so we just

It would be nice to mention _what_ functionality it brings.

It's described in the patch.

Quoted 9 lines
Quoted 9 lines

make lldpd not use libbsd at all. There is no --disable-libbsd or such, so we just patch it out of configure.ac.

Fixes:

    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
    [...]
Quoted 4 lines
Quoted 2 lines

Note that this fix leaves any other users of libbsd out to dry.

And we have no issue with those...

Quoted 3 lines

However, we
only have netcat-openbsd and libedit at the moment that declare a dependency on libbsd, and these don't use libbsd-overlay, so it seems to be OK.

Yes.

However, I have no idea how to fix libbsd-overlay... -isystem is weird, because it changes the ordering of include paths that gcc searches for. We've had issue with it recently, so I don't really know what to do.

Better handle the issues when they arise. If we ever add another package that uses libbsd-overlay, _then_ we can think of a proper fix.

But for now, the release is approaching fast enough that I think it is better to just fix that one issue, espeocially since we don't lose much.

Quoted 6 lines
Quoted 6 lines
---
 .../0002-configure-do-not-check-for-libbsd.patch   | 62 ++++++++++++++++++++++
 package/lldpd/lldpd.mk                             |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
Quoted 13 lines

package/lldpd/0002-configure-do-not-check-for-libbsd.patch line 6

Quoted 12 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +6 -0
new file mode 100644
index 0000000..b89b442
@@ -0,0 +1,62 @@
+From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 14 Aug 2016 12:15:17 +0200
+Subject: [PATCH] configure: do not check for libbsd
+
+libbsd causes build issues because it .pc file is borked: it contains

libbsd -> libbsd-overlay

Yes, I was speaking about the package, not the .pc file. But I can change...

[--SNIP--]

Quoted 5 lines
Quoted 5 lines
package/lldpd/lldpd.mk +0 -0
index 924f2db..008d4bf 100644
@@ -9,7 +9,7 @@ LLDPD_SITE = http://media.luffy.cx/files/lldpd
Quoted 8 lines

package/lldpd/lldpd.mk LLDPD_SITE = http://media.luffy.cx/files/lldpd · line 12

Quoted 5 lines
package/lldpd/lldpd.mk +1 -1
 LLDPD_DEPENDENCIES = host-pkgconf libevent
 LLDPD_LICENSE = ISC
 LLDPD_LICENSE_FILES = README.md
-# 0001-build-make-generation-of-atom-glue-compatible-with-o.patch
+# Touching configure.ac and Makefile.am in our patches:

I actually find it quite convenient if the comment states which patch(es) touch
the autotools files, but ATM we don't do that very often, so OK.

Yes, can do.

Quoted 3 lines

Only spelling mistakes so

Thanks! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH 1/2 package/lldpd: disable use of libbsd

Quoted 5 lines · Yann E. MORIN

Arnout, All,

On 2016-08-14 22:26 +0200, Arnout Vandecappelle spake thusly:

Quoted 2 lines · Yann E. MORIN
Quoted 1 line

libbsd installs .pc files that contain -isystem /usr/include/bsd, but

Quoted 8 lines
Quoted 1 line

Actually, only libbsd-overlay.pc does that.

Right.

Quoted 2 lines
Quoted 1 line

-isystem is not munged by pkg-config, so we end up using /usr/include/bsd

I'm not sure what pkg-config does, I can only say that it's not munged by pkgconf.

Well, that's what I said, no?

What I mean is: we use pkgconf instead of pkg-config. It's possible that the
full pkg-config does the correct thing with -isystem (i.e., prepending it with the cross-sysroot). The only thing we know for sure is that pkgconf doesn't.

Quoted 11 lines
Quoted 9 lines
Quoted 8 lines

which are not suitable for the target. And breaks big time (see failures, below).

But using libbsd is completely optional. In fact, our lldpd.mk did not even express the dependency on libbsd, so we may well have had builds without libbsd.

The functionality brought in by using libbsd is very minor, so we just

It would be nice to mention _what_ functionality it brings.

It's described in the patch.

Sorry I forgot to delete that comment when I came to the patch description.

Quoted 17 lines
Quoted 10 lines
Quoted 10 lines

make lldpd not use libbsd at all. There is no --disable-libbsd or such, so we just patch it out of configure.ac.

Fixes:

    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
    [...]
Quoted 4 lines
Quoted 2 lines

Note that this fix leaves any other users of libbsd out to dry.

And we have no issue with those...

Quoted 8 lines
Quoted 3 lines

However, we
only have netcat-openbsd and libedit at the moment that declare a dependency on libbsd, and these don't use libbsd-overlay, so it seems to be OK.

Yes.

However, I have no idea how to fix libbsd-overlay... -isystem is weird, because it changes the ordering of include paths that gcc searches for.

-isystem is not really weird, it just inserts the directory in a different
place in the search path. Oh yes, it's a little bit weird, because it overrides a preceding -I with the same path. However, what pkgconf needs to do with it is pretty simple: it needs to add the sysroot path to it, just like for -I.

Now, I've taken a look at the source of pkgconf, and it's not that trivial to
implement, since ATM it really only considers single-letter flags.

Quoted 7 lines

We've had issue with it recently, so I don't really know what to do.

Better handle the issues when they arise. If we ever add another package that uses libbsd-overlay, _then_ we can think of a proper fix.

But for now, the release is approaching fast enough that I think it is better to just fix that one issue, espeocially since we don't lose much.

Fair enough.

Regards,
Arnout

Quoted 50 lines
Quoted 7 lines
Quoted 7 lines
---
 .../0002-configure-do-not-check-for-libbsd.patch   | 62 ++++++++++++++++++++++
 package/lldpd/lldpd.mk                             |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
Quoted 13 lines

package/lldpd/0002-configure-do-not-check-for-libbsd.patch line 6

Quoted 12 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +6 -0
new file mode 100644
index 0000000..b89b442
@@ -0,0 +1,62 @@
+From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 14 Aug 2016 12:15:17 +0200
+Subject: [PATCH] configure: do not check for libbsd
+
+libbsd causes build issues because it .pc file is borked: it contains

libbsd -> libbsd-overlay

Yes, I was speaking about the package, not the .pc file. But I can change...

[--SNIP--]

Quoted 5 lines
Quoted 5 lines
package/lldpd/lldpd.mk +0 -0
index 924f2db..008d4bf 100644
@@ -9,7 +9,7 @@ LLDPD_SITE = http://media.luffy.cx/files/lldpd
Quoted 8 lines

package/lldpd/lldpd.mk LLDPD_SITE = http://media.luffy.cx/files/lldpd · line 12

Quoted 5 lines
package/lldpd/lldpd.mk +1 -1
 LLDPD_DEPENDENCIES = host-pkgconf libevent
 LLDPD_LICENSE = ISC
 LLDPD_LICENSE_FILES = README.md
-# 0001-build-make-generation-of-atom-glue-compatible-with-o.patch
+# Touching configure.ac and Makefile.am in our patches:

I actually find it quite convenient if the comment states which patch(es) touch
the autotools files, but ATM we don't do that very often, so OK.

Yes, can do.

Quoted 3 lines

Only spelling mistakes so

Thanks! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
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
#6 lore raw

PATCH 1/2 package/lldpd: disable use of libbsd

In reply to Yann E. MORIN

Hi Yann,

Quoted 85 lines · Yann E. MORIN

libbsd installs .pc files that contain -isystem /usr/include/bsd, but -isystem is not munged by pkg-config, so we end up using /usr/include/bsd which are not suitable for the target. And breaks big time (see failures, below).

But using libbsd is completely optional. In fact, our lldpd.mk did not even express the dependency on libbsd, so we may well have had builds without libbsd.

The functionality brought in by using libbsd is very minor, so we just make lldpd not use libbsd at all. There is no --disable-libbsd or such, so we just patch it out of configure.ac.

Fixes:

    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
    [...]
---
 .../0002-configure-do-not-check-for-libbsd.patch   | 62 ++++++++++++++++++++++
 package/lldpd/lldpd.mk                             |  2 +-
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 package/lldpd/0002-configure-do-not-check-for-libbsd.patch
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +52 -0
new file mode 100644
index 0000000..b89b442
@@ -0,0 +1,62 @@
+From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 14 Aug 2016 12:15:17 +0200
+Subject: [PATCH] configure: do not check for libbsd
+
+libbsd causes build issues because it .pc file is borked: it contains
+-isystem in CFLAGS, which is not munged by pkg-config, so we end up
+using the headers of the build machine, causing all sorts of hard to
+debug trouble at build time.
+
+lldpd uses libbsd to a few helper functions, but has fallback in case
+libbsd is not available. The only feature that is lost when not using
+libbsd is that the neighbour name is no longer displayed in the
+/proc/self/cmdline. As the author of lldpd said on IRC: "people should
+survive! ;-)"
+
+So we just remove the detection of libbsd altogether.
+
+Fixes:
+    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
+    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
+    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
+    [...]
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+---
+ configure.ac | 19 -------------------
+ 1 file changed, 19 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dd723b0..45498ce 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -165,25 +165,6 @@ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+ AC_FUNC_FORK
+ 
+-# Some functions can be in libbsd
+-PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
+-  _save_CFLAGS="$CFLAGS"
+-  _save_LIBS="$LIBS"
+-  CFLAGS="$CFLAGS $libbsd_CFLAGS"
+-  LIBS="$LIBS $libbsd_LIBS"
+-  AC_MSG_CHECKING([if libbsd can be linked correctly])
+-  AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+-    [
+-      AC_MSG_RESULT(yes)
+-      LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
+-      LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
+-    ],[
+-      AC_MSG_RESULT(no)
+-      CFLAGS="$_save_CFLAGS"

package/lldpd/0002-configure-do-not-check-for-libbsd.patch line 62

Quoted 10 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +10 -0
+-      LIBS="$_save_LIBS"
+-    ])
+-], [:])
+-
+ # setproctitle may have an _init function
+ AC_REPLACE_FUNCS([setproctitle])
+ AC_CHECK_FUNCS([setproctitle_init])
+-- 
+2.7.4
+

Did you send this patch upstream to lldpd?

I've seen that Vincent pushed something already for that -isystem issue. No risk to conflict?

https://github.com/vincentbernat/lldpd/commit/11c1b6a2ffb3f66a54a43413cb894844bcb38f14

Adding Vincent in the loop.

Thanks,

Vivien

#7 lore raw

PATCH 1/2 package/lldpd: disable use of libbsd

Viven, All,

On 2016-08-15 11:05 -0400, Vivien Didelot spake thusly:

Quoted 1 line

"Yann E. MORIN" <[email protected]> writes:

[--SNIP--]

Quoted 62 lines
Quoted 62 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +56 -0
new file mode 100644
index 0000000..b89b442
@@ -0,0 +1,62 @@
+From 0801a066cd4a24a858ddfa7c62c7802e0f5533a8 Mon Sep 17 00:00:00 2001
+From: "Yann E. MORIN" <[email protected]>
+Date: Sun, 14 Aug 2016 12:15:17 +0200
+Subject: [PATCH] configure: do not check for libbsd
+
+libbsd causes build issues because it .pc file is borked: it contains
+-isystem in CFLAGS, which is not munged by pkg-config, so we end up
+using the headers of the build machine, causing all sorts of hard to
+debug trouble at build time.
+
+lldpd uses libbsd to a few helper functions, but has fallback in case
+libbsd is not available. The only feature that is lost when not using
+libbsd is that the neighbour name is no longer displayed in the
+/proc/self/cmdline. As the author of lldpd said on IRC: "people should
+survive! ;-)"
+
+So we just remove the detection of libbsd altogether.
+
+Fixes:
+    http://autobuild.buildroot.org/results/6b7/6b70fa379e834ec71cc260ba6af771b531ca3511/
+    http://autobuild.buildroot.org/results/769/769074c4bb67336ae6679f2c1cd2a8220d2bec24/
+    http://autobuild.buildroot.org/results/c8a/c8a6001f437701ecc75f6c9252935645bda8a8c8/
+    [...]
+
+Signed-off-by: "Yann E. MORIN" <[email protected]>
+---
+ configure.ac | 19 -------------------
+ 1 file changed, 19 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dd723b0..45498ce 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -165,25 +165,6 @@ AC_FUNC_MALLOC
+ AC_FUNC_REALLOC
+ AC_FUNC_FORK
+ 
+-# Some functions can be in libbsd
+-PKG_CHECK_MODULES([libbsd], [libbsd-overlay], [
+-  _save_CFLAGS="$CFLAGS"
+-  _save_LIBS="$LIBS"
+-  CFLAGS="$CFLAGS $libbsd_CFLAGS"
+-  LIBS="$LIBS $libbsd_LIBS"
+-  AC_MSG_CHECKING([if libbsd can be linked correctly])
+-  AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+-    [
+-      AC_MSG_RESULT(yes)
+-      LLDP_CFLAGS="$LLDP_CFLAGS $libbsd_CFLAGS"
+-      LLDP_LDFLAGS="$LLDP_LDFLAGS $libbsd_LIBS"
+-    ],[
+-      AC_MSG_RESULT(no)
+-      CFLAGS="$_save_CFLAGS"
+-      LIBS="$_save_LIBS"
+-    ])
+-], [:])
+-
Quoted 8 lines

package/lldpd/0002-configure-do-not-check-for-libbsd.patch line 62

Quoted 6 lines
package/lldpd/0002-configure-do-not-check-for-libbsd.patch new file +6 -0
+ # setproctitle may have an _init function
+ AC_REPLACE_FUNCS([setproctitle])
+ AC_CHECK_FUNCS([setproctitle_init])
+-- 
+2.7.4
+

Did you send this patch upstream to lldpd?

No. I don't think this patch is correct for upstream, see below.

Quoted 2 lines

I've seen that Vincent pushed something already for that -isystem issue.

Yes, we discussed it on IRC with Vincent the other day. I'm still unsure of the implications (I haven't tested it, in fact), but for Buildroot, we need a quick patch for the next release. The bove patch is just that:
a woarkaround for us to have a stable release.

We can work after the release to update lldpd with a newer upstream release or an upstream patch, though.

Quoted 1 line

No risk to conflict?

Oh, probably, yes, since both touch the exact same code! ;-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'