dala dala - 3 months ago 24
Linux Question

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

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.

caf caf
Answer
export CFLAGS=-m32