且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 64 位 Ubuntu 上编译 32 位应用程序?

更新时间:2023-09-30 12:33:04

要让 Ubuntu Server 12.04 LTS 64 位编译 gcc 4.8 32 位程序,您需要做两件事.

To get Ubuntu Server 12.04 LTS 64-bit to compile gcc 4.8 32-bit programs, you'll need to do two things.

  1. 确保所有 32 位 gcc 4.8 开发工具都已完全安装:

  1. Make sure all the 32-bit gcc 4.8 development tools are completely installed:

sudo apt-get install lib32gcc-4.8-dev

使用 -m32 标志编译程序

Compile programs using the -m32 flag

gcc pgm.c -m32 -o pgm