9

I have been trying to compile a very old program actual meant for Kernel

I previously had an issue Missing Modversions.h which is solved now, but there is another issue.

In file included from /lib/modules/3.8.0-29-generic/build/include/linux/types.h:5:0,
             from /lib/modules/3.8.0-29-generic/build/include/linux/list.h:4,
             from /lib/modules/3.8.0-29-generic/build/include/linux/module.h:9,
             from kaodv-mod.c:30:
/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
compilation terminated.
make[1]: *** [kaodv-mod.o] Error 1
make[1]: Leaving directory `/home/vm1/aodv-12-12-13/lnx'
make: *** [kaodv] Error 2 

The file /lib/modules/3.8.0-29-generic/build/include/uapi/linux/types.h is a linux header file, I don`t understand how such an error could occur.

Other Informations

OS: Ubuntu 12.04
Kernel Version: 3.8.0-29
Program I`m trying to compile:[AODV-UU][2]

Please help me fix it.

3 Answers3

4

This file has been moved. In your Kernel it will be at include/uapi/asm-generic/types.h

Solution

  • Update the reference in types.h but I'm not sure if it is possible.

or

  • Compile this program against it's supported Kernel version, if you have that info.
2

Set your ARCH environment variable in terminal to x86: export ARCH=x86

or

add the line export ARCH=x86 to the Makefile

s3lph
  • 14,644
  • 12
  • 60
  • 83
1

Trying to compile a USB WiFi adapter driver whose Makefile I was modifying to include riscv64 for the RISC-V VisionFive 2 with Debian, I ran into what appears to be the same error.

user@starfive:~/Documents/github/rtl88x2bu$ make
make ARCH=riscv64 CROSS_COMPILE= -C /lib/modules/5.15.0-starfive/build M=/home/user/Documents/github/rtl88x2bu  modules
make[1]: Entering directory '/lib/modules/5.15.0-starfive/build'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-12 (Debian 12.2.0-9) 12.2.0
  You are using:           gcc (Debian 12.2.0-10) 12.2.0
  CC [M]  /home/user/Documents/github/rtl88x2bu/core/rtw_cmd.o
In file included from /usr/src/linux-headers-6.0.0-6-common/include/linux/types.h:6,
                 from /home/user/Documents/github/rtl88x2bu/include/basic_types.h:75,
                 from /home/user/Documents/github/rtl88x2bu/include/drv_types.h:26,
                 from /home/user/Documents/github/rtl88x2bu/core/rtw_cmd.c:17:
/usr/src/linux-headers-6.0.0-6-common/include/uapi/linux/types.h:5:10: fatal error: asm/types.h: No such file or directory
    5 | #include <asm/types.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-6.0.0-6-common/scripts/Makefile.build:254: /home/user/Documents/github/rtl88x2bu/core/rtw_cmd.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.0.0-6-common/Makefile:1876: /home/user/Documents/github/rtl88x2bu] Error 2
make[1]: Leaving directory '/lib/modules/5.15.0-starfive/build'
make: *** [Makefile:2410: modules] Error 2
user@starfive:~/Documents/github/rtl88x2bu$

I made a quick change in the types.h file to use asm-generic/types.h and ran into another include directive also using the asm directory rather than asm-generic.

So I reverted the change I had made and took a different tack. I created a symbolic link named asm to the directory asm-generic.

user@starfive:~/Documents/github/rtl88x2bu$ cd /usr/src/linux-headers-6.0.0-6-common/include/uapi
user@starfive:/usr/src/linux-headers-6.0.0-6-common/include/uapi$ ls
Kbuild  asm-generic  drm  linux  misc  mtd  rdma  scsi  sound  video  xen
user@starfive:/usr/src/linux-headers-6.0.0-6-common/include/uapi$ sudo ln -s ./asm-generic ./asm
user@starfive:/usr/src/linux-headers-6.0.0-6-common/include/uapi$

I was then able to redo make however I ran into another usage of asm rather than asm-generic in a different include directory.

user@starfive:~/Documents/github/rtl88x2bu$ make
make ARCH=riscv64 CROSS_COMPILE= -C /lib/modules/5.15.0-starfive/build M=/home/user/Documents/github/rtl88x2bu  modules
make[1]: Entering directory '/lib/modules/5.15.0-starfive/build'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc-12 (Debian 12.2.0-9) 12.2.0
  You are using:           gcc (Debian 12.2.0-10) 12.2.0
  CC [M]  /home/user/Documents/github/rtl88x2bu/core/rtw_cmd.o
In file included from /usr/src/linux-headers-6.0.0-6-common/include/linux/build_bug.h:5,
                 from /usr/src/linux-headers-6.0.0-6-common/include/linux/container_of.h:5,
                 from /usr/src/linux-headers-6.0.0-6-common/include/linux/list.h:5,
                 from /usr/src/linux-headers-6.0.0-6-common/include/linux/module.h:12,
                 from /home/user/Documents/github/rtl88x2bu/include/basic_types.h:76,
                 from /home/user/Documents/github/rtl88x2bu/include/drv_types.h:26,
                 from /home/user/Documents/github/rtl88x2bu/core/rtw_cmd.c:17:
/usr/src/linux-headers-6.0.0-6-common/include/linux/compiler.h:254:10: fatal error: asm/rwonce.h: No such file or directory
  254 | #include <asm/rwonce.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/usr/src/linux-headers-6.0.0-6-common/scripts/Makefile.build:254: /home/user/Documents/github/rtl88x2bu/core/rtw_cmd.o] Error 1
make[1]: *** [/usr/src/linux-headers-6.0.0-6-common/Makefile:1876: /home/user/Documents/github/rtl88x2bu] Error 2
make[1]: Leaving directory '/lib/modules/5.15.0-starfive/build'
make: *** [Makefile:2410: modules] Error 2
user@starfive:~/Documents/github/rtl88x2bu$

So I used the same procedure in the different include tree.

user@starfive:~/Documents/github/rtl88x2bu$ cd /usr/src/linux-headers-6.0.0-6-common/include
user@starfive:/usr/src/linux-headers-6.0.0-6-common/include$ ls
acpi         crypto       keys   linux     memory  pcmcia  rv    sound   uapi  video
asm-generic  drm          kunit  math-emu  misc    ras     scsi  target  ufs   xen
clocksource  dt-bindings  kvm    media     net     rdma    soc   trace   vdso
user@starfive:/usr/src/linux-headers-6.0.0-6-common/include$ sudo ln -s ./asm-generic ./asm

I've just run into an error due to a needed option change in the Makefile I'm modifying to support riscv64. However the source seems to be compiling reasonably well though with warnings. Most warnings have some connection to the size of an int such as cast from pointer to int.

Richard Chambers
  • 165
  • 1
  • 4
  • 18