如何处理链接器错误:错误 - 无法找到-lgcc [英] How to deal with linker error : error-cannot find -lgcc
本文介绍了如何处理链接器错误:错误 - 无法找到-lgcc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的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
这是终端输出:
gcc -m32 -g -Wall - o task0 main.o numbers.o add.o
/ usr / bin / ld:在搜索-lgcc $ b $时跳过不兼容的/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a b / usr / bin / ld:无法找到-lgcc
/ usr / bin / ld:在搜索-lgcc_s $ b时跳过不兼容的/usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so $ b / usr / bin / ld:找不到-lgcc_s
collect2:错误:ld返回1退出状态
make:*** [task0] 1个字符
有人可以向我解释什么是lgcc和如何解决这个问题?
解决方案
(在评论中回答。请参阅问题没有答案,但问题已解决评论(或在聊天中扩展))
@Basil Starynkevitch写道:
您应该安装gcc-multilib软件包
@Jekyll写道:
https://askubuntu.com/问题/ 250910 / cross-compilation-issues-with-gcc -g
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?
解决方案
(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
这篇关于如何处理链接器错误:错误 - 无法找到-lgcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文