执行32位程序产生兼容性问题
报错:无法执行该文件,原因是由于没有这个文件或文件夹
分析原因:缺少32位库导致无法识别该文件
解决方案:安装32位库
步骤1. 备份源
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
步骤2. 查看源
sudo vim /etc/apt/sources.list
步骤3. 添加源
# 寻找恰当位置添加源,比如添加在其他源前或后
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
或者阿里源也可以
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
保存。
步骤4. 更新源
sudo apt-get upgrade
执行后的部分示例图片
步骤5. 安装32位兼容库。注意:如果源已更新,可直接从忽略步骤1-4
sudo apt-get install g++-multilib
以上就安装完成了!可以执行了
结论
通常执行32位需要兼容库,以前的ubuntu直接就有32位,但后来18以后的版本好像就不自带32位库了,所以要自己装。而装的时候通常都是源的问题。