最近由于工作的需要,重新弄起arm-linux-gcc编译。离上一次弄这些有整整10年了。

我是在一台64位的机器上实机安装的 centos7 发行版,系统和交叉编译器的安装过程自是没话说,问题出在使用arm-linux-gcc编译

arm程序时,

$ arm-linux-gcc main.c
/opt/FriendlyARM/toolschain/4.4.3/libexec/gcc/arm-none-linux-gnueabi/4.4.3/cc1: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory


提示找不到库文件 libstdc++.so.6 , 在确定系统里确实没有该文件,且环境变量正常的情况下,决定安装之

sudo yum install libstdc++.so.6 , 不料出现以下情况:

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: centos.cs.nctu.edu.tw
* nux-dextop: li.nux.ro
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 libstdc++.i686.0.4.8.5-28.el7\_5.1 将被 安装
--> 正在处理依赖关系 libgcc\_s.so.1(GLIBC\_2.0),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1(GCC\_4.2.0),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1(GCC\_3.3),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1(GCC\_3.0),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1,它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在检查事务
---> 软件包 libgcc.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgcc.i686.0.4.8.5-28.el7\_5.1 将被 安装
---> 软件包 libgcc.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 解决依赖关系完成
错误: Multilib version problems found. This often means that the root
cause is something else and multilib version checking is just
pointing out that there is a problem. Eg.:

  1. You have an upgrade for libstdc++ which is missing some
    dependency that another package requires. Yum is trying to
    solve this by installing an older version of libstdc++ of the
    different architecture. If you exclude the bad architecture
    yum will tell you what the root cause is (which package
    requires what). You can try redoing the upgrade with

--exclude libstdc++.otherarch ... this should give you an error
message showing the root cause of the problem.

  1. You have multiple architectures of libstdc++ installed, but
    yum can only see an upgrade for one of those architectures.
    If you don't want/need both architectures anymore then you
    can remove the one with the missing update and everything
    will work.
  2. You have duplicate versions of libstdc++ installed already.
    You can use "yum check" to get yum show these errors.

...you can also use --setopt=protected\_multilib=false to remove
this checking, however this is almost never the correct thing to
do as something else is very likely to go wrong (often causing
much more problems).

保护多库版本:libstdc++-4.8.5-28.el7\_5.1.i686 != libstdc++-4.8.5-28.el7.x86\_64

大意是:在安装32位的库的同时也在更新64位的库,所以出现了多库版本问题。

在网上搜同样的问题,得到的资料提示要分开安装和更新。

好吧,先更新64位的库:

sudo yum update libstdc++-4.8.5-28.el7.x86\_64

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: centos.communilink.net
* nux-dextop: li.nux.ro
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 libstdc++.x86\_64.0.4.8.5-28.el7 将被 升级
--> 正在处理依赖关系 libstdc++ = 4.8.5-28.el7,它被软件包 gcc-c++-4.8.5-28.el7.x86\_64 需要
--> 正在处理依赖关系 libstdc++(x86-64) = 4.8.5-28.el7,它被软件包 libstdc++-devel-4.8.5-28.el7.x86\_64 需要
---> 软件包 libstdc++.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 正在检查事务
---> 软件包 gcc-c++.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 gcc-c++.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 正在处理依赖关系 gcc = 4.8.5-28.el7\_5.1,它被软件包 gcc-c++-4.8.5-28.el7\_5.1.x86\_64 需要
---> 软件包 libstdc++-devel.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libstdc++-devel.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 正在检查事务
---> 软件包 gcc.x86\_64.0.4.8.5-28.el7 将被 升级
--> 正在处理依赖关系 gcc = 4.8.5-28.el7,它被软件包 libquadmath-devel-4.8.5-28.el7.x86\_64 需要
--> 正在处理依赖关系 gcc = 4.8.5-28.el7,它被软件包 gcc-gfortran-4.8.5-28.el7.x86\_64 需要
---> 软件包 gcc.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 正在处理依赖关系 libgomp = 4.8.5-28.el7\_5.1,它被软件包 gcc-4.8.5-28.el7\_5.1.x86\_64 需要
--> 正在处理依赖关系 cpp = 4.8.5-28.el7\_5.1,它被软件包 gcc-4.8.5-28.el7\_5.1.x86\_64 需要
--> 正在处理依赖关系 libgcc >= 4.8.5-28.el7\_5.1,它被软件包 gcc-4.8.5-28.el7\_5.1.x86\_64 需要
--> 正在检查事务
---> 软件包 cpp.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 cpp.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
---> 软件包 gcc-gfortran.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 gcc-gfortran.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 正在处理依赖关系 libquadmath = 4.8.5-28.el7\_5.1,它被软件包 gcc-gfortran-4.8.5-28.el7\_5.1.x86\_64 需要
--> 正在处理依赖关系 libgfortran = 4.8.5-28.el7\_5.1,它被软件包 gcc-gfortran-4.8.5-28.el7\_5.1.x86\_64 需要
---> 软件包 libgcc.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgcc.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
---> 软件包 libgomp.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgomp.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
---> 软件包 libquadmath-devel.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libquadmath-devel.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 正在检查事务
---> 软件包 libgfortran.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libgfortran.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
---> 软件包 libquadmath.x86\_64.0.4.8.5-28.el7 将被 升级
---> 软件包 libquadmath.x86\_64.0.4.8.5-28.el7\_5.1 将被 更新
--> 解决依赖关系完成

依赖关系解决

================================================================================

Package 架构 版本 源 大小

正在更新:
libstdc++ x86\_64 4.8.5-28.el7\_5.1 updates 303 k
为依赖而更新:
cpp x86\_64 4.8.5-28.el7\_5.1 updates 5.9 M
gcc x86\_64 4.8.5-28.el7\_5.1 updates 16 M
gcc-c++ x86\_64 4.8.5-28.el7\_5.1 updates 7.2 M
gcc-gfortran x86\_64 4.8.5-28.el7\_5.1 updates 6.7 M
libgcc x86\_64 4.8.5-28.el7\_5.1 updates 101 k
libgfortran x86\_64 4.8.5-28.el7\_5.1 updates 299 k
libgomp x86\_64 4.8.5-28.el7\_5.1 updates 156 k
libquadmath x86\_64 4.8.5-28.el7\_5.1 updates 188 k
libquadmath-devel x86\_64 4.8.5-28.el7\_5.1 updates 51 k
libstdc++-devel x86\_64 4.8.5-28.el7\_5.1 updates 1.5 M

事务概要

升级 1 软件包 (+10 依赖软件包)

总计:39 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在更新 : libquadmath-4.8.5-28.el7\_5.1.x86\_64 1/22
正在更新 : libgcc-4.8.5-28.el7\_5.1.x86\_64 2/22
正在更新 : libstdc++-4.8.5-28.el7\_5.1.x86\_64 3/22
正在更新 : libstdc++-devel-4.8.5-28.el7\_5.1.x86\_64 4/22
正在更新 : libgfortran-4.8.5-28.el7\_5.1.x86\_64 5/22
正在更新 : cpp-4.8.5-28.el7\_5.1.x86\_64 6/22
正在更新 : libgomp-4.8.5-28.el7\_5.1.x86\_64 7/22
正在更新 : gcc-4.8.5-28.el7\_5.1.x86\_64 8/22
正在更新 : libquadmath-devel-4.8.5-28.el7\_5.1.x86\_64 9/22
正在更新 : gcc-gfortran-4.8.5-28.el7\_5.1.x86\_64 10/22
正在更新 : gcc-c++-4.8.5-28.el7\_5.1.x86\_64 11/22
清理 : gcc-c++-4.8.5-28.el7.x86\_64 12/22
清理 : gcc-gfortran-4.8.5-28.el7.x86\_64 13/22
清理 : libquadmath-devel-4.8.5-28.el7.x86\_64 14/22
清理 : libstdc++-devel-4.8.5-28.el7.x86\_64 15/22
清理 : gcc-4.8.5-28.el7.x86\_64 16/22
清理 : libgfortran-4.8.5-28.el7.x86\_64 17/22
清理 : libstdc++-4.8.5-28.el7.x86\_64 18/22
清理 : libgcc-4.8.5-28.el7.x86\_64 19/22
清理 : libquadmath-4.8.5-28.el7.x86\_64 20/22
清理 : cpp-4.8.5-28.el7.x86\_64 21/22
清理 : libgomp-4.8.5-28.el7.x86\_64 22/22
验证中 : libgomp-4.8.5-28.el7\_5.1.x86\_64 1/22
验证中 : libstdc++-devel-4.8.5-28.el7\_5.1.x86\_64 2/22
验证中 : gcc-4.8.5-28.el7\_5.1.x86\_64 3/22
验证中 : libgfortran-4.8.5-28.el7\_5.1.x86\_64 4/22
验证中 : gcc-gfortran-4.8.5-28.el7\_5.1.x86\_64 5/22
验证中 : libgcc-4.8.5-28.el7\_5.1.x86\_64 6/22
验证中 : cpp-4.8.5-28.el7\_5.1.x86\_64 7/22
验证中 : libquadmath-4.8.5-28.el7\_5.1.x86\_64 8/22
验证中 : gcc-c++-4.8.5-28.el7\_5.1.x86\_64 9/22
验证中 : libquadmath-devel-4.8.5-28.el7\_5.1.x86\_64 10/22
验证中 : libstdc++-4.8.5-28.el7\_5.1.x86\_64 11/22
验证中 : gcc-gfortran-4.8.5-28.el7.x86\_64 12/22
验证中 : libgomp-4.8.5-28.el7.x86\_64 13/22
验证中 : libstdc++-4.8.5-28.el7.x86\_64 14/22
验证中 : libstdc++-devel-4.8.5-28.el7.x86\_64 15/22
验证中 : libgcc-4.8.5-28.el7.x86\_64 16/22
验证中 : gcc-4.8.5-28.el7.x86\_64 17/22
验证中 : libgfortran-4.8.5-28.el7.x86\_64 18/22
验证中 : libquadmath-4.8.5-28.el7.x86\_64 19/22
验证中 : libquadmath-devel-4.8.5-28.el7.x86\_64 20/22
验证中 : cpp-4.8.5-28.el7.x86\_64 21/22
验证中 : gcc-c++-4.8.5-28.el7.x86\_64 22/22

更新完毕:
libstdc++.x86\_64 0:4.8.5-28.el7\_5.1

作为依赖被升级:
cpp.x86\_64 0:4.8.5-28.el7\_5.1
gcc.x86\_64 0:4.8.5-28.el7\_5.1
gcc-c++.x86\_64 0:4.8.5-28.el7\_5.1
gcc-gfortran.x86\_64 0:4.8.5-28.el7\_5.1
libgcc.x86\_64 0:4.8.5-28.el7\_5.1
libgfortran.x86\_64 0:4.8.5-28.el7\_5.1
libgomp.x86\_64 0:4.8.5-28.el7\_5.1
libquadmath.x86\_64 0:4.8.5-28.el7\_5.1
libquadmath-devel.x86\_64 0:4.8.5-28.el7\_5.1
libstdc++-devel.x86\_64 0:4.8.5-28.el7\_5.1

完毕!

OK , 然后安装32位的库:

sudo yum install libstdc++.i686

已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.zju.edu.cn
* nux-dextop: li.nux.ro
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 libstdc++.i686.0.4.8.5-28.el7\_5.1 将被 安装
--> 正在处理依赖关系 libgcc\_s.so.1(GLIBC\_2.0),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1(GCC\_4.2.0),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1(GCC\_3.3),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1(GCC\_3.0),它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在处理依赖关系 libgcc\_s.so.1,它被软件包 libstdc++-4.8.5-28.el7\_5.1.i686 需要
--> 正在检查事务
---> 软件包 libgcc.i686.0.4.8.5-28.el7\_5.1 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================

Package 架构 版本 源 大小

正在安装:
libstdc++ i686 4.8.5-28.el7\_5.1 updates 317 k
为依赖而安装:
libgcc i686 4.8.5-28.el7\_5.1 updates 108 k

事务概要

安装 1 软件包 (+1 依赖软件包)

总下载量:425 k
安装大小:1.2 M
Is this ok [y/d/N]: y
Downloading packages:
(1/2): libstdc++-4.8.5-28.el7\_5.1.i686.rpm | 317 kB 00:00
(2/2): libgcc-4.8.5-28.el7\_5.1.i686.rpm | 108 kB 00:00
--------------------------------------------------------------------------------
总计 652 kB/s | 425 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : libgcc-4.8.5-28.el7\_5.1.i686 1/2
正在安装 : libstdc++-4.8.5-28.el7\_5.1.i686 2/2
验证中 : libgcc-4.8.5-28.el7\_5.1.i686 1/2
验证中 : libstdc++-4.8.5-28.el7\_5.1.i686 2/2

已安装:
libstdc++.i686 0:4.8.5-28.el7\_5.1

作为依赖被安装:
libgcc.i686 0:4.8.5-28.el7\_5.1

完毕!

试着编译:

arm-linux-gcc main.c
/opt/FriendlyARM/toolschain/4.4.3/lib/gcc/arm-none-linux-gnueabi/4.4.3/../../../../arm-none-linux-gnueabi/bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

看来还缺zlib库,安装之:

sudo yum install zlib.i686
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: centos.cs.nctu.edu.tw
* nux-dextop: mirror.li.nux.ro
* updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 zlib.i686.0.1.2.7-17.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================

Package 架构 版本 源 大小

正在安装:
zlib i686 1.2.7-17.el7 base 91 k

事务概要

安装 1 软件包

总下载量:91 k
安装大小:180 k
Is this ok [y/d/N]: y
Downloading packages:
zlib-1.2.7-17.el7.i686.rpm | 91 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : zlib-1.2.7-17.el7.i686 1/1
验证中 : zlib-1.2.7-17.el7.i686 1/1

已安装:
zlib.i686 0:1.2.7-17.el7

完毕!

再编译

arm-linux-gcc main.c

查看
ls
a.out init.S link.lds main.c Makefile

解决。

最后: 上面的更新和安装的顺序不能颠倒,否则还是出现多库版本问题。

标签: none

相关文章推荐

添加新评论,含*的栏目为必填