Using
gcc -m32 myprog.c
should compile in 32 bit version the file myprog.c
.
Unfortunately I get this error:
You need gcc multilib support. Install the package gcc-multilib
. E.g.:
sudo apt-get install gcc-multilib
I encountered to this same problem. when I was trying to build 32 bit so file while i'm in 64 bit ubuntu version.
you can build by switching your lib version into 64 bit in netbeans (-> project properties -> C compiler -> additional options) set to
-shared -m64
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
To fix the issue we first need to know which package will provide the file sys/cdefs.h
In CentOs/RHEL based system you can find it by running below command
yum provides '*sys/cdefs.h'
Similarly, in Debian/Ubuntu systems you can find it by running
apt-file search 'sys/cdefs.h'
Note: If apt-file package is not already present on the system install it with command
apt-get install apt-file
Both above commands will scan the respective package management systems database i.e RPM/Apt and tells the name of the package which supplies the file ending with "sys/cdefs.h".
Install the appropriate package from the packages listed by the commands.
Like
On CentOs/RHEL:
yum install glibc-headers
On Debian/Ubuntu
apt-get install libc6-dev
This approach is not only useful for this particular issue but any similar issue which is reporting some required file being provided by some package being not present.