Linux -m32 gcc compiling now working

JC0133

Senior member
Nov 2, 2010
201
1
76
I keep trying to compile a program I am running in linux using -m32.


I keep getting this error.

gcc -g -m32 encrypt.c -o encrypt
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1

I googled and learned that running this command should fix it.
sudo apt-get install gcc-multilib g++-multilib

but I am still getting the same errors.
 

you2

Diamond Member
Apr 2, 2002
6,471
1,514
136
This isn't a compile error it is a link error. You need to install i32 bit version of the libraries.

I keep trying to compile a program I am running in linux using -m32.


I keep getting this error.

gcc -g -m32 encrypt.c -o encrypt
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/6/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
collect2: error: ld returned 1 exit status
Makefile:3: recipe for target 'all' failed
make: *** [all] Error 1

I googled and learned that running this command should fix it.
sudo apt-get install gcc-multilib g++-multilib

but I am still getting the same errors.