在 64 位系统上编译 32 位

Gab*_*e B 3 64-bit python compiling gcc

我正在尝试使用以下配置命令在 64 位 ubuntu 系统上编译 32 位版本的 python:

CC="gcc -m32" LDFLAGS="-L/lib32 -L/usr/lib32 \ -Lpwd/lib32 -Wl,-rpath,/lib32 \
    -Wl,-rpath,/usr/lib32" \ ./configure --prefix=/opt/pym32
Run Code Online (Sandbox Code Playgroud)

然后制作,制作安装。没有错误,但它应该是错误的,因为“readelf -h python”告诉我 python 是作为 ELF64 构建的。

Arn*_*rja 6

使用“--build”和“--host”。

./configure --help
System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
Run Code Online (Sandbox Code Playgroud)

你需要使用

./configure --help
System types:
  --build=BUILD     configure for building on BUILD [guessed]
  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
Run Code Online (Sandbox Code Playgroud)

在 64 位 Linux 系统中为 32 位 Linux 编译。您仍然需要添加其他./configure选项。