Quickpost: Compiling 32-bit Static ELF Files on Kali

Here I compile EICARgen on Kali Linux to a 32-bit, statically linked Linux executable.

gcc’s option -m32 creates a 32-bit executable on 64-bit Linux.

If you get this error:

then one way to solve it is by installing libc6-dev-i386 (apt install libc6-dev-i386):

Then option -m32 can be used to create a 32-bit executable:

This executable will not run on 64-bit system that don’t have the libraries we just installed. A work-around is to statically link the ELF file with option -static:

 

Quickpost info

Article Link: https://blog.didierstevens.com/2018/11/19/quickpost-compiling-32-bit-static-elf-files-on-kali/