First of all, you need all the 32 bit libs that the application you are compiling needs to build and link to. I deal in c++ more, so I will give an example for that, but it should be the same for C.
Code:
$ g++ -m32 foo.cpp -o foo.bin -L /usr/lib -march=i586
$ file foo.bin
foo.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, not stripped
As long as I have the headers and libs in /usr/lib, that command will work. If I do not, then it will fail; so make sure you have explicitly installed the 32bit versions of what you need to compile against.
You might also need to output 32bit-versions of the object code that your compilation creates; it kind of depends on how complex the build is.
** Look in the GCC man page to see the different CPU types you can set -march to. It's a long man page so do I search for 'corei7' or 'pentium' and that should take you to the right section.