关于gcc -m32 -o 编译错误: /usr/bin/ld: cannot find -lgcc

看了网上的总结
三种情形:
1 系统没有安装相对应的lib
2 相对应的lib版本不对
3 lib(.so档)的symbolic link 不正确,没有连结到正确的函式库文件(.so)

看了网上很多教程,关于.o文件链接的不是太懂。所以没弄成。
感觉是我遇到的是第一种情况,所以就试着安装库

sudo  apt-get  update
sudo  apt-get  purge  libc6-dev
sudo  apt-get  install  libc6-dev
sudo  apt-get  install  libc6-dev-i386

安装时出现依赖关系错误(depend)

cd /etc/apt/ source.list
尝试了很多办法,最后发现更新一下来源(source.list)可以解决很多问题
但是改变这个一定要备份,我的Ubuntu版本是16.04LTS,使用了一个别人提供的官方文件:

#deb cdrom:[Ubuntu 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://cn.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe
deb http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe

更新source.list之后,再安装库,一切问题都解决了

sudo  apt-get  update
sudo  apt-get  purge  libc6-dev
sudo  apt-get  install  libc6-dev
sudo  apt-get  install  libc6-dev-i386
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值