Search code examples
linuxgccexecutabledemoscene

Compiling sstrip from ELFkickers for Ubuntu10.04 : asm/elf.h problems


I'm playing around with creating tiny executables under linux. My attention has come to a formerly used tool from Muppetlabs.com named sstrip from the ELFkickers collection (http://www.muppetlabs.com/~breadbox/software/elfkickers.html) It strips even more bytes from an ELF executable than strip alone. And it seems that it was in the Ubuntu feeds until HardyHeron but now its gone without a trace. So I tried compiling myself, but the asm/elf.h header seems to be on a new position and gcc bails out with:

gcc -ggdb -Wall -W -o sstrip sstrip.c
sstrip.c:12:21: error: asm/elf.h: No such file or directory
sstrip.c: In function 'readelfheader':
sstrip.c:70: error: 'ELF_DATA' undeclared (first use in this function)
sstrip.c:70: error: (Each undeclared identifier is reported only once
sstrip.c:70: error: for each function it appears in.)
sstrip.c:72: error: 'ELF_CLASS' undeclared (first use in this function)
sstrip.c:77: error: 'ELF_ARCH' undeclared (first use in this function)
sstrip.c: In function 'getmemorysize':
sstrip.c:138: warning: assignment from incompatible pointer type
sstrip.c: In function 'modifyheaders':
sstrip.c:205: warning: assignment from incompatible pointer type
make: *** [sstrip] Error 1

Any suggestions on how to fix this?

Or does anyone know where to find sstrip in a PPA? Maybe an alternative?


Solution

  • Try this:

    $ wget http://www.muppetlabs.com/~breadbox/pub/software/ELFkickers-3.0.tar.gz
    $ tar xf ELFkickers-3.0.tar.gz
    $ cd ELFkickers-3.0/
    $ make
    

    Then you can find the sstrip binary in the sstrip/ directory. If you get errors, please post the output of the make command so we can help you.