sarah-walker-pcem / pcem

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

Upgrade slirp due to newer versions of MSYS2 #262

Open JosepMaJAZ opened 5 months ago

JosepMaJAZ commented 5 months ago

This is kind of a bug as it seems that now under MSYS2 it is not possible to build with networking enabled.

The networking code on pcem is mostly based on SLiRP for NAT based networking, and on PCAP for independent IP networking.

The SLiRP code is very old and is not even written in ANSI C. Current version of MSYS2 ( mingw32, mingw64 and clang64 included), cannot build this code. (clang finds problems with the function declarations. gcc has problems specifically with the open, close, lseek methods)

The original slirp code is here: https://slirp.sourceforge.net/ , and mirrored here: https://github.com/kost/slirp There exist a more up-to-date fork from the QEMU devs, here: https://gitlab.freedesktop.org/slirp , https://gitlab.freedesktop.org/slirp/libslirp/-/releases

It seems that we need to move to libslirp in some way (although I am not 100% sure it will work without changes under MSYS2).

roybaer commented 5 months ago

Technically, it is perfectly valid ANSI C code, but function declarations in K&R style, already a deprecated feature in C89-C17, were finally removed in C23. As a stop-gap solution, you could let the compiler know that it is processing old code. A simple -std=c17 should be sufficient.

JosepMaJAZ commented 5 months ago

I took that route for now. Yet, I had to use --std=gnu17 instead of c17, because the code uses some "asm" GNU extensions. ( With SSE instructions, it is better to use intrinsics, but it isn't the case here).