Stack-protector enabled but compiler support broken - linux

I am doing research on 4G SDN-LTE (software define network- long term evolution) using Ubuntu. First I ran .sh file which gave me error that the kernel newer than 3.14.x is not supported. I installed kernel 3.10, 3.13.11, 3.14. It fixed the error. Currently I'm running linux kernel 3.13.11, now it gave me the error that stack-protector enabled but compiler is broken.
I am building a 4G evolved packet core (EPC). The code is available on GitHub: https://github.com/networkedsystemsIITB/SDN_LTE_EPC/find/master. They used Ubuntu 14.04 for this project. Nothing else they have mentioned.
version 4:7.3.0 ubuntu 2.1
/usr/src/linux-headers-3.13.11-031311ckt39-generic/arch/x86/Makefile:96:
stack-protector enabled but compiler support broken Makefile:604: Cannot use CONFIG_CC_STACKPROTECTOR: -fstack-protector not supported by compiler
Makefile:604: *** missing separator. Stop.
make[4]: Leaving directory '/usr/src/linux-headers-3.13.11-031311ckt39-generic'
Makefile.main:70: recipe for target 'default' failed
make[3]: *** [default] Error 2
make[3]: Leaving directory '/home/shahrukh/shfiles/openvswitch-2.3.2/datapath/linux'

Related

CONFIG_X86_X32 enabled but no binutils support Error

I'm trying to implement a custom system call in Ubuntu 20.04.
One of the steps is this command
root#well:/usr/src/linux-5.16.15# sudo make modules_install install
But it gives this error:
arch/x86/Makefile:142: CONFIG_X86_X32 enabled but no binutils support
ln: target '/source' is not a directory
make[1]: *** [Makefile:1477: __modinst_pre] Error 1
make: *** [Makefile:350: __build_one_by_one] Error 2
What should I do to resolve it?
I've been at this for days and any help would be seriously appreciated!
From the definition of CONFIG_X86_X32 option:
you will need a recent binutils (2.22 or later) with elf32_x86_x64 support enabled to compile a kernel with this option set.
This definition can be found at arch/x86/Kconfig file in kernel source code (https://elixir.bootlin.com/linux/v5.16.15/source/arch/x86/Kconfig#L2836).
So in order to solve this problem, you can either disable this option or select a distro which supports high version binutils to compile the kernel.

Problems building driver on Linux kernel 5.8.x

I'm working with a Linux driver that is building on v5.7.x kernels but not on the latest v5.8.x releases.
To summarise, most of the driver is pre-built and the kernel interface is built on the target. This involves a make -f Kbuild command.
Having checked all of the relevant kernel interface files for any changes that would affect us, normally the driver would just build as usual on a new kernel. However, this time we get the following error:
make[2]: *** [scripts/Makefile.modpost:111: /path/to/source/Module.symvers] Error 1
make[1]: *** [Makefile:1669: modules] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.8.0-1.el8.elrepo.x86_64'
make: *** [Kbuild:26: default] Error 2
This is from CentOS 8.1, but the same error has been seen on Ubuntu 20.04.
I am no expert on this so interpreting these errors is a bit difficult. I have tried building with the KBUILD_VERBOSE flag and it doesn't really provide any useful information, other than the build succeeding until this point.
On previous kernels the Module.symvers file would be created but empty. On 5.8 this file is not created at all presumably due to this error. As a result, the .ko file is not created.
Finally, if we drop in the source files rather than the pre-built .o files the build does succeed. These .o files are built with a very old version of GCC (4.4.7) but we have also tried building with a much newer version (8.3.1), the same version as the target machine.
I would appreciate suggestions for things to check. Let me know if any other details would help.
Edit:
I ran make on Makefile.modpost manually and got the following output:
sudo make -f ./scripts/Makefile.modpost
WARNING: Symbol version dump "vmlinux.symvers" is missing.
Modules may not have dependencies or modversions.
make -f /scripts/Makefile.modfinal
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-050800-generic'
make[1]: /scripts/Makefile.modfinal: No such file or directory
make[1]: *** No rule to make target '/scripts/Makefile.modfinal'. Stop.
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-050800-generic'
make: *** [scripts/Makefile.modpost:117: __modpost] Error 2
I am answering my own question in case it helps anyone else with this problem. Although it has never been an issue in the past, we've always had a warning that the corresponding .o.cmd file was not present for our .o_shipped files. This appears to be important in kernel 5.8 onwards and my fix was to add a touch command to the Kbuild file (i.e. "touch .driver.o.cmd"). This does not remove the warning but it allows the driver to build as normal.

How to avoid 'invalid command' error when building Linux kernel on Fedora 28?

I'm building a Linux kernel on Fedora 28, but always run into the same error such as:
CC init/main.o
init/main.o: warning: objtool: elf_begin: invalid command
make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1
make[1]: *** Deleting file 'init/main.o'
make: *** [Makefile:1067: init] Error 2
make: *** Waiting for unfinished jobs....
I tried "linux-5.0.16.tar.gz" and "linux-5.0.21.tar.gz" downloaded from kernel.org
, and also tried to follow the instruction on Fedora wiki
But there is no way to avoid this 'invalid command' error. "elfutils-libelf-devel" and "elfutils-libelf" are installed. In the fedora way, 'fedpkg cone -a kernel' was successful, so all dependences are installed. Does anyone know what is missing?
Further progress:
The same procedure works on a different machine installed with Fedora 30.
However, after upgrading the original machine to Fedora 30, the error persists.
The machine with the 'invalid command' problem had an old version of libelf.so installed under /user/local. After removing the old libelf, objtool is linked to the current libelf library, and is able to run during compilation of the linux kernel.
A comment is found in the linux source code /tools/perf/util/symbols.h:
/*
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage:
*/
This comment led me to look for an out-dated version of libelf.

Arch Linux: make - no such file or directory

I have a problem by compiling a driver (WLAN-dongle Edimax ac600).
I´m using an Archlinux on my raspberry-pi and want to install my dongle for 5Ghz. During comiling the driver I get this message. I tried to install the linux-headers without success. (in other threads it will be a solution)
Here is my output of make:
[root#raspberry_pi_1 rtl8812AU]# make make ARCH=arm CROSS_COMPILE= -C
/lib/modules/4.9.43-1-ARCH/build M=/root/rtl8812AU modules make[1]:
*** /lib/modules/4.9.43-1-ARCH/build: No such file or directory. Stop. make: *** [Makefile:1576: modules] Error 2
I found out that my pi has a two-arch...-directories:
4.9.43-1-ARCH/
4.9.51-1-ARCH/
Only the second one has the build directory...
How can I fix the problem?!
thanks a lot,
a Linux noob...
[Reputation is too low to post comment]
Use uname -r to make sure which version of the kernel you use.
If it's 4.9.43 : you have newer version of the kernel and this confuse your installer. You should reboot on the 51 one
If it's 4.9.51 : You messed up your installation step and are trying to compile for an old target. You should review the compilation process and change every mention of the 4.9.43 to 4.9.51 since it's the version you use.
If you upgrade your kernel, you may have to rebuild the thing again (You may like to have script in the future ;) ) with the new kernel version.

Linux Kernel Module development compile for other kernel

I'm using LinK+ in other to develop a linux kernel module. My development machine has a Linux Mint 18 installed operating system with kernel version 4.4.xx. For testing I want to deploy the kernel module to a Debian machine(in a virtualbox) which has a kernel version 3.16.xx.
LinK+ has an option called "Compile for other kernel" (see image below)
When I press that button a dialog ask me to point to Kernel Source Location. I've downloaded kernel version 3.16.xx from https://www.kernel.org/ and then pointed to extracted files from that archive.
The output of the make command is this:
**** Build of configuration Debug for project VMDD ****
make --makefile=Makefile --directory=KERN_SRC modules
make: Entering directory '/home/george/linkProjects/VMDD/KERN_SRC'
make -C /home/george/kernels/linux-3.16.43/ M=/home/george/linkProjects/VMDD/KERN_SRC modules
make[1]: Entering directory '/home/george/kernels/linux-3.16.43'
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /home/george/linkProjects/VMDD/KERN_SRC/VMDD.o
/bin/sh: 1: ./scripts/recordmcount: not found
scripts/Makefile.build:263: recipe for target '/home/george/linkProjects/VMDD/KERN_SRC/VMDD.o' failed
make[2]: *** [/home/george/linkProjects/VMDD/KERN_SRC/VMDD.o] Error 127
Makefile:1337: recipe for target '_module_/home/george/linkProjects/VMDD/KERN_SRC' failed
make[1]: Leaving directory '/home/george/kernels/linux-3.16.43'
make[1]: *** [_module_/home/george/linkProjects/VMDD/KERN_SRC] Error 2
make: *** [modules] Error 2
Makefile:8: recipe for target 'modules' failed
make: Leaving directory '/home/george/linkProjects/VMDD/KERN_SRC'
What did I do wrong ?
I've downloaded kernel version 3.16.xx from https://www.kernel.org/ and then pointed to extracted files from that archive.
You can't compile modules for some kernel if you have only its original source. You need point IDE to configured and partially build kernel. Actually, all files needed to build modules for some kernel version are in kbuild directory of compiled kernel, installed into /lib/modules/version/kbuild. There are linux-kbuild-version (https://packages.debian.org/jessie/kernel/linux-kbuild-3.16) package with some files https://packages.debian.org/jessie/amd64/linux-kbuild-3.16/filelist and linux-headers-version (https://packages.debian.org/jessie/linux-headers-3.16.0-4-amd64) which includes Module.symvers (https://packages.debian.org/jessie/amd64/linux-headers-3.16.0-4-amd64/filelist):
/usr/src/linux-headers-3.16.0-4-amd64/Module.symvers

Resources