Ubuntu 64位系统执行32位arm-linux-gcc命令时提示No such file or directory

Ubuntu 64位系统安装32交叉编译器,出现如下错误:

Ubuntu 64位系统执行32位arm-linux-gcc命令时提示No such file or directory_第1张图片

错误原因:

直接到arm-linux-gnueabihf-g++这个bin文件下执行./arm-linux-gnueabihf-g++,提示No such file or directory.令我百思不得其解,即使这个二进制文件错误,也不应该提示这个错误呀,明明这个文件存在的。

废了好大劲儿,各种尝试,后来终于找到了错误-运行兼容linux standard base(LSB)程序问题。

有很多商业软件在发布时按照LSB规范来分发二进制。如果系统不符合LSB规范则这些程序都无法运行,比如下面这个过程
$ ./arm-linux-gnueabihf-g++
-bash: ./arm-linux-gnueabihf-g++: No such file or directory
查看文件存在
$ file ./arm-linux-gnueabihf-g++
./arm-linux-gnueabihf-g++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
执行权限也正确
$ ls -lha ./arm-linux-gnueabihf-g++
-rwxr-xr-x 1 em em 854K Jun 8 2009 ./arm-linux-gnueabihf-g++
用LDD检查,无法查看内容
$ ldd ./arm-linux-gnueabihf-g++
/usr/bin/ldd: line 116: ./arm-linux-gnueabihf-g++: No such file or directory
也就是说有这么一个程序,束手无策。

这是因为这些程序在编译阶段和lsb的一坨东西绑在一起了,所以当缺失这些基本的库文件的时候根本不会知道出什么错误了。
一般来说通过lsb_release会检查出发行版对LSB的支持情况。在对LSB的支持态度上,Redhat、Debian这些发行版比较积极,Arch稍麻烦(好像AUR有lsb-core),而gentoo基本持批评态度,开发者态度也及其糟糕(可自行google gentoo lsb,很快就能找到一大堆战贴)
解决方法:sudo apt-get install lsb-core

你可能感兴趣的:(压力测量项目)