Seite 1 von 1

pcap

Verfasst: Samstag 20. Juni 2009, 15:06
von INFACT
Sehr geehrtes Forum!
Ich möchte gerne pcap installieren, doch leider habe ich immer noch das problem, dass ich mit setup.py nichts installieren kann und installer dafür gibt es nur für python 2.3 und 2.4. Ich habe die installiert und auf mein python2.5 hinübergespielt doch dann kommt immer dieser fehler:

Code: Alles auswählen

>>> import pcap

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pcap
ImportError: Module use of python23.dll conflicts with this version of Python.
Dann wollte ich fragen ob zufällig jemand python 2.5 und pcap installiert hat und er dieses hochladen könne.

währe jemand so nett oder kennt jemand eine andere lösung?
Danke

MfG Robin

Verfasst: Samstag 20. Juni 2009, 15:36
von lunar
Selbst kompilieren.

Verfasst: Samstag 20. Juni 2009, 16:53
von INFACT
Ich kann das ja nicht vernünftig kompilieren, da kommen immer 100 fehler, weil ich visual studio 2003 nicht installliert habe und mit mingw klappt das auch nicht.
Ich sitz gerade nicht an meinem PC aber ich werde die Fehler noch Posten...
Oder kann man das noch anders kmpilieren?

Verfasst: Samstag 20. Juni 2009, 17:46
von INFACT
Mit mingw

Code: Alles auswählen

C:\Users\Robin\Desktop\pylibpcap-0.6.2>python setup.py build -c mingw32
running build
running build_ext
building '_pcapmodule' extension
creating build
creating build\temp.win32-2.5
creating build\temp.win32-2.5\Release
H:\Programme\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DSWIG_COBJECT_TYPES -
IH:\Programme\Python25\include -IH:\Programme\Python25\PC -c pcap.c -o build\tem
p.win32-2.5\Release\pcap.o
pcap.c:2527:18: pcap.h: No such file or directory
In file included from pcap.c:2528:
pypcap.h:20:24: netinet/in.h: No such file or directory
In file included from pcap.c:2528:
pypcap.h:24: error: syntax error before "pcap_t"
pypcap.h:24: warning: no semicolon at end of struct or union
pypcap.h:25: warning: type defaults to `int' in declaration of `pcap_dumper'
pypcap.h:25: warning: data definition has no type or storage class
pypcap.h:26: error: syntax error before '}' token
pypcap.h:26: warning: type defaults to `int' in declaration of `pcapObject'
pypcap.h:26: warning: data definition has no type or storage class
pypcap.h:33: error: syntax error before '*' token
pypcap.h:33: warning: type defaults to `int' in declaration of `new_pcapObject'
pypcap.h:33: warning: data definition has no type or storage class
pypcap.h:34: error: syntax error before '*' token
pypcap.h:35: error: syntax error before '*' token
pypcap.h:37: error: syntax error before '*' token
pypcap.h:38: error: syntax error before '*' token
pypcap.h:39: error: syntax error before '*' token
pypcap.h:40: error: syntax error before '*' token
pypcap.h:41: error: syntax error before '*' token
pypcap.h:42: error: syntax error before '*' token
pypcap.h:44: error: syntax error before '*' token
pypcap.h:45: error: syntax error before '*' token
pypcap.h:46: error: syntax error before '*' token
pypcap.h:47: error: syntax error before '*' token
pypcap.h:48: error: syntax error before '*' token
pypcap.h:49: error: syntax error before '*' token
pypcap.h:50: error: syntax error before '*' token
pypcap.h:51: error: syntax error before '*' token
pypcap.h:52: error: syntax error before '*' token
pypcap.h:53: error: syntax error before '*' token
pypcap.h:54: error: syntax error before '*' token
pypcap.h:55: error: syntax error before '*' token
pypcap.h:66: error: syntax error before "addr"
pypcap.h:72: error: syntax error before '*' token
pcap.c: In function `_wrap_new_pcapObject':
pcap.c:2777: error: `result' undeclared (first use in this function)
pcap.c:2777: error: (Each undeclared identifier is reported only once
pcap.c:2777: error: for each function it appears in.)
pcap.c:2781: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_open_live':
pcap.c:2795: error: `arg1' undeclared (first use in this function)
pcap.c:2795: error: syntax error before ')' token
pcap.c:2822: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_open_dead':
pcap.c:2860: error: `arg1' undeclared (first use in this function)
pcap.c:2860: error: syntax error before ')' token
pcap.c:2878: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_open_offline':
pcap.c:2904: error: `arg1' undeclared (first use in this function)
pcap.c:2904: error: syntax error before ')' token
pcap.c:2919: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_dump_open':
pcap.c:2942: error: `arg1' undeclared (first use in this function)
pcap.c:2942: error: syntax error before ')' token
pcap.c:2957: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_setnonblock':
pcap.c:2980: error: `arg1' undeclared (first use in this function)
pcap.c:2980: error: syntax error before ')' token
pcap.c:2994: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_getnonblock':
pcap.c:3015: error: `arg1' undeclared (first use in this function)
pcap.c:3015: error: syntax error before ')' token
pcap.c:3026: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_setfilter':
pcap.c:3042: error: `arg1' undeclared (first use in this function)
pcap.c:3042: error: syntax error before ')' token
pcap.c:3045: error: `in_addr_t' undeclared (first use in this function)
pcap.c:3045: error: syntax error before "arg4"
pcap.c:3063: error: syntax error before ')' token
pcap.c:3076: error: `arg4' undeclared (first use in this function)
pcap.c: In function `_wrap_pcapObject_loop':
pcap.c:3109: error: `arg1' undeclared (first use in this function)
pcap.c:3109: error: syntax error before ')' token
pcap.c:3125: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_dispatch':
pcap.c:3149: error: `arg1' undeclared (first use in this function)
pcap.c:3149: error: syntax error before ')' token
pcap.c:3166: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_next':
pcap.c:3190: error: `arg1' undeclared (first use in this function)
pcap.c:3190: error: syntax error before ')' token
pcap.c:3201: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_datalink':
pcap.c:3219: error: `arg1' undeclared (first use in this function)
pcap.c:3219: error: syntax error before ')' token
pcap.c:3230: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_datalinks':
pcap.c:3246: error: `arg1' undeclared (first use in this function)
pcap.c:3246: error: syntax error before ')' token
pcap.c:3257: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_snapshot':
pcap.c:3275: error: `arg1' undeclared (first use in this function)
pcap.c:3275: error: syntax error before ')' token
pcap.c:3286: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_is_swapped':
pcap.c:3302: error: `arg1' undeclared (first use in this function)
pcap.c:3302: error: syntax error before ')' token
pcap.c:3313: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_major_version':
pcap.c:3329: error: `arg1' undeclared (first use in this function)
pcap.c:3329: error: syntax error before ')' token
pcap.c:3340: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_minor_version':
pcap.c:3356: error: `arg1' undeclared (first use in this function)
pcap.c:3356: error: syntax error before ')' token
pcap.c:3367: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_stats':
pcap.c:3383: error: `arg1' undeclared (first use in this function)
pcap.c:3383: error: syntax error before ')' token
pcap.c:3394: error: syntax error before ')' token
pcap.c: In function `_wrap_pcapObject_fileno':
pcap.c:3412: error: `arg1' undeclared (first use in this function)
pcap.c:3412: error: syntax error before ')' token
pcap.c:3423: error: syntax error before ')' token
pcap.c: In function `_wrap_delete_pcapObject__SWIG_1':
pcap.c:3439: error: `arg1' undeclared (first use in this function)
pcap.c:3439: error: syntax error before ')' token
pcap.c:3449: error: syntax error before ')' token
pcap.c: In function `_wrap_ntoa':
pcap.c:3612: error: `in_addr_t' undeclared (first use in this function)
pcap.c:3612: error: syntax error before "arg1"
pcap.c:3619: error: `arg1' undeclared (first use in this function)
pcap.c: In function `init_pcap':
pcap.c:4266: warning: implicit declaration of function `pcap_lib_version'
pcap.c:4266: warning: passing arg 3 of `PyModule_AddStringConstant' makes pointe
r from integer without a cast
error: command 'gcc' failed with exit status 1

C:\Users\Robin\Desktop\pylibpcap-0.6.2>
Ohne:

Code: Alles auswählen

C:\Users\Robin\Desktop\pylibpcap-0.6.2>python setup.py build
running build
running build_ext
error: Python was built with Visual Studio 2003;
extensions must be built with a compiler than can generate compatible binaries.
Visual Studio 2003 was not found on this system. If you have Cygwin installed,
you can try compiling with MingW32, by passing "-c mingw32" to setup.py.

Verfasst: Samstag 20. Juni 2009, 17:46
von Leonidas
Visual Studio 2003 installieren?

Und dein Fehler steht übrigens ganz oben: du hast keine Header für die libpcap, die brauchst du natürlich schon.

Verfasst: Samstag 20. Juni 2009, 18:49
von INFACT
Ich habe jetzt die header, klappt trotzdem nicht:

Code: Alles auswählen

C:\Users\Robin\Desktop\pylibpcap-0.6.2>python setup.py build -c mingw32
running build
running build_ext
building '_pcapmodule' extension
H:\Programme\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DSWIG_COBJECT_TYPES -
IH:\Programme\Python25\include -IH:\Programme\Python25\PC -c pcap.c -o build\tem
p.win32-2.5\Release\pcap.o
In file included from H:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../.
./include/pcap/pcap.h:41,
                 from H:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../.
./include/pcap.h:45,
                 from pcap.c:2527:
H:/Programme/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/pcap-stdinc.
h:53:22: bittypes.h: No such file or directory
In file included from pcap.c:2528:
pypcap.h:20:24: netinet/in.h: No such file or directory
In file included from pcap.c:2528:
pypcap.h:43: error: syntax error before "in_addr_t"
pypcap.h:66: error: syntax error before "addr"
pcap.c: In function `_wrap_pcapObject_setfilter':
pcap.c:3045: error: `in_addr_t' undeclared (first use in this function)
pcap.c:3045: error: (Each undeclared identifier is reported only once
pcap.c:3045: error: for each function it appears in.)
pcap.c:3045: error: syntax error before "arg4"
pcap.c:3076: error: `arg4' undeclared (first use in this function)
pcap.c: In function `_wrap_ntoa':
pcap.c:3612: error: `in_addr_t' undeclared (first use in this function)
pcap.c:3612: error: syntax error before "arg1"
pcap.c:3619: error: `arg1' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1
Ich versuchs jetzt mal mit VS2003...

Verfasst: Samstag 20. Juni 2009, 18:53
von Leonidas
Na dann brauchst du noch ``bittypes.h``. Ich nehme nicht an, dass VS2003 diese Header "magisch" dabei hat, denn die gehören eigentlich auch zur libpcap.

Verfasst: Samstag 20. Juni 2009, 19:15
von INFACT
So jetzt habe ich das auch, aber es sind immer noch fehler da.
Ich habe mit meinen kläglichen c kentnissen versucht, diese zu finden jedoch auch ohne erfolg...:

Code: Alles auswählen

C:\Users\Robin\Desktop\pylibpcap-0.6.2>python setup.py build -c mingw32
running build
running build_ext
building '_pcapmodule' extension
H:\Programme\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DSWIG_COBJECT_TYPES -
IH:\Programme\Python25\include -IH:\Programme\Python25\PC -c pcap.c -o build\tem
p.win32-2.5\Release\pcap.o
In file included from pcap.c:2528:
pypcap.h:20:24: netinet/in.h: No such file or directory
In file included from pcap.c:2528:
pypcap.h:43: error: syntax error before "in_addr_t"
pypcap.h:66: error: syntax error before "addr"
pcap.c: In function `_wrap_pcapObject_setfilter':
pcap.c:3045: error: `in_addr_t' undeclared (first use in this function)
pcap.c:3045: error: (Each undeclared identifier is reported only once
pcap.c:3045: error: for each function it appears in.)
pcap.c:3045: error: syntax error before "arg4"
pcap.c:3076: error: `arg4' undeclared (first use in this function)
pcap.c: In function `_wrap_ntoa':
pcap.c:3612: error: `in_addr_t' undeclared (first use in this function)
pcap.c:3612: error: syntax error before "arg1"
pcap.c:3619: error: `arg1' undeclared (first use in this function)
error: command 'gcc' failed with exit status 1

Verfasst: Samstag 20. Juni 2009, 19:19
von Leonidas
``netinet/in.h`` fehlt immer noch.

Langsam solltest du lernen, die Fehlermeldungen selbst zu lesen...