Linux 上的 GCC 错误是什么?如何解决? gcc:内部编译器错误:非法指令(程序为)

2023-11-22

I type gcc hello.c出现这样的情况:

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 只是:

int main()
{
 return 0;
}

我想不出有什么办法可以让它变得更简单! (同样的情况也发生在printf在那里。)

那么:你如何解决这个问题?我使用的是 Raspbian,使用的是 Raspberry Pi。

Edit

gcc -v 给出

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) 

不,我没有安装它。

至于更新,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.

是的,你可以运行as, 它说Illegal instruction没有争论。

我不知道交换空间是什么。

gcc -O0 -g hello.c给出同样的错误。

海湾合作委员会不认识--enable-debug.


知道了!我卸载了 gcc,安装了 gcc-4.7,然后……什么也没有。

我清除了 gcc-4.6 的末尾并重新运行sudo apt-get install gcc-4.7没事了。

我更新了 binutils 并且......它起作用了!

So, as更新 GCC 似乎没有受到影响,但更直接地更新它对我来说是这样。

(从 2.22-7.1 到 2.22-8,如果这对任何人有帮助的话。)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Linux 上的 GCC 错误是什么?如何解决? gcc:内部编译器错误:非法指令(程序为) 的相关文章

随机推荐