我正在将在 Ubuntu 14.04 上编译的代码移植到 16.04。我已经克隆了我的 git repo,安装了依赖项并尝试了通常的 make
命令,很快我就遇到了 g++: internal compiler error: Segmentation fault (program cc1plus)
...我不确定从哪里开始诊断和解决这个问题。
我会尽可能多地分享,看看是否有人可以指导我解决问题。
Ubuntu
$ 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
$ 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++
编译器错误(?)
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 $@ $<
我意识到要设计一个能够获得适当帮助的适当问题将非常困难。所以请耐心等待,并随时建议添加任何可能有帮助的内容。不幸的是,我无法共享代码。
更新
尝试将 g++
升级到更新的版本。正在关注this thread
最佳答案
我如何解决我的 g++
段错误问题
灵感来自 this thread
我在我的 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
之后解决了段错误问题
$ g++ --version
g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
关于c++ - g++:内部编译器错误:段错误(程序 cc1plus)- 我从哪里开始?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44286265/