Build 32bit project on 64bit Linux system

I need to compile my C++ project that is developed on 64 bit Ubuntu Eclipse to 32bit one. I know that I must set -m32 switch for compiler.

I know that I should link to 32 bit libraries. How to achieve that? I suppose my system is using 64 bit libs.


I have no installed 32 bit libraries on my system. My linker was not angry after adding -m32 switch. Can I assume that 32 bit libraries was installed or they not needed for current project?
Are you sure?

Run these:
1
2
file name-of-binary
ldd name-of-binary

The 'file' tells what kind of file your compiled program is.
The 'ldd' lists the dynamic libraries that your program will link to during runtime.

If unsure:
1
2
man file
man ldd
I suppose information below shows that I already had 32 bit lib installed:

file liba.so
brings :

liba.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=3a865a7bbfff34c7c52ad3d5ebc0be5b9ab7f1df, not stripped

ldd liba.so:
brings:

linux-gate.so.1 => (0xf7f83000)
libstdc++.so.6 => /usr/lib32/libstdc++.so.6 (0xf7d75000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7d58000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7ba2000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7b4d000)
/lib/ld-linux.so.2 (0xf7f85000)

Indeed.

It should be possible with Ubuntu package managing tools to show which installed packages do the files /usr/lib32/libstdc++.so.6, /lib/i386-linux-gnu/libgcc_s.so.1, ... belong to.
Topic archived. No new replies allowed.