I'm studying Assembly and I need to compile a piece of C code into a 32-bit executable file. The issue is that I keep getting this error. I've tried installing gcc-multilib and g++-lib, but it hasn't helped. Anyone know what might be going on?
> gcc main.s -m32 -o main
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
Using gcc version 4.8.5 (Ubuntu 4.8.5-4ubuntu4) on Ubuntu 16.10.
Update: Added the compilation command. I compiled the .s file beforehand using gcc -m32 -S main.c
because I needed to have a look at the Assembly code.
gcc-multilib
only installs the 32-bit components for the defaultgcc
(i.e.gcc-6
on 16.10) - have you tried installing the correspondinggcc-4.8-multilib
? – steeldriver Apr 15 '17 at 02:18