I'm trying to install different software onto my Raspberry Pi with Debian Wheezy OS. When I run try to configure software I'm trying to install I get this output
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in 'directory of where I'm installing the software'
configure: error: cannot run C compiled programs.
If you meant to cross compile, use '--host'.
See config.log' for more details
So then I check the config log and it basically says the same thing, the only difference is I see there was a segfault when checking whether cross compiling:
configure:3547: checking for suffix of executables
configure:3554: /usr/bin/gcc -o conftest -Wno-long-long conftest.c >&5
configure:3558: $? = 0
configure:3580: result:
configure:3602: checking whether we are cross compiling
configure:3610: /usr/bin/gcc -o conftest -Wno-long-long conftest.c >&5
configure:3614: $? = 0
configure:3621: ./conftest
./configure: line 3623: 3679 Segmentation fault ./conftest$ac_cv_exeext
configure:3625: $? = 139
configure:3632: error: in `/usr/local/src/VALGRIND/valgrind-3.10.1':
configure:3634: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
This error has come up twice now. Once when trying to install Valgrind and once when trying to install libusb.
The output with gcc -v is this:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable- languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
On CoreOS, solved the problem with.
install.packages('rgdal', type = "source", configure.args='--host=host')
The problem here has been resolved by:
export PATH=/path/to/gcc-4.9.2/bin/:$PATH
export LD_LIBRARY_PATH=/path/to/gcc-4.9.2/lib64/:$LD_LIBRARY_PATH
./configure --prefix=/path/to/ --host=arm
Hope this will help you.
It is an issue with /tmp directory. Just append this to your pip command: --build ./ and rerun it.
./ is current working directory.
I got this exact error. When I looked in config.log I saw the message:
fatal error: sys/cdefs.h: No such file or directory
To fix this, I ran:
sudo apt-get install libc6-dev
I could then configure and compile my program.
Related
I'm trying to cross compile aws webrtc library(https://github.com/awslabs/amazon-kinesis-video-streams-webrtc-sdk-c) for arm. So I followed the instruction on Readme.md but I failed.
What I did
export CC=arm-linux-gnueabihf-gcc
export CXX=arm-linux-gnueabihf-g++
cmake .. -DBUILD_TEST=TRUE -DBUILD_OPENSSL=TRUE -DBUILD_STATIC_LIBS=TRUE -DBUILD_OPENSSL_PLATFORM=linux-generic32 -DBUILD_LIBSRTP_HOST_PLATFORM=x86_64-pc-linux-gnu -DBUILD_LIBSRTP_DESTINATION_PLATFORM=arm-unknown-linux-uclibcgnueabi
The error I encountered
Scanning dependencies of target kvsCommonLws
[ 26%] Building C object CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o
In file included from /home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/libkvsCommonLws/build/src/libkvsCommonLws-download/src/source/Common/Include_i.h:41,
from /home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/libkvsCommonLws/build/src/libkvsCommonLws-download/src/source/Common/Auth.c:5:
/home/jacob/Workspace/Github/amazon-kinesis-video-streams-webrtc-sdk-c/open-source/include/libwebsockets.h:120:10: fatal error: sys/capability.h: No such file or directory
120 | #include <sys/capability.h>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/kvsCommonLws.dir/build.make:62: recipe for target 'CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o' failed
make[5]: *** [CMakeFiles/kvsCommonLws.dir/src/source/Common/Auth.c.o] Error 1
make[4]: *** [CMakeFiles/kvsCommonLws.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/kvsCommonLws.dir/all' failed
Makefile:129: recipe for target 'all' failed
CMakeFiles/libkvsCommonLws-download.dir/build.make:111: recipe for target 'build/src/libkvsCommonLws-download-stamp/libkvsCommonLws-download-build' failed
make[3]: *** [all] Error 2
make[2]: *** [build/src/libkvsCommonLws-download-stamp/libkvsCommonLws-download-build] Error 2
make[1]: *** [CMakeFiles/libkvsCommonLws-download.dir/all] Error 2
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/libkvsCommonLws-download.dir/all' failed
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
CMake Error at CMake/Utilities.cmake:65 (message):
CMake step for libkvsCommonLws failed: 2
Call Stack (most recent call first):
CMakeLists.txt:150 (build_dependency)
Something is wrong with your ARM toolchain or how the build system uses it. Where did you get it from and how did you install it?
The header sys/capability.h is included with the ARM toolchain. For example, when I install the Debian package gcc-arm-linux-gnueabihf then this header file gets copied to /usr/arm-linux-gnueabihf/include/linux/capability.h. The toolchain is supposed to find it there on its own.
The command arm-linux-gnueabihf-gcc -v will show you where the toolchain is configured to look for its own header files. E.g. in output below it's --includedir=/usr/arm-linux-gnueabihf/include that matters, the header should be found relative to this directory. I apologize for the super long line.
$ arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc-cross/arm-linux-gnueabihf/10/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 10.2.1-1' --with-bugurl=file:///usr/share/doc/gcc-10/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-10 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --disable-libquadmath-support --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --without-target-system-zlib --enable-multiarch --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=arm-linux-gnueabihf --program-prefix=arm-linux-gnueabihf- --includedir=/usr/arm-linux-gnueabihf/include --with-build-config=bootstrap-lto-lean --enable-link-mutex
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.2.1 20201207 (Debian 10.2.1-1)
You can also try increasing the verbosity of your cmake build process to verify that it's calling the right cross compiler. I've forgotten the details, but perhaps adding a flag -v will help.
I am doing C development on windows and installed Msys2. With Msys2 pacman I installed 64 bit mingw and Glib. I can use the gcc that was installed to compile. The Glib headers is now at C:\msys64\mingw64\include\glib-2.0 and C:\msys64\usr\include\glib-2.0.
When adding #include <gmodule.h> to a source file and compiling I get:
fatal error: gmodule.h: No such file or directory
Checking the include paths with gcc -xc -E -v - I see errors:
Using built-in specs.
COLLECT_GCC=gcc
Target: x86_64-w64-mingw32
Configured with: ../gcc-8.2.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 -
-host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=ada,c,lto,c++,objc,obj-c++,fortran --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev1, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 8.2.0 (Rev1, Built by MSYS2 project)
COLLECT_GCC_OPTIONS='-E' '-v' '-mtune=generic' '-march=x86-64'
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/cc1.exe -E -quiet -v -iprefix C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/ -D_REENTRANT - -mtune=generic -march=x86-64
ignoring duplicate directory "C:/msys64/mingw64/lib/gcc/../../lib/gc/x86_64-w64-mingw32/8.2.0/include"
ignoring nonexistent directory "F:/msys64/mingw64/include"
ignoring nonexistent directory "/mingw64/include"
ignoring duplicate directory "C:/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed"
ignoring duplicate directory "C:/msys64/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/include"
ignoring nonexistent directory "F:/msys64/mingw64/x86_64-w64-mingw32/include"
#include "..." search starts here:
#include <...> search starts here:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/include
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../include
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/include-fixed
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.2.0/../../../../x86_64-w64-mingw32/include
End of search list.
How do I fix include paths so that gcc can find the GLib headers? I could add it to a spec file or C_INCLUDE_PATH but I it bypasses the error instead of fixing it.
If you install pkg-config, you can use it to obtain the build flags for glib, like this:
$ pkg-config --cflags glib-2.0
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
$ pkg-config --libs glib-2.0
$ -lglib-2.0
The flags will vary from system to system, but the library name (glib-2.0) is hopefully consistent.
GCC gives this error no matter what I do. I have uninstalled gcc and all libraries, done a reinstall and reboot. gcc was working last night, and when I open my laptop today it tries looking for intellij files.
And here's the error I get when I run make. Note: This happens with every source file I try to compile. Just started today. It was working yesterday.
gcc -c war.c
Error: Could not find or load main class com.intellij.idea.Main
https://github.com/ahester57/WAR
which gcc gives me /usr/bin/gcc
which as gives me /usr/bin/as
I've tried /usr/bin/gcc -c war.c and it gives the save Error (having to do with intellij). I don't even have intellij installed.
Just looking for any insight, might reinstall OS if nobody else has experienced this issue. Using vim and bash on Ubuntu 17.04. 17.10 is right around the corner.
$ gcc -v -Wall -g ptr.c -o ptr
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 6.3.0-12ubuntu2' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)
COLLECT_GCC_OPTIONS='-v' '-Wall' '-g' '-o' 'ptr' '-mtune=generic' '-march=x86-64'
/usr/lib/gcc/x86_64-linux-gnu/6/cc1 -quiet -v -imultiarch x86_64-linux-gnu ptr.c -quiet -dumpbase ptr.c -mtune=generic -march=x86-64 -auxbase ptr -g -Wall -version -fstack-protector-strong -Wformat-security -o /tmp/ccjR19rz.s
GNU C11 (Ubuntu 6.3.0-12ubuntu2) version 6.3.0 20170406 (x86_64-linux-gnu)
compiled by GNU C version 6.3.0 20170406, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/6/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/6/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C11 (Ubuntu 6.3.0-12ubuntu2) version 6.3.0 20170406 (x86_64-linux-gnu)
compiled by GNU C version 6.3.0 20170406, GMP version 6.1.2, MPFR version 3.1.5, MPC version 1.0.3, isl version 0.15
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 5a80a4e17a9c5c8f646e6b274db1ec27
COLLECT_GCC_OPTIONS='-v' '-Wall' '-g' '-o' 'ptr' '-mtune=generic' '-march=x86-64'
as -v --64 -o /tmp/cc267OI7.o /tmp/ccjR19rz.s
Error: Could not find or load main class com.intellij.idea.Main
Thanks to Basile, got gcc working again.
Solution:
apt-get reinstall gcc gcc-multilib
apt-get reinstall binutils
Type which gcc and which as (I won't be surprised the output would be weird, should be /usr/bin/gcc and /usr/bin/as) then both gcc -v and gcc --version; correct (probably in ~/.bashrc) the setting of your $PATH (so use echo $PATH to find out what it is) and use $(CC) in your Makefile. BTW, you don't need the lines with gcc in your Makefile, because make has built-in rules (type make -p to find them)
If that is not enough (it should be) add an explicit
CC= /usr/bin/gcc
in your Makefile which is quite buggy.
Take time to read the documentation of make, then rewrite your Makefile entirely.
See this and that answers (they contain relevant examples)
You should compile with all warnings and debug info, probably by having
CFLAGS+= -Wall -Wextra -g
Read also the documentation of GCC. You probably don't need -w and you are using -c incorrectly (it is skipping the linking step and just compiling).
BTW, order of arguments to gcc matters a lot (and you get it wrong).
I have uninstalled gcc and all libraries, done a reinstall and reboot. gcc was working last night, and when I open my laptop today it tries looking for intellij files.
PS. Perhaps your /usr/bin/gcc has been spoiled (or your as used by gcc, try reinstalling binutils package) and probably your system is corrupted, you need to fix that first to be able to edit a simple helloworld.c program then do (in a fresh terminal running a shell like bash or zsh) a gcc -v -Wall -g helloworld.c -o helloworldprogram then run ./helloworldprogram. Once that is well, read documentation of make, documentation of GCC and start your project again.
appendix
In a comment you mentioned https://github.com/ahester57/WAR here is a better Makefile for commit 7ed7133e09c7bb2af:
# Makefile improved by Basile Starynkevitch
CC= gcc
CFLAGS= -Wall -g
LDLIBS= -lm
SOURCES= cards.c war.c
# or perhaps SOURCES= $(wildcard *.c)
OBJECTS= $(patsubst %.c,%.o,$(SOURCES))
.PHONY: all clean
all: war
war: $(OBJECTS)
$(OBJECTS): cards.h
clean:
$(RM) $(OBJECTS) war *~
The problem you see is that as (the GNU assembler) is not found.
When gcc tries to load the assembler, something completely different is attempted.
My (wild) guess is that you installed Android Studio as 'as'. At least the error message appears somehow familiar.
I'm trying to compile Qemu for this target in a static way : {arm-linux-user, armeb-linux-user, arm-softmmu}.
here is this configure command I'm using :
./configure --target-list="arm-linux-user armeb-linux-user arm-softmmu" --disable-werror --enable-debug --static
When I'm executing this command I got the following error :
C++ compiler c++ does not work with C compiler cc Disabling C++
specific optional code
ERROR: Your compiler does not support the __thread specifier for
Thread-Local Storage (TLS). Please upgrade to a version that does.
Or, my cc version is 5.1.1 so this is quite new :
[lionel#localhost qemu]$ cc -v
Utilisation des specs internes.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Cible : x86_64-redhat-linux
Configuré avec: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --disable-libgcj --with-isl --enable-libmpx --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC)
I can compile it normally without the "--static" argument. I need to compile it in static way as I am trying to chroot into a filesystem where binaries are ELF arm executable..
If it is not possible I could possibly use qemu-system-arm to emulate to board.
Configure will also produce this error message if your linker is broken (ie trying to compile a .c program to an executable doesn't work), because the TLS check happens to be the first one which tries to do that -- in this case it will print a misleading error message. In this case your compiler is definitely new enough to handle __thread, so you should check whether your linker works OK. Looking in config.log will show all the programs QEMU's configure script tried to run and their output.
(I just submitted a patch -- http://patchwork.ozlabs.org/patch/548123/ -- which will result in a less confusing warning if your linker doesn't work.)
I type gcc hello.c and this appears:
gcc: internal compiler error: Illegal instruction (program as)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
hello.c is just:
int main()
{
return 0;
}
I can't think of any way to make it simpler! (The same happened with printf in there.)
So: how do you fix this? I'm on Raspian, on Raspberry Pi.
Edit
gcc -v gives
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/4.6/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-14+rpi1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-fpu=vfp --with-float=hard --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix
gcc version 4.6.3 (Debian 4.6.3-14+rpi1)
No I didn't install it.
As for updates, sudo apt-get install gcc gives
Reading package lists... Done
Building dependency tree
Reading state information... Done
gcc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Yes, you can run as, it says Illegal instruction with no arguments.
I have no idea what swap space is.
gcc -O0 -g hello.c gives the same error.
gcc does not recognise --enable-debug.
Got it! I uninstalled gcc, installed gcc-4.7, and ... nothing.
I cleared out the end of gcc-4.6 and re-ran sudo apt-get install gcc-4.7 and ... nothing.
I updated binutils and ... it worked!
So, as didn't appear to be affected by updating GCC, but updating it more directly did it for me.
(It was from 2.22-7.1 to 2.22-8, if that helps anyone.)
I can only shed some light on the error message:
gcc: internal compiler error: Illegal instruction (program as)
gcc does several things when compiling. It first translates your C program into assembler and then converts the assembler into machine code.
The name of the assembler program with gcc is just as. So the error message tells you, that running the assembler fails, because the assembler executable contains an illegal instruction.
This might really be an hardware error, meaning that the executable of the assembler is broken.
To check:
Does gcc -S hello.c work ? That should create a "hello.s" containing the C code compiled to assembler
You might try with gcc -v -c hello.c to find out what happens exactly.
Found on raspberryPi forums:
Grabbed the sources and tried a cross-compile on an x86-64 box for a generic arm target. Something inside filter/hq2x.cpp is causing GCC to go nuts and consume memory & swap, so I wouldn't be at all surprised if it triggers a fatal error on a Pi. Some sources suggest that it is the compiler's (cc1plus) internal stack overflowing.
One possible fix is to run the configure script with --enable-debug - This should reduce optimization to a minimum and avoid stack overflows at the expense of increased binary size.
So you can try to set compiler flags to
-O0 -g
and check whether it helps.
Got similar problem.
But it happened after move of VirtualBox image (with Xubuntu 16.04/gcc-5) from Haswell based machine to Sandy Bridge. Problem was somewhere in build-essential / gcc / binutils packages. I reinstalled all of them (with apt remove and apt install - no oneshot reinstall) - it helped.
Try updating the compiler and try
sudo apt-get install build-essential
That might solve the problem.