Search code examples
linuxmakefilebinutils

binutils make error for readelf


When I run make binutils/readelf I get the following error:

In file included from readelf.c:43:0:
sysdep.h:23:25: fatal error: alloca-conf.h: No such file or directory
 #include "alloca-conf.h"

What dependency am I missing? How do I just build and compile readelf without making the rest of binutils?


Solution

  • What has actually happened is that you do not have a Makefile or at least not one defining binutils/readelf target. But since there is a binutils/readelf.c file, make still ran and tried to compile and link binutils/readelf using its implicit pattern rules... and failed because this source file cannot be built without corresponding configuration.

    This is just to add a bit more detail. Long story short, run ./configure and make as suggested in the comments and collect your resulting readelf. Much easier then trying to isolate a solitary item build out of autotools based project. You add -I to CFLAGS to find alloca-conf.h, you'll just run into another problem like that.