sarah-walker-pcem/pcem

PCAP can't be selected on vNext

ruben-balea opened this issue · 2 comments

Describe the bug
After compiling PCem from the latest sources you can't choose PCAP, only SLiRP appears in the host configuration dialog.

To Reproduce
Download latest sources and compile them under MSYS2 MinGW64.
I even tried to force PCAP with cmake -G Ninja -DUSE_NETWORKING=ON -DUSE_PCAP_NETWORKING=ON -DCMAKE_BUILD_TYPE=Release . but the result was the same.

Expected behavior
Both SLiRP and PCAP should appear in the host configuration dialog

Screenshots
vNext:
pcap missing
v17:
expected

Emulator configuration
None needed to open the host configuration dialog.

Host machine
Any running Windows 10/11 x64

I've been puzzled with this problem for some time (Ok, I haven't done much with PCem this last year), but I've finally found the reason.

The problem is that the version of libpcap provided with msys2 does not support windows packet capture and there is a workaround that requires user interaction:

Basically, when compiling PCem on msys2, it builds and links to libpcap and its libpcap.dll. libpcap.dll is one of the dlls that need to be copied to pcem.exe folder in order to run it.

To fix it, Install npcap (winpcap's successor), and then copy wpcap.dll to pcem.exe folder, and rename it to libpcap.dll, Then, all suddenly works.

I added these lines to my build scripts:

64bits:

# Replace libpcap.dll supplied with msys2 with the one supplied by npcap
rm libpcap.dll
cp /c/windows/system32/npcap/wpcap.dll ./libpcap.dll
cp /c/windows/system32/npcap/packet.dll ./

32bits:

# Replace libpcap.dll supplied with msys2 with the one supplied by npcap
rm libpcap.dll
cp /c/windows/SysWOW64/npcap/wpcap.dll ./libpcap.dll
cp /c/windows/SysWOW64/npcap/packet.dll ./

I am also seeing this same problem on Linux, where only SLiRP can be selected (and also "Network device" is an empty list.)

OS: Debian 12.5 Bookworm

Compile line (sources from git):
cmake -G "Ninja" -DCMAKE_INSTALL_PREFIX:PATH=/opt/Apps/VM/PCem -DCMAKE_BUILD_TYPE=Release -DPCEM_DISPLAY_ENGINE=wxWidgets -DFORCE_X11=ON -DPLUGIN_ENGINE=ON -DUSE_NETWORKING=ON -DUSE_PCAP_NETWORKING=ON .

PCAP libs:

libpcap-dev/stable,now 1.10.3-1 amd64 [installed]
libpcap0.8/stable,now 1.10.3-1 amd64 [installed,automatic]
libpcap0.8-dev/stable,now 1.10.3-1 amd64 [installed]
pcaputils/stable,now 0.8-1.1 amd64 [installed]

Has anyone else had this issue? Is there something that I may have missed? Any advice welcome.