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

博客讲述在Ubuntu 16.04LTS系统安装库时遇到的问题及解决办法。安装库可能因系统未装对应lib、版本不对或symbolic link不正确导致失败,作者遇到依赖关系错误,尝试多种办法后,更新source.list并备份解决了问题。

看了网上的总结
三种情形:
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
cc -L/home/Iplatform/openwrt/staging_dir/target-mips-openwrt-linux-uclibc-wr1552xv1/usr/lib -L/home/Iplatform/openwrt/staging_dir/target-mips-openwrt-linux-uclibc-wr1552xv1/lib -Wl,-rpath-link,/home/Iplatform/openwrt/staging_dir/target-mips-openwrt-linux-uclibc-wr1552xv1/usr/lib -L/home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib -L/home/Iplatform/openwrt/staging_dir/target-mips-openwrt-linux-uclibc-wr1552xv1/usr/lib -I/home/Iplatform/openwrt/staging_dir/target-mips-openwrt-linux-uclibc-wr1552xv1/usr/include -o apptest apptest.o /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libgcc.so when searching for -lgcc /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libgcc_s.so when searching for -lgcc_s /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libc.so when searching for -lc /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libc.a when searching for -lc /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libgcc.so when searching for -lgcc /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libgcc.a when searching for -lgcc /usr/bin/ld: skipping incompatible /home/rtl8198/toolchain/msdk-4.8.5-mips-EB-4.4-u0.9.33-m32ut-180206/lib/libgcc_s.so when searching for -lgcc_s 编译命令并没有-lgcc等参数,为何会出现报错,如何处理?
08-22
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值