pcapy-ng
pcapy-ng copied to clipboard
Add info on how to compile on windows
It took me a while to figure this out, hope it helps others
Unfortunately the info in this PR did not work for me. In my case the WPDPACK_BASE envar didn't help the MSVC linker find the pack files.
I analyzed the error message to see where the linker actually attempts to locate the pack header files. Here are 3 relevant paths:
c:\wpdpack\Include%VIRTUAL_ENV%\include(e.g.C:\Users\user\.virtualenvs\projectname-slug\include)<Python install dir>\include(e.g.C:\Python310\include)
So the header files should be placed in any of these directories.
Additionally, this package requires lib files (wpcap.lib+Packet.lib) be placed in one of these directories:
c:\wpdpack\Lib\x64%VIRTUAL_ENV%\libs(e.g.C:\Users\user\.virtualenvs\projectname-slug\libs- not to be confused withlib)<Python install dir>\libs(e.g.C:\Python310\libs- again, not to be confused withlib)
It would seem that unzipping the WPD archive directly to C:\wpdpack is most straightforward, however it does clutter your root folder...
If you look at the setup code you can clearly see that WPDPACK_BASE is used to construct the include and library directories for the build. The fact that it defaulted to c:\wpdpack\ in your case seems to indicate that you haven't actualy defined WPDPACK_BASE variable.
How exactly did you define the WPDPACK_BASE ?
IIRC, this worked for me:
set WPDPACK_BASE=...
pip install pcapy-ng

I haven't seen any recomandation on the WinPcap on a unzip location, and I doubt anyone would naturaly chose c:\wpdpack\ without specific guidance, so rather than confuse the issue with 2 options, I would go with the most flexible one.
Maybe add more info on how to setup the environment variable ?
Ah, that looks very much in order... I can't explain why it didn't work for me, I must have made a typo when setting the variable.
Thanks for clarifying that