I found that LINUX_VERSION_CODE defined in /usr/include/linux/version.h on my Ubuntu 16.04.3 LTS machine is (equivalent to) 4.4.90, whereas it is expected to be 4.10.0.
bash% lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.3 LTS
Release: 16.04
Codename: xenial
bash% bash% uname -r
4.10.0-28-generic
bash% cat /usr/include/linux/version.h
#define LINUX_VERSION_CODE 263258
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
bash% perl
my $version=263258;
my $a=($version >> 16) & 0xff;
my $b=($version >> 8) & 0xff;
my $c=$version & 0xff;
print "$version -> $a.$b.$c\n";
263258 -> 4.4.90Therefore, a preprocessor macro as following doesn't work.
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0).
// do something
#endifDoes it mean that I have some installation problem? Or are we recommended not to use LINUX_VERSION_CODE on Ubuntu?
1 Answer
It looks like you have a version specific kernel headers file installed that doesn't match your running kernel, probably. There used to be a meta-package that would keep the current one installed no matter what.
6