-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors building libdnet for x64 and python 2.7 #3
Comments
I've been able to compile this beast in very similar environment.
I haven't verified the executable yet. Robert |
For the time being I'm posting the exact steps. I hope I'll send patches later on.
Notes:
|
Despite compiling it successfully 1.13 seems to be broken. I'll look into fixing things, but that will take several weeks/months. Regards, |
Build requirements
Build
|
|
After the above dnet can be compiled successfully, but will have some issues interacting with scapy+pcap. The following scapy patch should address scapy issues:
|
I have successfully built libdnet using the instructions and patches given by @rgom above. The patched Scapy can send and receive packets (e.g. its
|
Ah, that makes sense now. Best regards, |
Ok, forked the repo and created first of pull requests. Robert |
There's a possibility to simplify the patches a bit:
I'll try to update the patches next days. Robert |
Ok, here it comes.
Update revision to indicate local changes:
uint32_t not available on MSVC9
Make pyrex 0.9.9 happy about "type" argument name, without API change. Additionally provide already introduced get_pcap_devname to Python.
Use setuptools instead of distutils to allow creating wheels. Add missing wpcap library.
Implement get_dst(), fix compilation problems (move declarations earlier):
So far, there's a pull request for get_dst(). |
And now corresponding scapy part: (This is big, sorry for that).
Pull request submitted for this one (IPPROTO_IPIP unavailable on some platforms) (https://bitbucket.org/secdev/scapy/pull-request/117/add-missing-socketipproto_ipip)
Bump up scapy revision, use setuptools instead of distutils to allow wheels creation:
|
Thanks for the steps to build libdnet library for Windows 64bit. Currently stuck at below error. C:\Users\Admin\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:../../WPdpack/Lib /LIBPATH:c:\python27\libs /LIBPATH:c:\python27\PCbuild\amd64 /LIBPATH:c:\python27\PC\VS9.0\amd64 advapi32.lib iphlpapi.lib ws2_32.lib packet.lib wpcap.lib /EXPORT:initdnet build\temp.win-amd64-2.7\Release./dnet.obj build\temp.win-amd64-2.7\Release../src/addr-util.obj build\temp.win-amd64-2.7\Release../src/addr.obj build\temp.win-amd64-2.7\Release../src/blob.obj build\temp.win-amd64-2.7\Release../src/ip-util.obj build\temp.win-amd64-2.7\Release../src/ip6.obj build\temp.win-amd64-2.7\Release../src/rand.obj build\temp.win-amd64-2.7\Release../src/err.obj build\temp.win-amd64-2.7\Release../src/strlcat.obj build\temp.win-amd64-2.7\Release../src/strlcpy.obj build\temp.win-amd64-2.7\Release../src/err.obj build\temp.win-amd64-2.7\Release../src/strlcat.obj build\temp.win-amd64-2.7\Release../src/strlcpy.obj build\temp.win-amd64-2.7\Release../src/strsep.obj build\temp.win-amd64-2.7\Release../src/arp-win32.obj build\temp.win-amd64-2.7\Release../src/eth-win32.obj build\temp.win-amd64-2.7\Release../src/fw-pktfilter.obj build\temp.win-amd64-2.7\Release../src/intf-win32.obj build\temp.win-amd64-2.7\Release../src/ip-win32.obj build\temp.win-amd64-2.7\Release../src/route-win32.obj build\temp.win-amd64-2.7\Release../src/tun-none.obj /OUT:build\lib.win-amd64-2.7\dnet.pyd /IMPLIB:build\temp.win-amd64-2.7\Release.\dnet.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release.\dnet.pyd.manifest |
Hello,
First of all, thanks for creating this fork. I've ended here after having to fight with the "WARNING: No match between your pcap and dnet network interfaces found." error without success.
So I've tried to build your fork in my Windows 8.1 x64 machine with Python 2.7. I've had a lot of problems and I'd be really grateful if you could help me.
These are the steps I've followed:
autogen.sh
script inside Cygwin, having MinGW also installed.This gave me a lot of trouble, basically for using libtool from MinGW instead of the one from Cygwin. So I uninstalled the one from MinGW and installed the one from Cygwin. After this, the
autogen.sh
worked and theconfigure
file was created../configure
and failed when checking for Python, it seemed a MinGW32 issue. So I installed a bunch of MinGW packages of 32 bits such as headers and so. Don't know exactly how, but this solved the problem.Nevertheless, the
./configure
failed again. Now the problem was because of winpcap developer library not found. So I executed configure as:./configure --with-wpdpack=<path_to_lib>
cd python
and executed/c/cygdrive/python2.7/python.exe setup.py build
and got this error:First real unsolved problem here. So instead of using OS python.exe I've also tried to use cygwin python. I got this error:
Seems that Python.h is not found, although it's in the
/usr/include/Python2.7
folder. I've added it to PATH withexport PATH="$PATH:/usr/include/python2.7"
but it gave the same error.Then I came back to the
Unable to find vcvarsall.bat
error. Still from cygwin I executed:Ok, this problem about not locating 'cl.exe' is because if you use the OS python.exe and you have not built it, the compiler that was used to build it is used to build the python extension. I've tried to add the location of
cl.exe
folder in path (export PATH="$PATH:/cygwin/c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64"
), but it didn't work.So...Next step was to open
Visual C++ 2008 64-bits Command Prompt
so cl.exe is easily found. I exported the symbols mentioned before and executed:This is the REAL problem. It seems that python already defines the ssize_t type in pyconfig.h. I could remove declarations or make them match. The best approach was to make them match types (modifying
__int64
forlong
) by modifying line 199 of pyconfig.h:This solved the problem of redefinitions, but still remained the
fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
.I've tried to comment this includes in os.h and intf.h, but it ended up giving me this error after a large number of warnings:
I realised that the lack of stdint.h was because of Microsoft VC 2008 didn't supported some C99 features, so I tried with VC 2013. After removing comments from the stdint.h includes (I also could remove the modification of pyconfig.h) I executed the same command from the
Developer Command Prompt for VS 2013
and got the following (complete) output:Seems that the problem is that
size_t
is already defined asint
so the following code incrtdefs.h
fails:It seems that there's again a redefinition. I've found it in libdnet source at
include/config.h
in line 270:After commenting it, the build process has continued with a lot of warnings until this error:
Given that the libdnet doesn't have any
pcap.h
file, I guess that this file must refer to the winpcap development library. So I try to add the correct directory to theINCLUDE
environment variable withset INCLUDE=%INCLUDE%;<path_to_winpcap_dev>\WpdPack_4_1_2\WpdPack\Include
There are two
pcap.h
files. One in theInclude
directory and another in theInclude\pcap
directory. I've tried to add both of them in the INCLUDE environment, but neither worked. I finally got a long list of new errors:So I'm stuck here and I don't know what else to do. This is a nightmare, guys. How could you build this? I'm defeated....
Thank you very much for reading until here.
The text was updated successfully, but these errors were encountered: