sarah-walker-pcem / pcem

PCem
http://pcem-emulator.co.uk
GNU General Public License v2.0
1.56k stars 217 forks source link

PCAP can't be selected on vNext #213

Open ruben-balea opened 1 year ago

ruben-balea commented 1 year ago

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

JosepMaJAZ commented 10 months ago

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 ./
gordon-fish commented 8 months ago

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.