使用 gcc 组装 32 位 x86 代码



我正在尝试让 sdl quake 在我的 64 位 Linux 系统上构建。它在我的 32 位 Linux 系统上构建并运行良好。我得到的错误是:

d_copy.S:28: Error: invalid instruction suffix for `push'

以及一堆类似的错误。我假设我应该能够使用 -m32 标志进行构建,它会将其构建为 32 位二进制文件。这对我来说很好。

我将"-m32"附加到 Makefile 中的 CFLAGS 中,并尝试再次构建,但现在我得到:

gcc -DPACKAGE="sdlquake" -DVERSION="1.0.9"  -I. -I.      
-g -O2 -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -m32 -c cd_sdl.c
In file included from /usr/include/SDL/SDL_main.h:26:0,
             from /usr/include/SDL/SDL.h:30,
             from cd_sdl.c:8:
/usr/include/SDL/SDL_stdinc.h:34:23: fatal error: sys/types.h: No such file or directory
compilation terminated.
make: *** [cd_sdl.o] Error 1

我想我可能只是在这里错过了一些明显的东西,因为我没有那么多玩过 -m32 标志。操作系统是Ubuntu。

您需要

32 位版本的 libc-dev 才能执行此操作。

使用 Ubuntu 的最快方式:

sudo apt-get install libc6-dev-i386

最新更新