Skip to content
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

Windows 10 Compile with Mingw64: cannot find -lwpcap and cannot find -lcrt #814

Closed
kendalllewis opened this issue Jan 29, 2025 · 1 comment

Comments

@kendalllewis
Copy link

I generally have the luxury of using Masscan in linux, but regrettably there are some remote testing setups that force me to find a way to use masscan in Windows. I do have WSL installed, but unfortunately it has to be version 1 because of virtual environment, which limits anything I can do with Masscan, Nmap, etc.

Therefore, I am trying to compile now in Windows 10 so that I can leverage a python scanning script I developed. I am using mingw64 with npcap installed. I have been able to resolve the majority of compile errors so far, but I am stuck at the end of the make where I am presented with the following:

C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lwpcap: No such file or directory
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcrt: No such file or directory

I have tried to modify the LDFLAGS and LIBS lines, to include paths to mingw64/lib and npcap/lib, in the Makefile with no success. I tried to order the paths in different ways also and it makes no difference. Any ideas? Thanks for any suggestions.

@kendalllewis
Copy link
Author

kendalllewis commented Jan 29, 2025

I have no idea if this thing will run and perform, but got around the issues.

  1. For the -lwpcap not found error: this was resolved by downloading the npcap sdk, extracting and copying the lib directory of the SDK to here: C:\Program Files\Npcap. I then had to add that path to the Makefile of Masscan under the Mingw section shown below:

MinGW on Windows
ifneq (, ( f i n d s t r i n g m i n g w , (SYS)))
INCLUDES = -Ivs10/include
CFLAGS = -g -ggdb -I. -Wall -O2 -DWIN32 -nostartfiles -nodefaultlibs
LDFLAGS = -L"C:\Program Files\Npcap\Lib\x64" -lwpcap -lws2_32 -lIPHLPAPI /mingw64/lib/crt1.o
endif_

  1. For the -lcrt not found error: this was resolved by placing the -nostartfiles in the following line of the Makefile:

DEFINES =
CFLAGS = -g -ggdb $(FLAGS2) $(INCLUDES) $(DEFINES) -Wall -O2 -DWIN32 -nostartfiles
.SUFFIXES: .c .cpp

I also had to add the full path to the /mingw64/lib/crt1.o file in the MinGW area of Makefile, which is shown above but I will add here also:

LDFLAGS = -L"C:\Program Files\Npcap\Lib\x64" -lwpcap -lws2_32 -lIPHLPAPI /mingw64/lib/crt1.o

Like I said, who knows yet whether this will end up being another debug step, but it compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant