Help locating linux/version.h

46,192

Solution 1

First you need to install kernel-headers

sudo apt-get install linux-headers-$(uname -r)

If it doesn't work then try this also

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/generated/uapi/linux/version.h /usr/src/linux-headers-$(uname -r)/include/linux/version.h

Edited for types.h:

sudo ln -s /usr/src/linux-headers-$(uname -r)/include/uapi/asm-generic/types.h /lib/modules/$(uname -r)/build/include/uapi/linux/types.h

Solution 2

There is no include/generated/uapi/linux/version.h in source code tree starting from linux kernel 4.14;

Here is a way how to generate it under Ubuntu

  1. Install linux headers

    sudo apt install linux-headers-`uname -r`
    
  2. Go to linux headers directory

    cd /usr/src/linux-headers-`uname -r`
    
  3. Generate version.h

    sudo make include/generated/uapi/linux/version.h
    
  4. Create symbol link to generate file

    sudo ln -s $PWD/include/generated/uapi/linux/version.h include/version.h
    

Solution 3

With apt-file you can find any file Ubuntu provides:

$ apt-file search linux/version.h
gcc-arm-linux-androideabi: /usr/arm-linux-androideabi/include/linux/version.h
linux-headers-3.11.0-11-lowlatency: /usr/src/linux-headers-3.11.0-11-lowlatency/include/generated/uapi/linux/version.h
linux-headers-3.11.0-12-generic: /usr/src/linux-headers-3.11.0-12-generic/include/generated/uapi/linux/version.h
linux-headers-3.4.0-1-goldfish: /usr/src/linux-headers-3.4.0-1-goldfish/include/linux/version.h
linux-libc-dev: /usr/include/linux/version.h
linux-libc-dev-arm64-cross: /usr/aarch64-linux-gnu/include/linux/version.h
linux-libc-dev-armel-cross: /usr/arm-linux-gnueabi/include/linux/version.h
linux-libc-dev-armhf-cross: /usr/arm-linux-gnueabihf/include/linux/version.h
linux-libc-dev-powerpc-cross: /usr/powerpc-linux-gnu/include/linux/version.h
ruby1.8-dev: /usr/lib/ruby/1.8/i686-linux/version.h

From this list, linux-libc-dev looks like the most promising candidate.

Share:
46,192

Related videos on Youtube

Ashiq Irphan
Author by

Ashiq Irphan

Updated on September 18, 2022

Comments

  • Ashiq Irphan
    Ashiq Irphan over 1 year

    I'm trying to fix an old program, Previous issues I had could be found at Missing modversions.h

    When I make the program it gives me the following error,

    kaodv-mod.c:22:27: fatal error: linux/version.h: No such file or directory
    compilation terminated.
    

    So I ran

    find / -name version.h
    

    which returns

    /opt/VBoxGuestAdditions-4.3.2/src/vboxguest-4.3.2/vboxguest/include/VBox/version.h
    /usr/include/linux/dvb/version.h
    /usr/include/linux/version.h
    /usr/src/linux-headers-3.8.0-29-generic/include/config/arch/want/ipc/parse/version.h
    /usr/src/linux-headers-3.8.0-29-generic/include/generated/uapi/linux/version.h
    /usr/src/linux-headers-3.8.0-29/include/uapi/linux/dvb/version.h
    /usr/src/linux-headers-3.8.0-29/include/xen/interface/version.h
    

    This clearly proved that linux/version.h is present

    In order to fix this, should I change

    #include<linux/version.h>
    

    into

    #include</usr/include/linux/version.h>
    

    Or is it possible to make changes to the Makefile

    P.S: Makefile

  • Ashiq Irphan
    Ashiq Irphan over 10 years
    I already have the headers installed, so created the ln But it produces another error /lib/modules/3.8.0-29-generic/build/include/uapi/linux/types‌​.h:4:23: fatal error: asm/types.h: No such file or directory I find it very odd, why would there be an error in /lib/modules/3.8.0-29-generic/build/include/uapi/linux/types‌​.h it being a part of the linux header
  • Madhusudhan
    Madhusudhan over 10 years
    @AshiqIrphan types.h file's directory is changed. It's now in include/uapi/asm-generic/. To fix your error follow the edited section