Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot compile x86 in GCC crunchbang

Tags:

c

gcc

32bit-64bit

I cannot seem to use GCC to compile C as x86. I am using crunchbang.

Simple C test file:

#include <stdio.h>

int main(){
    printf("Test x86");
}

When compiled with:
gcc -o 64 test.c
I get no errors or output whatsoever. However, when compiled with:
gcc -o 64 -m32 test.c
I am greeted with:

In file included from /usr/include/features.h:356:0,
                 from /usr/include/stdio.h:28,
                 from test.c:1:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:359:27: fatal error: bits/wordsize.h: No such file or directory
compilation terminated.

Now, browsing those files, it seems as if they are in the wrong folder because. I'm not sure what to do here.

Contents of /usr/include/features.h:586

#  include <x86_64-linux-gnu/sys/cdefs.h>

Which gives an error on line 359. That line is shown here:

#include <bits/wordsize.h>

The file is ACTUALLY located here: /usr/include/x86_64-linux-gnu/bits/wordsize.h

like image 954
Goodies Avatar asked Dec 21 '25 13:12

Goodies


2 Answers

GCC should support or run with multilib to eliminate this error.

like image 117
Sunil Bojanapally Avatar answered Dec 24 '25 02:12

Sunil Bojanapally


On Linux Debian based distros, this should install the missing dependencies, including <bits/wordsize.h>:

sudo apt install gcc-multilib
like image 42
Gunt.r Avatar answered Dec 24 '25 01:12

Gunt.r



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!