Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 403243

Summary: net-analyser/nmap-5.51 fails to build while using packaged libpcap headers
Product: Gentoo Linux Reporter: Bernardo Costa <bernardofpc>
Component: [OLD] UnspecifiedAssignee: Michal Januszewski (RETIRED) <spock>
Status: RESOLVED WORKSFORME    
Severity: normal CC: netmon
Priority: Normal Keywords: EBUILD, PATCH
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Remove bundles libpcap from Include directiv
Updated ebuild

Description Bernardo Costa 2012-02-12 09:16:17 UTC
The build system of nmap is flexible to allow the possibility of building all dependencies from the .tar bundle. Unfortunately, nsock/src/Makefile.in has 

-I ../../libpcap

hardcoded on it.

As gentoo forces the dependency on libpcap, there is no point in this include. This should probably be upstreamed. Meanwhile, I have made a .patch to remove the offending part of the line, and the result builds correctly and a local-network + scanme.nmap.org OS scan / -A -T4 still works (I have no more computers to test).

Reproducible: Always

Steps to Reproduce:
1. emerge nmap

Actual Results:  
i686-pc-linux-gnu-gcc -c -I../../nbase -DHAVE_CONFIG_H -DNSOCK_VERSION=\"0.02\" -D_FORTIFY_SOURCE=2 -I../include -I../../libpcap -O2 -march=native -pipe -fomit-frame-pointer -Wall   nsock_pcap.c -o nsock_pcap.o
In file included from ../../libpcap/pcap/pcap.h:51:0,
                 from ../../libpcap/pcap.h:45,
                 from nsock_pcap.h:7,
                 from nsock_pcap.c:12:
../../libpcap/pcap/bpf.h:88:8: error: redefinition of ‘struct bpf_program’
/usr/include/net/bpf.h:107:8: note: originally defined here
../../libpcap/pcap/bpf.h:1042:8: error: redefinition of ‘struct bpf_insn’
/usr/include/net/bpf.h:109:9: note: originally defined here
../../libpcap/pcap/bpf.h:1056:12: error: conflicting types for ‘bpf_validate’
/usr/include/net/bpf.h:1179:12: note: previous declaration of ‘bpf_validate’ was here
../../libpcap/pcap/bpf.h:1057:14: error: conflicting types for ‘bpf_filter’
/usr/include/net/bpf.h:1180:14: note: previous declaration of ‘bpf_filter’ was here
In file included from ../../libpcap/pcap.h:45:0,
                 from nsock_pcap.h:7,
                 from nsock_pcap.c:12:
../../libpcap/pcap/pcap.h:352:7: error: conflicting types for ‘bpf_filter’
/usr/include/net/bpf.h:1180:14: note: previous declaration of ‘bpf_filter’ was here
../../libpcap/pcap/pcap.h:353:5: error: conflicting types for ‘bpf_validate’
/usr/include/net/bpf.h:1179:12: note: previous declaration of ‘bpf_validate’ was here
make: *** [nsock_pcap.o] Error 1


Expected Results:  
Finish compilation
Comment 1 Bernardo Costa 2012-02-12 09:17:34 UTC
Created attachment 301625 [details, diff]
Remove bundles libpcap from Include directiv
Comment 2 Bernardo Costa 2012-02-12 09:18:00 UTC
Created attachment 301627 [details]
Updated ebuild
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2012-12-01 16:58:34 UTC
Comment on attachment 301627 [details]
Updated ebuild

--- nmap-5.51.ebuild    2012-12-01 17:40:22.176511966 +0100
+++ -   2012-12-01 17:58:19.221942164 +0100
@@ -1,6 +1,6 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nmap/nmap-5.51.ebuild,v 1.11 2012/09/23 09:14:51 pinkbyte Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nmap/nmap-5.51.ebuild,v 1.10 2011/06/12 22:14:04 spock Exp $
 
 EAPI="3"
 PYTHON_DEPEND="2"
@@ -40,13 +40,8 @@
        epatch "${FILESDIR}"/${PN}-5.10_beta1-string.patch
        epatch "${FILESDIR}"/${PN}-5.21-python.patch
        epatch "${FILESDIR}"/${PN}-5.51-su-to-zenmap-fix.patch
+       epatch "${FILESDIR}"/${PN}-5.51-nsock-remove-bundled-libpcap.patch
        sed -i -e 's/-m 755 -s ncat/-m 755 ncat/' ncat/Makefile.in
-
-       # Fix desktop files wrt bug #432714
-       sed -i -e '/^Encoding/d' zenmap/install_scripts/unix/zenmap.desktop
-       sed -i -e '/^Encoding/d' zenmap/install_scripts/unix/zenmap-root.desktop
-       sed -i -e 's/Categories=Application;Network;Security/Categories=Network;System;Security;/' zenmap/install_scripts/unix/zenma
p.desktop                                                                                                                           -       sed -i -e 's/Categories=Application;Network;Security/Categories=Network;System;Security;/' zenmap/install_scripts/unix/zenma
p-root.desktop                                                                                                                       }
 
 src_configure() {
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2012-12-01 17:17:35 UTC
I don't see how this would be triggered unless net-libs/libpcap isn't installed.