What is a GCC error for Linux and how to solve it? gcc: internal compiler error: illegal instruction (program like)

I type gcc hello.c and the following 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 simple:

 int main() { return 0; } 

I canโ€™t figure out how to make it easier! (The same thing happened with printf 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 did not install it.

Regarding 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 , he 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 recognize --enable-debug .

+6
source share
5 answers

Got! I uninstalled gcc, installed gcc-4.7 and ... nothing.

I cleared the end of gcc-4.6 and ran sudo apt-get install gcc-4.7 again and ... nothing.

I updated binutils and ... it will work!

So, as did not seem to affect the GCC update, but updating it more directly did it for me.

(It was from 2.22-7.1 to 2.22-8 if it helps someone.)

+3
source

I can only shed light on the error message:

gcc: internal compiler error: illegal command (program like)

gcc performs several compilation operations. First, it translates your program into assembler, and then converts the assembler to machine code.

The name of the assembler program with gcc is as . Therefore, the error message informs you that the assembler has failed to start because the assembler executable contains illegal instructions.

This may be a hardware error, which means that the assembler executable is broken.

To check:

  • Does gcc -S hello.c ? This should create "hello.s" containing the C code compiled for assembler
  • You can try using gcc -v -c hello.c find out what exactly is happening.
+2
source

Found on raspberryPi forums:

I grabbed the sources and tried cross-compiling in the x86-64 field for the general purpose of the hand. Something inside the / hq 2x.cpp filter makes GCC go crazy and consume memory and swap, so I wouldn't be surprised if it causes a fatal error on Pi. Some sources suggest this is an overflow on the compilerโ€™s internal stack (cc1plus).

One possible fix is โ€‹โ€‹to run the configure script with --enable-debug - this should reduce optimization to a minimum and avoid by increasing the size of the binary files.

So you can try setting the compiler flags to

 -O0 -g 

and check if it helps.

+1
source

A similar problem.

But this happened after moving the VirtualBox image (from Xubuntu 16.04 / gcc-5) from a Haswell-based device to Sandy Bridge. The problem was somewhere in the build-essential / gcc / binutils packages. I reinstalled them all (with apt remove and apt install - no onehot reinstall) - this helped.

+1
source

Try updating the compiler and try

 sudo apt-get install build-essential 

This can solve the problem.

0
source

Source: https://habr.com/ru/post/944897/


All Articles