mfontanini/libtins

problems compiling with npcap

MickaMickaMicka opened this issue · 1 comments

I am failing to compile libtins with npcap sdk 1.13 with visual studio 2019 compiler and I dont know whether I am doing it right.
I have pthreads as a library in my local development environment. It looks as if it is needed by pcap but isn't found by CMake.

I set

PCAP_INCLUDE_DIR to C:/localpath/npcap-sdk-1.13/Include
PCAP_LIBRARY to C:/localpath/npcap-sdk-1.13/Lib/x86/wpcap.lib
PCAP_ROOT_DIR to C:/localpath/npcap-sdk-1.13

and I am getting that output:

Found PCAP: C:/localpath/npcap-sdk-1.13/lib/x86/wpcap.lib
Performing Test PCAP_LINKS_SOLO
Performing Test PCAP_LINKS_SOLO - Failed
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
Performing Test PCAP_NEEDS_THREADS
Performing Test PCAP_NEEDS_THREADS - Failed
CMake Error at cmake/Modules/FindPCAP.cmake:70 (message):
Couldn't determine how to link against libpcap
Call Stack (most recent call first):
CMakeLists.txt:61 (FIND_PACKAGE)

Configuring incomplete, errors occurred!
See also "C:/localpath/libtins-4.4_solution/CMakeFiles/CMakeOutput.log".
See also "C:/localpath/libtins-4.4_solution/CMakeFiles/CMakeError.log".

Error message in CMakeError that pthread.h couldnt be opened. That's clear because CMake doesn know where to search for it...

Is there any solution? How can I tell CMake or libtins where to search for pthread?

This StackOverflow post contains a long answer that worked for me on Windows. (I built with VS 2022 though and didn't have any pthreads issues. Still it shows how to add inlcude paths which is likely what you need)
https://stackoverflow.com/questions/60841031/libtins-sniffer-undefined