Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
393 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...