g++:内部编译器错误:分段错误(程序 cc1plus) - 我从哪里开始?

g++: internal compiler error: Segmentation fault (program cc1plus) - where do I start?(g++:内部编译器错误:分段错误(程序 cc1plus) - 我从哪里开始?)

本文介绍了g++:内部编译器错误:分段错误(程序 cc1plus) - 我从哪里开始?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将在 Ubuntu 14.04 上编译的代码移植到 16.04.我已经克隆了我的 git repo,安装了依赖项并尝试了通常的 make 命令,很快我就遇到了 g++: internal compiler error: Segmentation fault (program cc1plus) ...我不确定从哪里开始诊断和解决此问题.

I am porting code that compiled on Ubuntu 14.04 to 16.04. I have cloned my git repo, installed dependencies and tried the usual make command, soon I hit a g++: internal compiler error: Segmentation fault (program cc1plus) ... yet I am not sure where to start to diagnose and resolve this issue.

我会尽可能多地分享,看看是否有人可以指导我解决问题.

I will share as much as I can, see if someone can guide me through a resolution.

$ lsb_release -a 
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:   xenial

g++

$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

蟒蛇

$ python --version
Python 2.7.12

一些环境变量

PYTHON       /usr/bin/python2.7
ARCH         x86_64
OS           Linux
VERSION      4.4.071generic
PLATFORM     linux2
HOSTNAME     deploy
USER         myUser
WUSS_BUILD   NO
CCVER        gcc
PYLIBDIR     build.x86_64-linux2
LIBDIR       build.x86_64-linux2
BINDIR       build.x86_64-linux2
ODIR         build.x86_64-linux2-gcc
STATICLIBDIR build-static.x86_64-linux2

错误

make 命令导致

+++ Compile mycore/boost_json.cc to build.x86_64-linux2-gcc
g++: internal compiler error: Segmentation fault (program cc1plus)   <===
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
mk/makelib2.inc:48: recipe for target 'build.x86_64-linux2-gcc/mycore/boost_json.o' failed
make[1]: *** [build.x86_64-linux2-gcc/mycore/boost_json.o] Error 4
Makefile:152: recipe for target 'make.stage1c' failed
make: *** [make.stage1c] Error 2

错误消息似乎指向 g++ 编译器错误 (?)

The error message seems to be pointing at a g++ compiler error (?)

makelib2.inc:48

$(ODIR)/%.o : %.c
        @mkdir -p $(dir $@)
        @echo "+++ Compile $< to $(ODIR)"
        @$(CC) -MMD -MP -MF $(@:.o=.d) -c -I$(ODIR) $(CFLAGS) $(CFLAGS_$*) -o $@ $<

我意识到,要提出一个合适的问题来获得适当的帮助是非常困难的.因此,请耐心等待,并随时建议添加任何可能有帮助的内容.很遗憾,我无法分享代码.

I realize that this is going to be very difficult to craft a proper question that would lead to getting proper help. So please bear with me and feel free to suggest adding anything that may help. Unfortunately, I can't share the code.

打算尝试将 g++ 升级到更新的版本.关注这个帖子

Going to try upgrade g++ to a more recent version. Following this thread

这里如何安装g++ 7在 Ubuntu 上

HERE how to install g++ 7 on Ubuntu

这里如何在 Ubuntu 上安装 gcc 6p>

推荐答案

我如何解决我的 g++ 分段错误问题

灵感来自这个帖子

我在 Ubuntu 16.04

   sudo apt-get install build-essential software-properties-common -y
   sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y 
   sudo apt-get update
   sudo apt-get install gcc-snapshot -y 

g++5.4.0 增加到 5.4.1 之后,解决了分段错误问题

After what g++ was incremented from 5.4.0 to 5.4.1 which resolve the segmentation fault issue

$ g++ --version
g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904

这篇关于g++:内部编译器错误:分段错误(程序 cc1plus) - 我从哪里开始?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:g++:内部编译器错误:分段错误(程序 cc1plus) - 我从哪里开始?

基础教程推荐