helpsystems / pcapy

Pcapy is a Python extension module that interfaces with the libpcap packet capture library.
Other
383 stars 105 forks source link

error building pcapy with mingw32 #40

Open nazaninIT opened 7 years ago

nazaninIT commented 7 years ago

Hi. I am using mingw32 and 32 bit python 2.7
-WpdPack is downloaded and used in include and lib dir in setup.py . I changed the Include and Lib directories in setup.py (in pcapy) and they are true. -I also installed python setuptools -MinGW and gcc are correctly installed (I compiled many other C++ files with them, and using python) -I use command python setup.py build_ext -c mingw32 in the folder contains pcapy. first I had this error :

c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\cmath:1157:11: error: '::hypot' has not been declared using ::hypot; ^~~~~

I added #define hypot _hypot before that line and this error faded away.

now I have this error :

c:\mingw\include\stdio.h:349:12: In file included from C:\sulley-master\WpdPack\Include/pcap/pcap.h:54:0, from C:\sulley-master\WpdPack\Include/pcap.h:45, from bpfobj.cc:10: c:\mingw\include\stdio.h:345:12: error: expected initializer before 'mingwsnprintf' extern int mingw_stdio_redirect(snprintf)(char, size_t, const char, ...); c:\mingw\include\stdio.h:349:12: error: expected initializer before 'mingwvsnprintf' extern int mingw_stdio_redirect(vsnprintf)(char, size_t, const char, __VALIST);
error: command 'C:\MinGW\bin\gcc.exe' failed with exit status 1

I don't know what shall I do with this. please help me.

ermaoCode commented 6 years ago

I also have these problems. And I solved this problem by using pip.

py -2 -m pip install pcapy --global-option=build_ext --global-option="-LD:\files\git_repositories\WpdPack\Lib" --global-option="-ID:\files\git_repositories\WpdPack\Include"

I don't know why but it works now.