BackupGGCode / pypcap

simplified object-oriented Python extension module for libpcap
Other
0 stars 1 forks source link

Cant Install pypcap on ubuntu 7.10 #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What version of the product are you using? On what operating system?
Hi im trying to install pypcap on ubuntu server 7.10.... 

Im trying Python2.5 and Python2.6, I have the next output when I try to
install it:

root@agente1:~/Rishi/pypcap-1.1# python -V
Python 2.6.1
root@agente1:~/Rishi/pypcap-1.1# python setup.py install
running install
running build
running build_ext
building 'pcap' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes -fPIC -I/usr/local/include/python2.6 -c pcap_ex.c -o
build/temp.linux-i686-2.6/pcap_ex.o
pcap_ex.c:22:20: error: config.h: No such file or directory
pcap_ex.c: In function ‘pcap_ex_fileno’:
pcap_ex.c:165: error: dereferencing pointer to incomplete type
pcap_ex.c: In function ‘pcap_ex_next’:
pcap_ex.c:253: error: dereferencing pointer to incomplete type
pcap_ex.c: In function ‘pcap_ex_compile_nopcap’:
pcap_ex.c:285: warning: implicit declaration of function ‘mktemp’
error: command 'gcc' failed with exit status 1

And Using Python2.5

root@agente1:~/Rishi/pypcap-1.1# python2.5 setup.py install
running install
running build
running build_ext
building 'pcap' extension
creating build
creating build/temp.linux-i686-2.5
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes
-fPIC -I/usr/include/python2.5 -c pcap.c -o build/temp.linux-i686-2.5/pcap.o
pcap.c: In function ‘__pyx_f_4pcap_3bpf_filter’:
pcap.c:280: warning: pointer targets in passing argument 2 of ‘bpf_filter’
differ in signedness
pcap.c: In function ‘__pyx_f_4pcap_3bpf___dealloc__’:
pcap.c:320: warning: label ‘__pyx_L1’ defined but not used
pcap.c: In function ‘__pyx_f_4pcap_4pcap_dispatch’:
pcap.c:1039: warning: passing argument 3 of ‘pcap_dispatch’ from
incompatible pointer type
pcap.c: In function ‘__pyx_f_4pcap_4pcap_loop’:
pcap.c:1142: warning: passing argument 3 of ‘pcap_ex_next’ from
incompatible pointer type
pcap.c:1134: warning: label ‘__pyx_L2’ defined but not used
pcap.c: In function ‘__pyx_f_4pcap_4pcap___iter__’:
pcap.c:1305: warning: label ‘__pyx_L1’ defined but not used
pcap.c: In function ‘__pyx_f_4pcap_4pcap___next__’:
pcap.c:1338: warning: passing argument 3 of ‘pcap_ex_next’ from
incompatible pointer type
pcap.c:1382: warning: label ‘__pyx_L3’ defined but not used
pcap.c:1330: warning: label ‘__pyx_L2’ defined but not used
pcap.c: In function ‘__pyx_f_4pcap_4pcap___dealloc__’:
pcap.c:1433: warning: label ‘__pyx_L1’ defined but not used
pcap.c: In function ‘__pyx_tp_new_4pcap_bpf’:
pcap.c:1567: warning: unused variable ‘p’
pcap.c: In function ‘__pyx_tp_dealloc_4pcap_bpf’:
pcap.c:1572: warning: unused variable ‘p’
pcap.c: In function ‘__pyx_tp_traverse_4pcap_bpf’:
pcap.c:1587: warning: unused variable ‘p’
pcap.c:1586: warning: unused variable ‘e’
pcap.c: In function ‘__pyx_tp_clear_4pcap_bpf’:
pcap.c:1592: warning: unused variable ‘p’
pcap.c: In function ‘__pyx_tp_new_4pcap_pcap’:
pcap.c:1719: warning: unused variable ‘p’
pcap.c: In function ‘__pyx_tp_dealloc_4pcap_pcap’:
pcap.c:1724: warning: unused variable ‘p’
pcap.c: In function ‘__pyx_tp_traverse_4pcap_pcap’:
pcap.c:1739: warning: unused variable ‘p’
pcap.c:1738: warning: unused variable ‘e’
pcap.c: In function ‘__pyx_tp_clear_4pcap_pcap’:
pcap.c:1744: warning: unused variable ‘p’
pcap.c: In function ‘__Pyx_GetStarArgs’:
pcap.c:2253: warning: suggest explicit braces to avoid ambiguous ‘else’
pcap.c:2255: warning: suggest explicit braces to avoid ambiguous ‘else’
pcap.c: At top level:
pcap.c:14: warning: ‘__Pyx_UnpackItem’ declared ‘static’ but never 
defined
pcap.c:15: warning: ‘__Pyx_EndUnpack’ declared ‘static’ but never 
defined
pcap.c:16: warning: ‘__Pyx_PrintItem’ declared ‘static’ but never 
defined
pcap.c:17: warning: ‘__Pyx_PrintNewline’ declared ‘static’ but never 
defined
pcap.c:19: warning: ‘__Pyx_ReRaise’ declared ‘static’ but never defined
pcap.c:22: warning: ‘__Pyx_ArgTypeTest’ declared ‘static’ but never 
defined
pcap.c:23: warning: ‘__Pyx_TypeTest’ declared ‘static’ but never defined
pcap.c:27: warning: ‘__Pyx_ImportType’ declared ‘static’ but never 
defined
pcap.c:28: warning: ‘__Pyx_SetVtable’ declared ‘static’ but never 
defined
pcap.c:29: warning: ‘__Pyx_GetVtable’ declared ‘static’ but never 
defined
pcap.c:30: warning: ‘__Pyx_CreateClass’ declared ‘static’ but never 
defined
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O2 -Wall -Wstrict-prototypes
-fPIC -I/usr/include/python2.5 -c pcap_ex.c -o
build/temp.linux-i686-2.5/pcap_ex.o
pcap_ex.c:22:20: error: config.h: No such file or directory
pcap_ex.c: In function ‘pcap_ex_fileno’:
pcap_ex.c:165: error: dereferencing pointer to incomplete type
pcap_ex.c: In function ‘pcap_ex_next’:
pcap_ex.c:253: error: dereferencing pointer to incomplete type
pcap_ex.c: In function ‘pcap_ex_compile_nopcap’:
pcap_ex.c:285: warning: implicit declaration of function ‘mktemp’
error: command 'gcc' failed with exit status 1

Nows What????

Well I foung .deb of pypcap and installed on my system, but it dont works

root@agente1:~/Rishi/pypcap-1.1# dpkg --list | grep libpcap
ii  libpcap0.7                   0.7.2-7                               
System interface for user-level packet captu
ii  libpcap0.8                   0.9.7-1build1                         
System interface for user-level packet captu
ii  libpcap0.8-dev               0.9.7-1build1                         
Development library and header files for lib
ii  python-pypcap                1.1.2+debian-1                        
object-oriented Python interface for libpcap

Does anybody knows what happend?
How Can I resolve thsi problem?

I hope somebody help me please....

thanks so much

regards
Armin Garcia

Original issue reported on code.google.com by saintar...@gmail.com on 9 Mar 2009 at 5:15

GoogleCodeExporter commented 9 years ago
I have got the same error when I build pypcap in sles11, it's caused by missing
'HAVE_PCAP_FILE' definition in config.h. And I think the root caused is that 
header
file directory changed in libpcap 0.9.8.

# rpm -ql libpcap-devel-0.9.8-50.2
/usr/include/pcap
/usr/include/pcap-bpf.h
/usr/include/pcap-namedb.h
/usr/include/pcap.h
/usr/include/pcap/bpf.h
/usr/include/pcap/namedb.h
/usr/include/pcap/pcap.h
/usr/include/pcap/sll.h
/usr/include/pcap/usb.h
/usr/lib64/libpcap.a
/usr/lib64/libpcap.so

In my sles11, pcap.h is in both /usr/include and /usr/include/pcap, but the 
pcap.h in
/usr/include/pcap contains the function definitions.

When we do python setup.py config, the script will find pcap.h and some 
function, 
and then define some macro like 'HAVE_PCAP_FILE' in config.h. As you see, it 
will
find the /usr/include/pcap.h firstly, but no function could be found, and no
definition in config.h.

So you need to patch the setup.py, let it find the true pacp.h and create valid
config.h. then all is ok.

Good luck.

robin

Original comment by robin200...@gmail.com on 18 Mar 2009 at 2:41

GoogleCodeExporter commented 9 years ago
Can you please share what exactly you changed in setup.py?

Original comment by hacke...@gmail.com on 15 Jul 2009 at 4:33

GoogleCodeExporter commented 9 years ago
All I needed to do was exchange the order of the include directories as below:

$ diff -u setup.py setup.py.new 
--- setup.py    2005-10-16 18:07:03.000000000 -0500
+++ setup.py.new    2009-08-22 12:21:53.000000000 -0500
@@ -42,7 +42,7 @@
             dirs = [ '/usr', sys.prefix ] + glob.glob('/opt/libpcap*') + \
                    glob.glob('../libpcap*') + glob.glob('../wpdpack*')
         for d in dirs:
-            for sd in ('include', 'include/pcap', ''):
+            for sd in ('include/pcap', 'include', ''):
                 incdirs = [ os.path.join(d, sd) ]
                 if os.path.exists(os.path.join(d, sd, 'pcap.h')):
                     cfg['include_dirs'] = [ os.path.join(d, sd) ]

Original comment by acsp...@gmail.com on 22 Aug 2009 at 5:25

GoogleCodeExporter commented 9 years ago
thanks acspike. patch applied in r87.

Original comment by dugsong on 15 Dec 2009 at 3:25

GoogleCodeExporter commented 9 years ago
madhrachod sahi bata

Original comment by awanish...@gmail.com on 23 Feb 2010 at 6:59

GoogleCodeExporter commented 9 years ago
Issue 24 has been merged into this issue.

Original comment by getxs...@gmail.com on 13 Jul 2010 at 11:10