c++ - How can I compile ndpiReader.c that comes with nDPI library in Windows? -
i want create .exe of ndpireader.c
demo program comes ndpi library
. successful compile on ubuntu using commands specified on github page bellow:
./autogen.sh ./configure make
i have tried cross compile using gcc inside ubuntu wasn't successful. tried use pcapexample.sln
compile in visual studio 2012, keep getting error messages like:
error 29 error c1083: cannot open include file: 'ndpi_api.h': no such file or directory
although ndpi_api.h
, other files error listed in project solution explorer. has been able make win32 executable out of ndpireader.c
file? if yes, please specify steps, requirements, or link.
ndpi
lib hosted here: https://github.com/ntop/ndpi
ndpireader.c
hosted here: https://github.com/ntop/ndpi/tree/dev/example
pcapexample.sln
hosted here: https://github.com/ntop/ndpi/tree/dev/example/win32
i saw other questions had tried compile cygwin , ran number of problems.
here’s step-by-step guide used compile ndpi (including ndpireader.exe example):
install cygwin:
- accept default directories, , pick mirror.
- at select packages step, expand devel category, , select following developer packages install:
- autoconf
- autoconf2.5
- automake
- automake1.15
- binutils
- cmake
- cygwin-devel
- gcc-core
- gcc-tools-epoch2-autoconf
- gcc-tools-epoch2-automake
- libtool
- make
- pkg-config
- w32api-headers
- w32api-runtime
install libpcap under cygwin:
- download , unpack winpcap developer's pack.
- copy libpacket.a , libwpcap.a wpdpack\lib\ cygwin\lib\
- in cygwin\lib, copy libwpcap.a libpcap.a
- in cygwin\usr\include, create pcap directory
- copy headers wpdpack\include cygwin\usr\include\pcap
i'm sure you've installed winpcap part of else you've tried, double-check necessary (packet.dll , wpcap.dll) libraries in cygwin\c\windows\system32.
now you've got necessary tools , libraries compile ndpi on windows!
building ndpi
download , unpack ndpi again in clean directory, don't tripped issues previous build tried.
open cygwin terminal, , cd ndpi directory.
run autogen.sh
./autogen.sh
this should complete without errors.
if stops "somepackage missing: please install , try again," you've missed installing cygwin package needed build source.
if stops "missing libpcap(-dev) library," double-check previous steps did copy libpcap.a in cygwin\lib.
autogen.sh should start running configure stage you. (if doesn't, or part of stage fails, can rerun configure after fixing issue.)
./configure
after checking number of things, configure end creating makefile.
build ndpi library, running make.
make
it build library, try build examples, fail because can't find pcap.h
cd example directory, , manually compile ndpireader.c adding -i/usr/include/pcap command:
cd example/ gcc -dhave_config_h -i. -i.. -i../src/include -i/usr/include/pcap -g -o2 -c -o ndpireader.o ndpireader.c
i included command example. if compiler command different, add -i/usr/include/pcap makefile had invoked.
leave example directory, , resume make.
cd .. make
this last step link ndpireader ndpi library, , create executable you're looking for.
Comments
Post a Comment