package/knock: fix static build with libusb
PATCH 1/1 package/knock: fix static build with libusb
From: "Yann E. MORIN" <[email protected]>
knock depends on libpcap, that has an optional dependency on libusb. Alas, libpcap does not install a .pc file, so knock does not know that it should link with -lusb-1.0.
When linking dynamically, this is not an issue, since the linker does follow the DT_NEEDED tags of libpcap, and thus pulls libusb-1.0 in at the same time. And since linusb uses threads, libpthread is pulled in as well.
However, when linking statically, all of this fails.
Fix that by telling knock's ./configure what libraries to link with when doing a static build and libusb is enabled.
Fixes:
http://autobuild.buildroot.net/results/1eb/1eb877ebd9469c9261bf114fc7733819ae3fd562/
--- package/knock/knock.mk | 4 ++++ 1 file changed, 4 insertions(+)
package/knock/knock.mk +4 -0
@@ -10,4 +10,8 @@ KNOCK_LICENSE = GPLv2+ KNOCK_LICENSE_FILES = COPYING KNOCK_DEPENDENCIES = libpcap +ifeq ($(BR2_PREFER_STATIC_LIB)$(BR2_PACKAGE_LIBUSB),yy) +KNOCK_CONF_OPT = LIBS="-lusb-1.0 -pthread" +endif + $(eval $(autotools-package))
Signature · 1 line
1.8.3.2
PATCH 1/1 package/knock: fix static build with libusb
Dear Yann E. MORIN,
Quoted 30 lines · Yann E. MORIN
From: "Yann E. MORIN" <[email protected]>
knock depends on libpcap, that has an optional dependency on libusb. Alas, libpcap does not install a .pc file, so knock does not know that it should link with -lusb-1.0.
When linking dynamically, this is not an issue, since the linker does follow the
DT_NEEDEDtags of libpcap, and thus pulls libusb-1.0 in at the same time. And since linusb uses threads, libpthread is pulled in as well.However, when linking statically, all of this fails.
Fix that by telling knock's ./configure what libraries to link with when doing a static build and libusb is enabled.
Fixes:
http://autobuild.buildroot.net/results/1eb/1eb877ebd9469c9261bf114fc7733819ae3fd562/Signed-off-by "Yann E. MORIN" <[email protected]>Cc Gustavo Zacarias <[email protected]>--- package/knock/knock.mk | 4 ++++ 1 file changed, 4 insertions(+)package/knock/knock.mk +0
-0
package/knock/knock.mk KNOCK_LICENSE = GPLv2+ · line 15
Quoted 6 lines
package/knock/knock.mk +3
-0@@ -10,4 +10,8 @@ KNOCK_LICENSE = GPLv2+ KNOCK_LICENSE_FILES = COPYING KNOCK_DEPENDENCIES = libpcap +ifeq ($(BR2_PREFER_STATIC_LIB)$(BR2_PACKAGE_LIBUSB),yy) +KNOCK_CONF_OPT = LIBS="-lusb-1.0 -pthread" +endif
Thanks. However, I've already stated that before, but I continue to wonder if this is the right way to fix this. Shouldn't we instead fix libcap by adding a .pc file and submit that upstream, instead of adding more and more LIBS="-lblah" all over the place? Of course, that's not a comment targeted specifically at your patch (we're doing the same thing for many other packages), but I'm wondering if that's the right thing to do.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 package/knock: fix static build with libusb
Thomas, All,
On 2014-06-22 19:08 +0200, Thomas Petazzoni spake thusly:
Quoted 34 lines · Yann E. MORIN
Quoted 33 lines
From: "Yann E. MORIN" <[email protected]>
knock depends on libpcap, that has an optional dependency on libusb. Alas, libpcap does not install a .pc file, so knock does not know that it should link with -lusb-1.0.
When linking dynamically, this is not an issue, since the linker does follow the
DT_NEEDEDtags of libpcap, and thus pulls libusb-1.0 in at the same time. And since linusb uses threads, libpthread is pulled in as well.However, when linking statically, all of this fails.
Fix that by telling knock's ./configure what libraries to link with when doing a static build and libusb is enabled.
Fixes:
http://autobuild.buildroot.net/results/1eb/1eb877ebd9469c9261bf114fc7733819ae3fd562/Signed-off-by "Yann E. MORIN" <[email protected]>Cc Gustavo Zacarias <[email protected]>--- package/knock/knock.mk | 4 ++++ 1 file changed, 4 insertions(+)package/knock/knock.mk +0
-0@@ -10,4 +10,8 @@ KNOCK_LICENSE = GPLv2+ KNOCK_LICENSE_FILES = COPYING KNOCK_DEPENDENCIES = libpcap
Quoted 11 lines
package/knock/knock.mk KNOCK_LICENSE = GPLv2+ · line 15
Quoted 3 lines
package/knock/knock.mk +3
-0+ifeq ($(BR2_PREFER_STATIC_LIB)$(BR2_PACKAGE_LIBUSB),yy) +KNOCK_CONF_OPT = LIBS="-lusb-1.0 -pthread" +endifThanks. However, I've already stated that before, but I continue to wonder if this is the right way to fix this. Shouldn't we instead fix libcap by adding a .pc file and submit that upstream, instead of adding more and more LIBS="-lblah" all over the place? Of course, that's not a comment targeted specifically at your patch (we're doing the same thing for many other packages), but I'm wondering if that's the right thing to do.
Well, in an ideal world, that'd be good. But even if libpcap did provide a .pc file, then we'd need to patch knock to use pkg-config, which it currently does not.
But I anyway withdraw this patch, in favour to the one recently sent by Baruch:
http://patchwork.ozlabs.org/patch/362567/
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. | '------------------------------^-------^------------------^--------------------'
PATCH 1/1 package/knock: fix static build with libusb
In reply to Yann E. MORINHi Yann,
Quoted 5 lines · Yann E. MORIN
From: "Yann E. MORIN" <[email protected]>
knock depends on libpcap, that has an optional dependency on libusb. Alas, libpcap does not install a .pc file, so knock does not know that it should link with -lusb-1.0.
But libpcap does provide pcap-config for this. We already use it to fix static build against libpcap in a number of packages. Just posted a patch doing the same for knock.
baruch
Quoted 33 lines
When linking dynamically, this is not an issue, since the linker does follow the
DT_NEEDEDtags of libpcap, and thus pulls libusb-1.0 in at the same time. And since linusb uses threads, libpthread is pulled in as well.However, when linking statically, all of this fails.
Fix that by telling knock's ./configure what libraries to link with when doing a static build and libusb is enabled.
Fixes:
http://autobuild.buildroot.net/results/1eb/1eb877ebd9469c9261bf114fc7733819ae3fd562/Signed-off-by "Yann E. MORIN" <[email protected]>Cc Gustavo Zacarias <[email protected]>--- package/knock/knock.mk | 4 ++++ 1 file changed, 4 insertions(+)package/knock/knock.mk +4
-0@@ -10,4 +10,8 @@ KNOCK_LICENSE = GPLv2+ KNOCK_LICENSE_FILES = COPYING KNOCK_DEPENDENCIES = libpcap +ifeq ($(BR2_PREFER_STATIC_LIB)$(BR2_PACKAGE_LIBUSB),yy) +KNOCK_CONF_OPT = LIBS="-lusb-1.0 -pthread" +endif + $(eval $(autotools-package))
Signature · 3 lines
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -