在 64 位 Linux 操作系统上编译 32 位程序导致致命错误 [英] Compile program for 32bit on 64bit Linux OS causes fatal error
本文介绍了在 64 位 Linux 操作系统上编译 32 位程序导致致命错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用
gcc -m32 myprog.c
应该在 32 位版本中编译文件 myprog.c
.
不幸的是我收到此错误:
在/usr/include/stdio.h:27:0 包含的文件中,从 myprog.c:1:/usr/include/features.h:374:25: 致命错误: sys/cdefs.h: 没有那个文件或目录#include
我该如何解决这个问题?
如果我不使用 -m32
它可以工作但使用 64 位指令.
解决方案
要在 64 位 Linux 版本上编译 32 位二进制文件,您必须安装 libx32gcc
开发包和 32 位 GNU C 库>
试试这个
sudo apt-get install libx32gcc-4.8-dev
和
sudo apt-get install libc6-dev-i386
Using
gcc -m32 myprog.c
should compile in 32 bit version the file myprog.c
.
Unfortunately I get this error:
In file included from /usr/include/stdio.h:27:0,
from myprog.c:1:
/usr/include/features.h:374:25: fatal error: sys/cdefs.h: No such file or directory
#include <sys/cdefs.h>
How could I fix this?
If I don't use -m32
it works but uses 64 bit instructions.
解决方案
To compile 32 bit binaries on 64 bit Linux version, you have to Install libx32gcc
development package and 32 bit GNU C Library
try this
sudo apt-get install libx32gcc-4.8-dev
and
sudo apt-get install libc6-dev-i386
这篇关于在 64 位 Linux 操作系统上编译 32 位程序导致致命错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文