Skip to content

Fix preprocessor error on non-RHEL kernels >= 7.0 - #26

Open
sergiobaiao wants to merge 2 commits into
KyleGospo:mainfrom
sergiobaiao:fix/rhel-preprocessor-kernel7
Open

Fix preprocessor error on non-RHEL kernels >= 7.0#26
sergiobaiao wants to merge 2 commits into
KyleGospo:mainfrom
sergiobaiao:fix/rhel-preprocessor-kernel7

Conversation

@sergiobaiao

Copy link
Copy Markdown

Problem

Building on non-RHEL kernels >= 7.0 (e.g. Ubuntu mainline) fails with:

gasket_interrupt.c:162:88: error: missing binary operator before token '('
    (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 5))

gasket_core.c:1849:76: error: missing binary operator before token '('
    (defined RHEL_RELEASE_CODE && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 4))

RHEL_RELEASE_VERSION is a function-like macro defined only on RHEL kernels. When used in a compound #if expression on non-RHEL kernels, GCC expands all macros before evaluating logical operators — there is no short-circuit at expansion time. The undefined RHEL_RELEASE_VERSION expands to 0, and the trailing (9, x) argument list then produces the "missing binary operator" syntax error, even though defined RHEL_RELEASE_CODE is false.

Fix

Restructure both affected guards into nested #ifdef blocks so RHEL_RELEASE_VERSION() is only reached by the preprocessor on kernels where it is defined:

  • gasket_interrupt.c: eventfd_signal() arity guard (>= 6.8.0 / RHEL 9.5 backport)
  • gasket_core.c: class_create() arity guard (>= 6.4.0 / RHEL 9.4 backport)

The logic is equivalent to the original intent — RHEL backport paths are preserved — but the preprocessor no longer encounters RHEL_RELEASE_VERSION() on kernels where it is undefined.

Test

Verified build and dpkg -i install on Ubuntu kernel 7.0.0-15-generic. Both gasket.ko and apex.ko compile, sign, and install via DKMS successfully.

🤖 Generated with Claude Code

Sergio Baiao and others added 2 commits May 12, 2026 17:42
RHEL_RELEASE_VERSION() is a function-like macro only defined on RHEL
kernels. Using it in a compound #if expression alongside
`defined RHEL_RELEASE_CODE` fails on non-RHEL kernels because GCC
expands all macros before evaluating logical operators — there is no
true short-circuit at expansion time. The result is that the undefined
RHEL_RELEASE_VERSION expands to 0, and the trailing (9, x) argument
list produces: "missing binary operator before token '('".

Restructure both affected guards into nested #ifdef blocks so
RHEL_RELEASE_VERSION() is only reached by the preprocessor on kernels
where it is defined:

- gasket_interrupt.c: eventfd_signal() arity guard (>= 6.8.0 / RHEL 9.5)
- gasket_core.c: class_create() arity guard (>= 6.4.0 / RHEL 9.4)

Fixes build on Ubuntu/mainline kernel 7.0.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@bennydiamond

Copy link
Copy Markdown

Confirmed working on Promox 9 with kernel 7.0.6-2-pve

@sergiobaiao

Copy link
Copy Markdown
Author

please merge this, and also put the commands to build the packages back on the README:

debuild -us -uc -tc -b (for debian/ubuntu at least)

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