Reputation: 105
I am trying to compile in Linux Mint 17.2 a main.c
code and assembly code pstring.s
.
When I try to link the codes, the gcc
returns:
/usr/bin/ld: cannot find -lgcc
.
Does anyone know what I need to change in order to make it work?
gcc -m32 -g -c -o pstring.o pstring.s
shay@shay-Latitude-E6410~/workspace1/targ3Mivne $ gcc -m32 -g -c -o main.o main.c
shay@shay-Latitude-E6410 ~/workspace1/targ3Mivne $ gcc -m32 -g -o a.out main.o pstring.o
/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
Upvotes: 4
Views: 11418
Reputation: 19375
Try installing these packages with the command sudo apt-get install gcc-multilib g++-multilib
Without multilib the 32-bit version of libgcc isn't available. The 64-bit one can't be linked to 32-bit code which is the reason for the error in this question. – Michael Petch
Upvotes: 11