GoogleCloudPlatform / compute-virtual-ethernet-linux

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

Macro "KERNEL_VERSION" is not defined #39

Open ftchawe-aneo opened 1 year ago

ftchawe-aneo commented 1 year ago

Hello, I am trying to compile the gvNIC driver on a compute intance VM based on an CentOS 7 image. I am getting compilation errors when trying to build the modules with the command :

make -C /lib/modules/`uname -r`/build M=$(pwd)/build modules modules_install

My kernel release is 3.10.0-1160.25.1.el7.x86_64

The error indicates that the KERNEL_VERSION macro is not defined.

`/home/user/compute-virtual-ethernet-linux/build/gve_desc.h:12:27: warning: "KERNEL_VERSION" is not defined [-Wundef]

if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)`

`/home/user/compute-virtual-ethernet-linux/build/gve_desc.h:12:41: error: missing binary operator before token "("

if LINUX_VERSION_CODE >= KERNEL_VERSION(5,1,0)`

jeroendeb commented 1 year ago

Thanks for for reporting this.

The definition should be:

define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))

We'll work on making driver compilation on CentOS7 work without manual intervention.

ftchawe-aneo commented 1 year ago

@jeroendeb thanks! Defining the macro worked properly.