How to compile a 32-bit binary on a 64-bit linux machine with gcc/cmake

dala picture dala · Aug 13, 2009 · Viewed 166.8k times · Source

Is it possible to compile a project in 32-bit with cmake and gcc on a 64-bit system? It probably is, but how do I do it?

When I tried it the "ignorant" way, without setting any parameters/flags/etc, just setting LD_LIBRARY_PATH to find the linked libraries in ~/tools/lib it seems to ignore it and only look in subdirectories named lib64.

Answer

caf picture caf · Aug 13, 2009
export CFLAGS=-m32