Linux compiler h no such file or directory

Compile a linux 2.6 kernel module with newer compiler

I build embedded machines that run an RT_PREMPT version of Linux. It’s an Ubuntu 10.04 installation running an Linux 2.6 kernel. Yes, it’s an old kernel, but I’m stuck with it for awhile. When I compiled the kernel, I used gcc version 4.4. On this system, there is a kernel module I have been compiling successfully for three years. From my Makefile.

all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) \ modules 

My current project requires support for c++14, so I updated gcc and g++ to version 5.1.0 by building from source. All my user-mode software compiles, but when I went to build an updated version of my kernel module, I get the following error right away:

make[1]: Entering directory `/usr/src/linux-headers-2.6.32-54-generic' CC [M] /home/tbj/srcroot/ctsengine-hg/CtsRt/ctsrt_main.o In file included from include/linux/compiler.h:40:0, from include/linux/stddef.h:4, from include/linux/list.h:4, from include/linux/module.h:9, from /home/tbj/srcroot/ctsengine-hg/CtsRt/ctsrt_main.c:31: include/linux/compiler-gcc.h:86:30: fatal error: linux/compiler-gcc5.h: No such file or directory 
fatal error: linux/compiler-gcc5.h: No such file or directory 

If I use gcc 4.4 again (I left it installed on my computer in a different directory), it compiles and runs perfectly. Obviously, I’m missing something. Is it not possible to compile a kernel module with a newer version of the compiler than what the operating system was compiled with? That seems unlikely to me. Is there a configuration step I’m missing? Is there a system variable I need to update? Are there extra headers I’m supposed to download? I ran apt to update build-essential, but it was up to date. I have the source and headers for the kernel on my system. I’m not sure what else I would download. Any insights to this problem are greatly appreciated. Thank you in advance.

Читайте также:  User configuration files in linux

Источник

‘fatal error: linux/compiler-gcc5.h: No such file or directory’ during bitbake

I am attempting to run bitbake on a recipe with a non-yocto custom source. Using a linux-yocto source works fine, but when I attempt to use the linux-yocto-custom skeleton file provided by the yocto project files, I run into problems. My file structure looks a little like this:

meta-test | . . . +--recipes-kernel/ | +--linux/ | +--linux-yocto-custom_3.16.bb +--linux-yocto-custom/ | +--defconfig 
inherit kernel require recipes-kernel/linux/linux-yocto.inc SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git;protocol=git;nocheckout=1;name=machine" SRC_URI += "file://defconfig" LINUX_VERSION ?= "3.16" LINUX_VERSION_EXTENSION_append = "-custom" SRCREV_test="19583ca584d6f574384e17fe7613dfaeadcdc4a6" PV = "$+git$" COMPATIBLE_MACHINE = "test" 
DEBUG: Executing shell function do_compile NOTE: make -j 4 bzImage CC=i586-poky-linux-gcc -fuse-ld=bfd LD=i586-poky-linux-ld.bfd make[1]: Entering directory `/home/me/poky/build/tmp/work/test-poky-linux/linux-yocto-custom/3.16+gitAUTOINC+19583ca584-r0/linux-test-standard-build' GEN ./Makefile scripts/kconfig/conf --silentoldconfig Kconfig SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h CHK include/config/kernel.release SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h UPD include/config/kernel.release SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h GEN ./Makefile WRAP arch/x86/include/generated/asm/clkdev.h WRAP arch/x86/include/generated/asm/early_ioremap.h WRAP arch/x86/include/generated/asm/cputime.h WRAP arch/x86/include/generated/asm/mcs_spinlock.h CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h HOSTCC scripts/kallsyms HOSTCC scripts/pnmtologo CC scripts/mod/empty.o HOSTCC scripts/mod/mk_elfconfig CC scripts/mod/devicetable-offsets.s In file included from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/compiler.h:54:0, from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/uapi/linux/stddef.h:1, from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/stddef.h:4, from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/uapi/linux/posix_types.h:4, from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/uapi/linux/types.h:13, from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/types.h:5, from /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/mod_devicetable.h:11, from /home/me/poky/build/tmp/work-shared/test/kernel-source/scripts/mod/devicetable-offsets.c:2: /home/me/poky/build/tmp/work-shared/test/kernel-source/include/linux/compiler-gcc.h:106:30: fatal error: linux/compiler-gcc5.h: No such file or directory compilation terminated. make[4]: *** [scripts/mod/devicetable-offsets.s] Error 1 make[3]: *** [scripts/mod] Error 2 make[3]: *** Waiting for unfinished jobs. make[2]: *** [scripts] Error 2 make[2]: *** Waiting for unfinished jobs. make[1]: *** [sub-make] Error 2 make: *** [__sub-make] Error 2 WARNING: /home/me/poky/build/tmp/work/test-poky-linux/linux-yocto-custom/3.16+gitAUTOINC+19583ca584-r0/temp/run.do_compile.32722:1 exit 1 from exit 1 ERROR: oe_runmake failed ERROR: Function failed: do_compile (log file is located at /home/me/poky/build/tmp/work/test-poky-linux/linux-yocto-custom/3.16+gitAUTOINC+19583ca584-r0/temp/log.do_compile.32722) 
compiler-gcc.h:106:30: fatal error: linux/compiler-gcc5.h: No such file or directory 

I’m really stumped because a file is generated during the build ‘compiler-gcc5.h’ at location build/tmp/work/test-poky-linux/core-image-test/1.0-r0/rootfs/usr/src/kernel/include/linux/compiler-gcc5.h . What’s going on here? It seems to me that this header file’s being requested before being fetched but I don’t know how to fix that.

Источник

fatal error: linux/compiler-gcc7.h: No such file or directory

I am trying to install the Atheros CSI tool (provided installation instructions here), running Ubuntu 18.04.2 LTS on a Dell Inspiron 5570 laptop with a QCA9377 wireless adapter. I am able to do everything successfully that is listed under the «Prepare» section of «Compile the kernel» in the installation instructions. (There are some things not specified in the instructions that I was able to figure out to do, like installing make and gcc .) However, I am confused about the make menuconfig step and onwards. When I type make menuconfig in the Atheros-CSI-Tool folder, I press «Save» immediately, saving a file named .config , then «Exit» the menu. When I type make -j16 (I have 8 CPU-cores), this is the output:

 CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CC scripts/mod/empty.o CC scripts/mod/devicetable-offsets.s cc1: error: code model kernel does not support PIC mode cc1: error: code model kernel does not support PIC mode scripts/Makefile.build:258: recipe for target 'scripts/mod/empty.o' failed make[2]: *** [scripts/mod/empty.o] Error 1 make[2]: *** Waiting for unfinished jobs. scripts/Makefile.build:153: recipe for target 'scripts/mod/devicetable-offsets.s' failed make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1 scripts/Makefile.build:403: recipe for target 'scripts/mod' failed make[1]: *** [scripts/mod] Error 2 make[1]: *** Waiting for unfinished jobs. Makefile:555: recipe for target 'scripts' failed make: *** [scripts] Error 2 make: *** Waiting for unfinished jobs. make: *** wait: No child processes. Stop. 
 CHK include/config/kernel.release CHK include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h CC arch/x86/purgatory/purgatory.o In file included from include/linux/compiler.h:54:0, from include/uapi/linux/stddef.h:1, from include/linux/stddef.h:4, from ./include/uapi/linux/posix_types.h:4, from include/uapi/linux/types.h:13, from include/linux/types.h:5, from arch/x86/purgatory/sha256.h:14, from arch/x86/purgatory/purgatory.c:13: include/linux/compiler-gcc.h:121:1: fatal error: linux/compiler-gcc7.h: No such file or directory #include gcc_header(__GNUC__) ^~~~ compilation terminated. scripts/Makefile.build:258: recipe for target 'arch/x86/purgatory/purgatory.o' failed make[1]: *** [arch/x86/purgatory/purgatory.o] Error 1 arch/x86/Makefile:185: recipe for target 'archprepare' failed make: *** [archprepare] Error 2 

I tried to fix these errors I encountered by installing an old version of Ubuntu (14.04) from the archives, but Wi-Fi didn’t work on my laptop under that OS (which is important since I am collecting data about Wi-Fi connections with the tool I’m trying to install). I also installed an old Linux kernel (4.1.10) from an online archive, but I encountered the same errors as shown above.

Читайте также:  Linux mint errno 5 input output error

Источник

Thread: fatal error: linux/compiler.h: No such file or directory

djsephiroth is offlineA Carafe of Ubuntu

DKMS build failure — no reason in log or output

I have a Makefile for a package that includes a kernel module. I just want to build the module. When I compile the target «all», which includes «modules», I have no problem. When I try to just compile «modules», I get this error:

$ cat /var/lib/dkms/nslink/4.28.1/build/make.log DKMS make.log for nslink-4.28.1 for kernel 3.2.0-15-generic-pae (i686) Thu Feb 16 08:50:01 CST 2012 Makefile:31: LINUX_VERSION: 3.2 Makefile:32: LINUX_SRC: /usr/src/linux-headers-3.2.0-15-generic-pae cc -c -o nslink.o nslink.c nslink.c:87:28: fatal error: linux/compiler.h: No such file or directory compilation terminated. make: *** [nslink.o] Error 1

Here are the relevant parts of the Makefile:

# Retrieve the running kernel version KVER=$(shell uname -r) RM=rm -f PWD:= $(shell pwd) CURRENTDATE=$(shell date +%Y%m%d%H%M%S) # Find the kernel source/headers. # **** you, I know where it will always be LINUX_SRC=/usr/src/linux-headers-$(KVER) LINUX_VERSION=$(shell uname -r | awk '< split($$0,a,"[.-]"); print a[1]"."a[2]>') OLD_BUILD=no ifeq ($(MAKELEVEL),0) $(warning LINUX_VERSION: $(LINUX_VERSION)) $(warning LINUX_SRC: $(LINUX_SRC)) endif obj-m += nslink.o # build targetsfor 2.6, 3.x kernels all: $(MAKE) -C $(LINUX_SRC) SUBDIRS=$(PWD) modules make CFLAGS=-Wall nslinkd make CFLAGS=-Wall nslinkadmin make CFLAGS=-Wall nslinkrelease nslink.o: nslink.c nslink_int.h nslink.h version.h nslinkd.o: nslinkd.c nslink.h version.h connectsecure.h connectsecure.o: connectsecure.c connectsecure.h nslinkd: nslinkd.o parse.o connectsecure.o gcc -Wall -o nslinkd nslinkd.o parse.o connectsecure.o nslinkadmin: nslinkadmin.c gcc -Wall -o nslinkadmin nslinkadmin.c nslinkrelease: nslinkrelease.c $(CC) -Wall -o nslinkrelease nslinkrelease.c modules: nslink.o mod_nslink.o clean:: rm -f *.o rm -f *.ko rm -f .nslink* rm -f nslinkd rm -f *~ rm -f lput rm -f vtst rm -f .kver rm -f nslinkadmin rm -f nslinkrelease rm -rf nslink rm -rf nslink.mod.c rm -rf .tmp* rm -rf *.symvers rm -rf Module.markers rm -rf modules.order

I Googled/rtfm before posting.
G-74SX: #! Waldorf | Kali | Win7HP | 2630QM | 2TB SSD | 16GB | GTX 560M

Читайте также:  How to remove user in linux

Источник

Оцените статью
Adblock
detector