Skip to content

Improve GCC/Clang portability and header cleanliness#45

Closed
Whoneon wants to merge 2 commits intoran-j:mainfrom
Whoneon:fix/linux-compatible
Closed

Improve GCC/Clang portability and header cleanliness#45
Whoneon wants to merge 2 commits intoran-j:mainfrom
Whoneon:fix/linux-compatible

Conversation

@Whoneon
Copy link

@Whoneon Whoneon commented Feb 5, 2026

This PR focuses on portability and build reliability across GCC/Clang while avoiding risky and huge changes. It makes several headers self‑contained by adding missing <cstdint> includes for fixed‑width integer types, in order to prevent order‑dependent build failures. The syscall mutex is moved to a single translation unit to avoid per‑TU instances and ensure consistent locking behavior. The runtime target now enables -msse4.1 on GCC/Clang, aligning with the projects documented SSE4 requirements and fixing compile errors.
Finally, a duplicate FetchContent_Declare(libdwarf) entry is removed for clarity.

Wrapping it, here is the changes:

  • Header cleanliness for fixed‑width types (<cstdint>) in core headers.
  • One global g_sys_fd_mutex in ps2_syscalls.cpp to avoid multiple static instances.
  • Explicit -msse4.1 on GCC/Clang for SSE4.1 intrinsics.
  • Cleanup of duplicate CMake FetchContent_Declare for libdwarf.

@ran-j
Copy link
Owner

ran-j commented Feb 5, 2026

Can you introduce a ci build for GCC/clang ?

Added GitHub Actions job with GCC/Clang matrix to build the project on Linux. The job installs build tools and X11 deps required by raylib, then configures with CMake + Ninja and builds in Release. This helps avoiding Linux portability regressions and aligns with the projects GCC/Clang support.

Also, extended .gitignore to cover common CMake/Ninja build directories for simplicity.

Tests: local Release builds with GCC and Clang (Ninja). No runtime tests yet
@Whoneon
Copy link
Author

Whoneon commented Feb 6, 2026

Changes

  • Added an Ubuntu job with a GCC/Clang matrix.
  • Installed requirements by raylib ( build tools and X11 dependencies).
  • Configured with CMake + Ninja and built in Release.
  • Extended .gitignore to exclude CMake/Ninja folders.

How it works

The workflow sets CC/CXX from the matrix, then runs:

  • cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
  • cmake --build build

Tests performed

  • Local build (Release) on Linux with GCC and Clang using Ninja.
  • No runtime tests executed yet.

@ran-j
Copy link
Owner

ran-j commented Feb 6, 2026

@Whoneon the build are failing

@emartinez-dev
Copy link
Contributor

Hey guys, I was trying to compile the project and I had the same error as on the build jobs.

The file ps2xRuntime/include/ps2_call_list.h has an extra backlash and it's breaking the macro continuation. I removed it and it compiled properly

index bc87b2a..7ee5b4e 100644
--- i/ps2xRuntime/include/ps2_call_list.h
+++ w/ps2xRuntime/include/ps2_call_list.h
@@ -603,4 +603,4 @@
     X(syHwInit2)                              \
     X(syMallocInit)                           \
     X(syRtcInit)                              \
-    /* Game/middleware */                     \
\ No newline at end of file
+    /* Game/middleware */

@Whoneon
Copy link
Author

Whoneon commented Feb 6, 2026

Was about to push this fix too. This should be it!

@ran-j ran-j closed this in #49 Feb 6, 2026
@Whoneon
Copy link
Author

Whoneon commented Feb 6, 2026

@emartinez-dev did this fix the CI as well? has this been tested again?

@emartinez-dev
Copy link
Contributor

emartinez-dev commented Feb 6, 2026

@emartinez-dev did this fix the CI as well? has this been tested again?

I didn't test it, but it should be fixed at least when compiling on clang

@Whoneon
Copy link
Author

Whoneon commented Feb 6, 2026

If needed, I can provide a new PR after the weekend. Thanks everyone!

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.

4 participants