Not sure what happened here. I'm trying to upgrade my Linux kernel from 4.9.x to 4.14.x and the below happened:

In file included from arch/x86/decode.c:26:0:
arch/x86/../../elf.h:22:18: fatal error: gelf.h: No such file or directory
 #include <gelf.h>
compilation terminated.
mv: cannot stat ‘/usr/src/linux-4.14.51/tools/objtool/arch/x86/.decode.o.tmp’: No such file or directory
make[4]: *** [/usr/src/linux-4.14.51/tools/objtool/arch/x86/decode.o] Error 1
make[3]: *** [arch/x86] Error 2
make[2]: *** [/usr/src/linux-4.14.51/tools/objtool/objtool-in.o] Error 2
make[1]: *** [objtool] Error 2
make: *** [tools/objtool] Error 2

Any ideas what happened here (other than the obvious)? Should "gelf.h" already be on my computer? Or in the kernel tarball?

I downloaded vanilla 4.14.51 from kernel.org - I've compiled my own (unmodified) vanilla kernel successfully, repeatedly, for 14 years now, but this is new.

My PC is a Dell laptop with Core2 i5 (64-bit) with Slackware 14.1 -- I upgraded the stock 3.17.x with 4.4.x several years ago, and more recently to 4.9.x (currently 4.9.109).

I do have libelf installed:

me@mylaptop:~$ locate gelf.h

me@mylaptop:~$ ls /var/log/packages/*elf*


When trying 4.14.55 last night, I noted that the directory in which the kernel build script expects to see "gelf.h" is in the kernel source tree, not the regular /usr/include.

That being said, the corresponding directory in my (running) 4.9.x source tree does not have any .o nor .ko files. Obviously there's a config item enabled in 4.14.x that I don't have enabled in 4.9.x.

I've tried configuring 4.14.x as close to my working 4.9.x as possible; I am aware of some new options, but generally I try to keep the configurations the same between intermediate kernel versions.

That being said, I don't know what config option it is that would want to see the header files in linux-4.14.*/tools/objtool/arch/x86/... Any ideas?

  • Perhaps check that the location of gelf.h is in the #include path, and that the user running make has access rights to it (and the folder)? stackoverflow.com/questions/7834152/… – Time4Tea Jun 21 '18 at 19:14
  • My copy of gelf.h is in /usr/include and it is from the (Centos 7) package elfutils-libelf-devel. – Chuck E Jun 26 '18 at 21:44

You need to install the following package:


It provides the gelf.h header file and others. Perhaps you just never installed it on your machine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.