GoogleCloudPlatform / compute-virtual-ethernet-linux

Compute Engine Virtual Ethernet Linux driver.
Other
69 stars 31 forks source link

build fails on Oracle Linux 9: "RHEL_VERSION_CODE" is not defined #58

Open danielnorberg opened 1 week ago

danielnorberg commented 1 week ago

On a GCP instance running Oracle Linux 9 with kernel 6.9 (uek-next):

$ sudo make -C /lib/modules/`uname -r`/build M=$(pwd)/build modules modules_install
make: Entering directory '/usr/src/kernels/6.9.0-2.el9ueknext.x86_64'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6)
  You are using:           gcc (GCC) 11.4.1 20231218 (Red Hat 11.4.1-3.0.1)
  CC [M]  /home/dano/gve3/build/gve_main.o
/home/dano/gve3/build/gve_main.c: In function ‘gve_drain_page_cache’:
/home/dano/gve3/build/gve_main.c:1446:51: error: "RHEL_VERSION_CODE" is not defined, evaluates to 0 [-Werror=undef]
 1446 | #if LINUX_VERSION_CODE < KERNEL_VERSION(6,9,0) || RHEL_VERSION_CODE < RHEL_RELEASE_VERSION(10,0)
      |                                                   ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:244: /home/dano/gve3/build/gve_main.o] Error 1
make[1]: *** [/usr/src/kernels/6.9.0-2.el9ueknext.x86_64/Makefile:1943: /home/dano/gve3/build] Error 2
make: *** [Makefile:240: __sub-make] Error 2
make: Leaving directory '/usr/src/kernels/6.9.0-2.el9ueknext.x86_64'

It does seem to build successfully with if I define RHEL_VERSION_CODE:

diff --git a/build/gve_linux_version.h b/build/gve_linux_version.h
index bd337f1..911d4c4 100644
--- a/build/gve_linux_version.h
+++ b/build/gve_linux_version.h
@@ -31,6 +31,10 @@
 #define RHEL_RELEASE_VERSION(a,b) (((a) << 8) + (b))
 #endif /* RHEL_RELEASE_VERSION */

+#ifndef RHEL_VERSION_CODE
+#define RHEL_VERSION_CODE RHEL_RELEASE_VERSION(9,0)
+#endif
+
 #ifndef UTS_UBUNTU_RELEASE_ABI
 #define UTS_UBUNTU_RELEASE_ABI 0
 #define UBUNTU_VERSION_CODE 0

But will the driver behave correctly?