diff mbox series

[1/1] reaver: add missing dependency on non static lib.

Message ID 1524069781-671-1-git-send-email-guillaume.bressaix@gmail.com
State Superseded
Headers show
Series [1/1] reaver: add missing dependency on non static lib. | expand

Commit Message

Guillaume Bres April 18, 2018, 4:43 p.m. UTC
Fixes

	http://autobuild.buildroot.net/results/519b4347f496c043ddecdf15f57efb0b3addee42
	http://autobuild.buildroot.net/results/c3daad76473a704e379634e3b87d51468a353f41

lpcap is not found when BR2_STATIC_LIBS=y

Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
---
 package/reaver/Config.in | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Arnout Vandecappelle April 18, 2018, 9:55 p.m. UTC | #1
On 18-04-18 18:43, Guillaume W. Bres wrote:
> Fixes
> 
> 	http://autobuild.buildroot.net/results/519b4347f496c043ddecdf15f57efb0b3addee42
> 	http://autobuild.buildroot.net/results/c3daad76473a704e379634e3b87d51468a353f41
> 
> lpcap is not found when BR2_STATIC_LIBS=y

 Instead of just blindly disabling static, it's worthwhile to try to fix it
instead. You can use the pattern that is used in e.g. arp-scan:

ifeq ($(BR2_STATIC_LIBS),y)
REAVER_CONF_OPTS += \
 	LDFLAGS="$(TARGET_LDFLAGS) `$(STAGING_DIR)/usr/bin/pcap-config --static
--additional-libs`"
endif

(untested).

 Regards,
 Arnout

> 
> Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
> ---
>  package/reaver/Config.in | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/package/reaver/Config.in b/package/reaver/Config.in
> index 0fd8ab7..3e73d0e 100644
> --- a/package/reaver/Config.in
> +++ b/package/reaver/Config.in
> @@ -1,5 +1,6 @@
>  config BR2_PACKAGE_REAVER
>  	bool "reaver"
> +	depends on !BR2_STATIC_LIBS
>  	select BR2_PACKAGE_LIBPCAP
>  	help
>  	  Reaver is a tool to audit networks against brute WPS pins
> @@ -7,3 +8,6 @@ config BR2_PACKAGE_REAVER
>  
>  	  https://code.google.com/archive/p/reaver-wps/wikis/README.wiki
>  	  https://github.com/t6x/reaver-wps-fork-t6x
> +
> +comment "reaver needs a toolchain w/ dynamic library"
> +	depends on BR2_STATIC_LIBS
>
Guillaume Bres April 19, 2018, 9:35 p.m. UTC | #2
Thank you, yes you are right.

I improved my methods, I reproduced the build error here by copying the
config file. I improved things a little bit with

ifeq ($(BR2_STATIC_LIBS),y) # --static seems to cause the pb
REAVER_CONF_ENV += ac_cv_lib_pcap_pcap_open_live=yes
endif

it's less dramatic but still a dirty work around:
libpcap is properly selected by the package, so has been previously
downloaded & installed by buildroot. -lpcap is properly passed to the
linker from my first submission. Yet pcap_open_live test by configure still
fails. My understanding is the line I just added avoids testing
"pcap_open_live" which causes a failure. Dunno if you're okay with that.

Make now actually proceeds further & produces some new errors, yet still
somehow related to pcap, I could use your input on them:

step that fails now:
$buildroot/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/lib64/../lib64/libpcap.a(pcap-dbus.o):
In function `dbus_write':
pcap-dbus.c:(.text+0x48): undefined reference to `dbus_message_demarshal'
pcap-dbus.c:(.text+0x8c): undefined reference to `dbus_message_demarshal'

I started googling & looking at dbus related packages but haven't made any
progress yet

Guillaume William Bres-Saix
Software engineer - NIST
325 Broadway, Boulder, CO 80305
<guillaume.bressaix@gmail.com>

2018-04-18 23:55 GMT+02:00 Arnout Vandecappelle <arnout@mind.be>:

>
>
> On 18-04-18 18:43, Guillaume W. Bres wrote:
> > Fixes
> >
> >       http://autobuild.buildroot.net/results/
> 519b4347f496c043ddecdf15f57efb0b3addee42
> >       http://autobuild.buildroot.net/results/
> c3daad76473a704e379634e3b87d51468a353f41
> >
> > lpcap is not found when BR2_STATIC_LIBS=y
>
>  Instead of just blindly disabling static, it's worthwhile to try to fix it
> instead. You can use the pattern that is used in e.g. arp-scan:
>
> ifeq ($(BR2_STATIC_LIBS),y)
> REAVER_CONF_OPTS += \
>         LDFLAGS="$(TARGET_LDFLAGS) `$(STAGING_DIR)/usr/bin/pcap-config
> --static
> --additional-libs`"
> endif
>
> (untested).
>
>  Regards,
>  Arnout
>
> >
> > Signed-off-by: Guillaume W. Bres <guillaume.bressaix@gmail.com>
> > ---
> >  package/reaver/Config.in | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/package/reaver/Config.in b/package/reaver/Config.in
> > index 0fd8ab7..3e73d0e 100644
> > --- a/package/reaver/Config.in
> > +++ b/package/reaver/Config.in
> > @@ -1,5 +1,6 @@
> >  config BR2_PACKAGE_REAVER
> >       bool "reaver"
> > +     depends on !BR2_STATIC_LIBS
> >       select BR2_PACKAGE_LIBPCAP
> >       help
> >         Reaver is a tool to audit networks against brute WPS pins
> > @@ -7,3 +8,6 @@ config BR2_PACKAGE_REAVER
> >
> >         https://code.google.com/archive/p/reaver-wps/wikis/README.wiki
> >         https://github.com/t6x/reaver-wps-fork-t6x
> > +
> > +comment "reaver needs a toolchain w/ dynamic library"
> > +     depends on BR2_STATIC_LIBS
> >
>
> --
> 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
>
<div dir="ltr">Thank you, yes you are right.<div><br></div><div>I improved my methods, I reproduced the build error here by copying the config file. I improved things a little bit with</div><div><br></div><div><div>ifeq ($(BR2_STATIC_LIBS),y) # --static seems to cause the pb</div><div>REAVER_CONF_ENV += ac_cv_lib_pcap_pcap_open_live=yes</div><div>endif</div><div><br></div><div>it&#39;s less dramatic but still a dirty work around: </div><div>libpcap is properly selected by the package, so has been previously downloaded &amp; installed by buildroot. -lpcap is properly passed to the linker from my first submission. Yet pcap_open_live test by configure still fails. My understanding is the line I just added avoids testing &quot;pcap_open_live&quot; which causes a failure. Dunno if you&#39;re okay with that.</div><div><br></div><div>Make now actually proceeds further &amp; produces some new errors, yet still somehow related to pcap, I could use your input on them:</div><div><br></div></div><div>step that fails now:</div><div><div>$buildroot/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/lib64/../lib64/libpcap.a(pcap-dbus.o): In function `dbus_write&#39;:</div><div>pcap-dbus.c:(.text+0x48): undefined reference to `dbus_message_demarshal&#39;</div><div>pcap-dbus.c:(.text+0x8c): undefined reference to `dbus_message_demarshal&#39;</div></div><div><br></div><div>I started googling &amp; looking at dbus related packages but haven&#39;t made any progress yet</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><font face="arial,helvetica,sans-serif">Guillaume William Bres-Saix<br></font></div><font face="arial,helvetica,sans-serif">Software engineer</font> - NIST<br>325 Broadway, Boulder, CO 80305</div><font face="arial,helvetica,sans-serif"></font></div><font face="arial,helvetica,sans-serif">&lt;<a href="mailto:guillaume.bressaix@gmail.com" target="_blank">guillaume.bressaix@gmail.com</a>&gt;<br></font></div></div></div></div></div></div></div>
<br><div class="gmail_quote">2018-04-18 23:55 GMT+02:00 Arnout Vandecappelle <span dir="ltr">&lt;<a href="mailto:arnout@mind.be" target="_blank">arnout@mind.be</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
On 18-04-18 18:43, Guillaume W. Bres wrote:<br>
&gt; Fixes<br>
&gt; <br>
&gt;       <a href="http://autobuild.buildroot.net/results/519b4347f496c043ddecdf15f57efb0b3addee42" rel="noreferrer" target="_blank">http://autobuild.buildroot.<wbr>net/results/<wbr>519b4347f496c043ddecdf15f57efb<wbr>0b3addee42</a><br>
&gt;       <a href="http://autobuild.buildroot.net/results/c3daad76473a704e379634e3b87d51468a353f41" rel="noreferrer" target="_blank">http://autobuild.buildroot.<wbr>net/results/<wbr>c3daad76473a704e379634e3b87d51<wbr>468a353f41</a><br>
&gt; <br>
&gt; lpcap is not found when BR2_STATIC_LIBS=y<br>
<br>
</span> Instead of just blindly disabling static, it&#39;s worthwhile to try to fix it<br>
instead. You can use the pattern that is used in e.g. arp-scan:<br>
<br>
ifeq ($(BR2_STATIC_LIBS),y)<br>
REAVER_CONF_OPTS += \<br>
        LDFLAGS=&quot;$(TARGET_LDFLAGS) `$(STAGING_DIR)/usr/bin/pcap-<wbr>config --static<br>
--additional-libs`&quot;<br>
endif<br>
<br>
(untested).<br>
<br>
 Regards,<br>
 Arnout<br>
<span class=""><br>
&gt; <br>
&gt; Signed-off-by: Guillaume W. Bres &lt;<a href="mailto:guillaume.bressaix@gmail.com">guillaume.bressaix@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  package/reaver/Config.in | 4 ++++<br>
&gt;  1 file changed, 4 insertions(+)<br>
&gt; <br>
&gt; diff --git a/package/reaver/Config.in b/package/reaver/Config.in<br>
&gt; index 0fd8ab7..3e73d0e 100644<br>
&gt; --- a/package/reaver/Config.in<br>
&gt; +++ b/package/reaver/Config.in<br>
&gt; @@ -1,5 +1,6 @@<br>
&gt;  config BR2_PACKAGE_REAVER<br>
&gt;       bool &quot;reaver&quot;<br>
&gt; +     depends on !BR2_STATIC_LIBS<br>
&gt;       select BR2_PACKAGE_LIBPCAP<br>
&gt;       help<br>
&gt;         Reaver is a tool to audit networks against brute WPS pins<br>
&gt; @@ -7,3 +8,6 @@ config BR2_PACKAGE_REAVER<br>
&gt;  <br>
&gt;         <a href="https://code.google.com/archive/p/reaver-wps/wikis/README.wiki" rel="noreferrer" target="_blank">https://code.google.com/<wbr>archive/p/reaver-wps/wikis/<wbr>README.wiki</a><br>
&gt;         <a href="https://github.com/t6x/reaver-wps-fork-t6x" rel="noreferrer" target="_blank">https://github.com/t6x/reaver-<wbr>wps-fork-t6x</a><br>
&gt; +<br>
&gt; +comment &quot;reaver needs a toolchain w/ dynamic library&quot;<br>
&gt; +     depends on BR2_STATIC_LIBS<br>
&gt; <br>
<br>
-- <br>
</span>Arnout Vandecappelle                          arnout at mind be<br>
Senior Embedded Software Architect            +32-16-286500<br>
Essensium/Mind                                <a href="http://www.mind.be" rel="noreferrer" target="_blank">http://www.mind.be</a><br>
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven<br>
LinkedIn profile: <a href="http://www.linkedin.com/in/arnoutvandecappelle" rel="noreferrer" target="_blank">http://www.linkedin.com/in/<wbr>arnoutvandecappelle</a><br>
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF<br>
</blockquote></div><br></div>
Arnout Vandecappelle April 19, 2018, 11:18 p.m. UTC | #3
[Please don't top-post, but reply in-line like I do below.]

On 19-04-18 23:35, Guillaume William Bres wrote:
> Thank you, yes you are right.
> 
> I improved my methods, I reproduced the build error here by copying the config
> file. I improved things a little bit with
> 
> ifeq ($(BR2_STATIC_LIBS),y) # --static seems to cause the pb
> REAVER_CONF_ENV += ac_cv_lib_pcap_pcap_open_live=yes
> endif
> 
> it's less dramatic but still a dirty work around: 
> libpcap is properly selected by the package, so has been previously downloaded &
> installed by buildroot. -lpcap is properly passed to the linker from my first
> submission. Yet pcap_open_live test by configure still fails. My understanding
> is the line I just added avoids testing "pcap_open_live" which causes a failure.
> Dunno if you're okay with that.
> 
> Make now actually proceeds further & produces some new errors, yet still somehow
> related to pcap, I could use your input on them:
> 
> step that fails now:
> $buildroot/output/host/mips64el-buildroot-linux-uclibc/sysroot/usr/lib64/../lib64/libpcap.a(pcap-dbus.o):
> In function `dbus_write':
> pcap-dbus.c:(.text+0x48): undefined reference to `dbus_message_demarshal'
> pcap-dbus.c:(.text+0x8c): undefined reference to `dbus_message_demarshal'

 It's the same issue, but now with a different symptom.

 The issue is that libpcap itself is linked against other libraries. In the
dynamic library case, there are NEEDED entries in the .so file that point to
these other libraries. In this case, the linker will implicitly search for those
other libraries as if they had been given with -l on the command line. However,
in a static .a library, these NEEDED entries don't exist. Therefore, the linker
can't know that when you link with -lpcap, that it also needs to do -ldbus etc.
Therefore you get undefined reference errors.

 The solution, as I wrote, is to use pcap-config, which will enumerate all the
libraries that libpcap needs.

 Regards,
 Arnout

> 
> I started googling & looking at dbus related packages but haven't made any
> progress yet
[snip]
diff mbox series

Patch

diff --git a/package/reaver/Config.in b/package/reaver/Config.in
index 0fd8ab7..3e73d0e 100644
--- a/package/reaver/Config.in
+++ b/package/reaver/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_REAVER
 	bool "reaver"
+	depends on !BR2_STATIC_LIBS
 	select BR2_PACKAGE_LIBPCAP
 	help
 	  Reaver is a tool to audit networks against brute WPS pins
@@ -7,3 +8,6 @@  config BR2_PACKAGE_REAVER
 
 	  https://code.google.com/archive/p/reaver-wps/wikis/README.wiki
 	  https://github.com/t6x/reaver-wps-fork-t6x
+
+comment "reaver needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS