Skip to contentSkip to conversation

kismet: Remove libpcap compile tests to fix cross-compiling

PATCH New Vicente Olivert Riera 2 participants 4 messages Dec 12, 2014 – Dec 26, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 kismet: Remove libpcap compile tests to fix cross-compiling

These compile tests are run on the host machine which may have or may not have libpcap installed, so we are relying on the host machine to determine if we have to stop the build process due to a missing pcap library. Given that Kismet already depends on libpcap we can be sure that library will be installed in our target. So, for these two reasons we can remove these compile tests from the configure script.

Fixes:
http://autobuild.buildroot.net/results/965/965a3e345dc0a432043b72581bff7d33561fbe0c/

---
 ...pcap-compile-tests-to-fix-cross-compiling.patch |  104 ++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 package/kismet/0003-Remove-libpcap-compile-tests-to-fix-cross-compiling.patch
package/kismet/0003-Remove-libpcap-compile-tests-to-fix-cross-compiling.patch new file +104 -0
new file mode 100644
index 0000000..d41c64e
@@ -0,0 +1,104 @@
+Remove libpcap compile tests to fix cross-compiling
+
+These compile tests are run on the host machine which may have or may
+not have libpcap installed, so we are relying on the host machine to
+determine if we have to stop the build process due to a missing pcap
+library. Given that Kismet already depends on libpcap we can be sure
+that library will be installed in our target. So, for these two reasons
+we can remove these compile tests from the configure script.
+
+Signed-off-by: Vicente Olivert Riera <[email protected]>
+
+diff -rup a/configure b/configure
+--- a/configure	2014-12-11 16:35:36.979059147 +0000
++++ b/configure	2014-12-11 16:43:54.175647454 +0000
+@@ -6265,29 +6265,7 @@ if eval \${$as_ac_Lib+:} false; then :
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-l${pcaplib}  $LIBS"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char pcap_open_live ();
+-int
+-main ()
+-{
+-return pcap_open_live ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+   eval "$as_ac_Lib=yes"
+-else
+-  eval "$as_ac_Lib=no"
+-fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+@@ -6337,29 +6315,7 @@ if ${ac_cv_lib_pcap_pcap_setnonblock+:} 
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-lpcap  $LIBS"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char pcap_setnonblock ();
+-int
+-main ()
+-{
+-return pcap_setnonblock ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+   ac_cv_lib_pcap_pcap_setnonblock=yes
+-else
+-  ac_cv_lib_pcap_pcap_setnonblock=no
+-fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
+@@ -6385,29 +6341,7 @@ if eval \${$as_ac_Lib+:} false; then :
+ else
+   ac_check_lib_save_LIBS=$LIBS
+ LIBS="-l${pcaplib}  $LIBS"
+-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-/* Override any GCC internal prototype to avoid an error.
+-   Use char because int might match the return type of a GCC
+-   builtin and then its argument prototype would still apply.  */
+-#ifdef __cplusplus
+-extern "C"
+-#endif
+-char pcap_get_selectable_fd ();
+-int
+-main ()
+-{
+-return pcap_get_selectable_fd ();
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_link "$LINENO"; then :
+   eval "$as_ac_Lib=yes"
+-else
+-  eval "$as_ac_Lib=no"
+-fi
+ rm -f core conftest.err conftest.$ac_objext \
+     conftest$ac_exeext conftest.$ac_ext
+ LIBS=$ac_check_lib_save_LIBS
Signature · 1 line
1.7.1
#1 lore raw

PATCH 2/2 kismet: Fix static build

Use pcap-config to list optional libpcap dependencies needed for static link. Otherwise we will see errors like this one:

/br/output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/libpcap.a(pcap-canusb-linux.o):
In function `canusb_close':
pcap-canusb-linux.c:(.text+0xec): undefined reference to `libusb_close'

Also reorder the ncurses libs because the order is very important when doing static builds. Otherwise we will see errors like this one:

/br/output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/libpanel.a(p_delete.o):
In function `del_panel':
p_delete.c:(.text+0x68): undefined reference to `_nc_panelhook'

---
 package/kismet/kismet.mk |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
package/kismet/kismet.mk +8 -0
index f177fea..6aeafe2 100644
@@ -12,6 +12,14 @@ KISMET_CONF_OPTS += --with-netlink-version=3
 KISMET_LICENSE = GPLv2+
 KISMET_LICENSE_FILES = debian/copyright
 
+define KISMET_REORDER_NCURSES_LIBS
+	$(SED) 's/-lncurses -lpanel/-lpanel -lncurses/' $(@D)/Makefile.inc
+endef
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+KISMET_CONF_ENV = LIBS="-lpcap $(shell $(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs)"
+KISMET_POST_CONFIGURE_HOOKS += KISMET_REORDER_NCURSES_LIBS
+endif
+
 ifeq ($(BR2_PACKAGE_PCRE),y)
 	KISMET_DEPENDENCIES += pcre
 endif
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/2 kismet: Fix static build

Vicente, All,

On 2014-12-12 14:48 +0000, Vicente Olivert Riera spake thusly:

Quoted 24 lines

Use pcap-config to list optional libpcap dependencies needed for static link. Otherwise we will see errors like this one:

/br/output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/libpcap.a(pcap-canusb-linux.o):
In function `canusb_close':
pcap-canusb-linux.c:(.text+0xec): undefined reference to `libusb_close'

Also reorder the ncurses libs because the order is very important when doing static builds. Otherwise we will see errors like this one:

/br/output/host/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/lib/libpanel.a(p_delete.o):
In function `del_panel':
p_delete.c:(.text+0x68): undefined reference to `_nc_panelhook'

---
 package/kismet/kismet.mk |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
package/kismet/kismet.mk +0 -0
index f177fea..6aeafe2 100644

package/kismet/kismet.mk KISMET_CONF_OPTS += --with-netlink-version=3 · line 16

Quoted 5 lines
package/kismet/kismet.mk +2 -0
@@ -12,6 +12,14 @@ KISMET_CONF_OPTS += --with-netlink-version=3
 KISMET_LICENSE = GPLv2+
 KISMET_LICENSE_FILES = debian/copyright
 
+define KISMET_REORDER_NCURSES_LIBS
+	$(SED) 's/-lncurses -lpanel/-lpanel -lncurses/' $(@D)/Makefile.inc

I think it is better to patch configure.in instead of this post-patch hook. I have a patch to this effect that I'll submit soon.

package/kismet/kismet.mk KISMET_CONF_OPTS += --with-netlink-version=3 · line 19

Quoted 3 lines
package/kismet/kismet.mk +3 -0
+endef
+ifeq ($(BR2_PREFER_STATIC_LIB),y)
+KISMET_CONF_ENV = LIBS="-lpcap $(shell $(STAGING_DIR)/usr/bin/pcap-config --static --additional-libs)"

I'll incorporate your libpcap in my series when I resubmit.

In the meantime, I have marked this patch as "Changes Requested" in Patchwork.

Regards,
Yann E. MORIN.

Quoted 13 lines
package/kismet/kismet.mk +3 -0
+KISMET_POST_CONFIGURE_HOOKS += KISMET_REORDER_NCURSES_LIBS
+endif
+
 ifeq ($(BR2_PACKAGE_PCRE),y)
 	KISMET_DEPENDENCIES += pcre
 endif
Signature · 6 lines
1.7.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/2 kismet: Remove libpcap compile tests to fix cross-compiling

In reply to Vicente Olivert Riera

Vicente, All,

On 2014-12-12 14:48 +0000, Vicente Olivert Riera spake thusly:

Quoted 26 lines

These compile tests are run on the host machine which may have or may not have libpcap installed, so we are relying on the host machine to determine if we have to stop the build process due to a missing pcap library. Given that Kismet already depends on libpcap we can be sure that library will be installed in our target. So, for these two reasons we can remove these compile tests from the configure script.

Fixes:
http://autobuild.buildroot.net/results/965/965a3e345dc0a432043b72581bff7d33561fbe0c/

---
 ...pcap-compile-tests-to-fix-cross-compiling.patch |  104 ++++++++++++++++++++
 1 files changed, 104 insertions(+), 0 deletions(-)
 create mode 100644 package/kismet/0003-Remove-libpcap-compile-tests-to-fix-cross-compiling.patch
package/kismet/0003-Remove-libpcap-compile-tests-to-fix-cross-compiling.patch new file +4 -0
new file mode 100644
index 0000000..d41c64e
@@ -0,0 +1,104 @@
+Remove libpcap compile tests to fix cross-compiling
+
+These compile tests are run on the host machine which may have or may
+not have libpcap installed, so we are relying on the host machine to

package/kismet/0003-Remove-libpcap-compile-tests-to-fix-cross-compiling.patch line 14

Quoted 10 lines
package/kismet/0003-Remove-libpcap-compile-tests-to-fix-cross-compiling.patch new file +10 -0
+determine if we have to stop the build process due to a missing pcap
+library. Given that Kismet already depends on libpcap we can be sure
+that library will be installed in our target. So, for these two reasons
+we can remove these compile tests from the configure script.
+
+Signed-off-by: Vicente Olivert Riera <[email protected]>
+
+diff -rup a/configure b/configure
+--- a/configure	2014-12-11 16:35:36.979059147 +0000
++++ b/configure	2014-12-11 16:43:54.175647454 +0000

You are patching configure instead of configure.in.

However, I could not observe what you describe in the commit log. In my case, the libpcap is really checked with the cross-compiler:

    configure:6258: checking for pcap_open_live in -lpcap
    configure:6283: /home/ymorin/dev/buildroot/O/host/usr/bin/arm-none-linux-gnueabi-gcc [...]
    configure:6283: $? = 0
    configure:6293: result: yes
    [...]
    configure:6378: checking for pcap_get_selectable_fd in -lpcap
    configure:6403: /home/ymorin/dev/buildroot/O/host/usr/bin/arm-none-linux-gnueabi-gcc [...]
    configure:6403: $? = 0
    configure:6413: result: yes

But that's maybe because I now autoreconf kismet, since my ncurses-related patch already touches configure.in.

So I've marked this patch as "Rejected" in Patchwork, as it seems it is no longer needed.

In case you still have issues with the pcap stuff, feel free to resubmit the patch with extra information.

Thank you! :-)

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.  |
'------------------------------^-------^------------------^--------------------'