Skip to content

fix gcc build errors in server and shared code - #115

Open
junknewera wants to merge 2 commits into
Tornamic:mainfrom
junknewera:linux-server-portability
Open

junknewera wants to merge 2 commits into
Tornamic:mainfrom
junknewera:linux-server-portability

Conversation

@junknewera

Copy link
Copy Markdown

Fixes GCC compile errors in server and shared code:

  • Missing includes in logger.h, fix template lookup order in CPacketFactory.h and CNetworkEntitySerializer.h
  • GetTickCount -> std::chrono::steady_clock, strcpy_s -> snprintf

No behavior change on Windows; CI passed: https://github.com/junknewera/CoopAndreas/actions/runs/38397723710
Linux server still does not build yet (plugin-sdk/injector deps in shared, xmake linux target TODO, wchar_t size mismatch).

I can follow up with server stubs, Linux CI, and wire string fixes if you don't already have this in an unpushed branch (you mentioned it on #85)

@Tornamic

Copy link
Copy Markdown
Owner

i will merge this if you get it running on linux

MSVC accepts non-standard code and omitted headers that GCC rejects.
Needed to build the server on Linux.
Allows hosting the server on Linux and adds an Ubuntu CI build.
Replaces Windows-only SDK headers and fixes cross-platform chat packets.
@junknewera
junknewera force-pushed the linux-server-portability branch from 3d64189 to 057f1ae Compare October 20, 2026 22:29
@junknewera

Copy link
Copy Markdown
Author

i will merge this if you get it running on linux

it builds and runs on linux now. tested on x86_64 (arch, gcc 16) and arm64: the server starts and listens on 6767/udp. there's also a linux job in ci that builds it and runs it for 5 seconds (needs your approval to run on the pr).

  • server/src/sdk has small copies of the plugin-sdk types the server uses, the real headers pull in windows.h
  • chat strings go out as 16 bits per char since wchar_t is 4 bytes on linux, on windows the bytes are the same as before
  • MoveSpeedCompressed uses std::fabs now, a plain abs() can pick abs(int) on gcc (found by lautaroschenfeld)

rebased on current main

@Tornamic

Copy link
Copy Markdown
Owner

isnt it possible to use the shared plugin-sdk? did you try excluding PluginBase.h?

@junknewera

Copy link
Copy Markdown
Author

isnt it possible to use the shared plugin-sdk? did you try excluding PluginBase.h?

that's already done where possible: PluginBase.h is replaced by a small stub in server/src/sdk, and data-only plugin-sdk headers are still used directly. But the needed game_sa headers include RenderWare.h -> rw/skeleton.h -> windows.h. even with an empty windows.h they fail (HWND missing, 32-bit layouts so VALIDATE_SIZE fails on 64-bit). plus the real PluginBase.h hits #error Supported only in x86 in injector. so only the serialized enums and plain structs are copied

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

Successfully merging this pull request may close these issues.

2 participants