我有64位(amd64 a.k.a )。x86_64) Debian或Ubuntu安装。我需要偶尔运行32位(i 386/i 686)程序,或者为32位系统编译程序。我怎么才能尽量少大惊小怪地这么做呢?
奖励:如果我想运行或测试发行版的旧版本或更新版本,该怎么办?
发布于 2012-09-03 02:54:47
由于Ubuntu 11.04 (natty)和Debian 7.0 (wheezy)引入了多拱支持,32位和64位库可以共存在一个系统上。要安装32位库libXX,首先向系统添加必要的32位架构:
sudo dpkg --add-architecture i386
然后安装32位库:
sudo apt-get install libXX:i386
ia32-libs包。对于Ubuntu12.04来说,它不再包含任何库,它只将libXX:i386
包作为依赖项使用。
编译部分对于C和C++程序来说相当容易,将-m32
添加到CFLAG
或CXXFLAG
中,这将使生成的程序生成32位,例如
export CFLAGS="-m32"
gcc main.c -o main
这也适用于基于makefile的项目。
发布于 2019-09-12 10:34:20
如果您只想在现代64位Debian/Ubuntu系统上运行32位二进制文件,请执行以下操作:
dpkg --add-architecture i386
apt update
apt install libc6-i386
这已经在Debian 9上进行了测试。
https://unix.stackexchange.com/questions/12956
复制相似问题