How to deal with linker error : error-cannot find

2020-06-08 15:11发布

问题:

this is my makefile:

task0 : main.o numbers.o add.o
        gcc -m32 -g -Wall -o task0 main.o numbers.o add.o

main.o : main.c
        gcc -g -Wall -m32 -ansi -c -o main.c
numbers.o : numbers.c
           gcc -g -Wall -m32 -ansi -c -o numbers.c
add.o: add.s
      nasm -g -f elf -w+all -o add.o add.s
clean : 
       rm -f *.o task0

and this is the terminal output:

gcc -m32 -g -Wall -o task0 main.o numbers.o add.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
make: *** [task0] 1 הלקת

can someone explain me what is lgcc and how to fix that?

回答1:

(Answered in a comment. See Question with no answers, but issue solved in the comments (or extended in chat) )

@Basil Starynkevitch wrote:

You should install the gcc-multilib package

@Jekyll wrote:

https://askubuntu.com/questions/250910/cross-compilation-issues-with-gcc-g