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:

  1. accept default directories, , pick mirror.
  2. 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:

  1. download , unpack winpcap developer's pack.
  2. copy libpacket.a , libwpcap.a wpdpack\lib\ cygwin\lib\
  3. in cygwin\lib, copy libwpcap.a libpcap.a
  4. in cygwin\usr\include, create pcap directory
  5. 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

  1. download , unpack ndpi again in clean directory, don't tripped issues previous build tried.

  2. open cygwin terminal, , cd ndpi directory.

  3. 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.

  4. 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.

  5. build ndpi library, running make.

    make 

    it build library, try build examples, fail because can't find pcap.h

  6. 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.

  7. leave example directory, , resume make.

    cd .. make 

    this last step link ndpireader ndpi library, , create executable you're looking for.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -