How can I solve the lto1: internal compiler error: in lto_tag_to_tree_code, at lto-streamer.h:1005 that appears after 'make' command

How can I solve the lto1: internal compiler error: in lto_tag_to_tree_code, at lto-streamer.h:1005 that appears after 'make' command

我超级绝望...我正在使用 Ubuntu 18.04.3 LTS 对于机器人 class,我必须使用 make 命令构建他们的项目(在从 git 克隆之后)。一段时间后,我收到以下信息:enter image description here (...)

make[1]: Entering directory '/home/fia/robotics-course/rai/rai/ry'
         * UpToDate  ../../rai/Kin/libKin.so
         * UpToDate  ../../rai/Core/libCore.so
         * UpToDate  ../../rai/KOMO/libKOMO.so
         * UpToDate  ../../rai/LGP/libLGP.so
g++ -g -march=native -Wall -DRAI_PYBIND `python3-config --cflags` -Wno-terminate -fPIC -std=c++14 -o lgp-py.o -c lgp-py.cpp
         * UpToDate  ../../rai/Operate/libOperate.so
g++ -g -march=native -Wall -DRAI_PYBIND `python3-config --cflags` -Wno-terminate -fPIC -std=c++14 -o ry.o -c ry.cpp
         * UpToDate  ../../rai/Perception/libPerception.so
         * UpToDate  ../../rai/RosCom/libRosCom.so
g++ -L/home/fia/robotics-course/rai/lib -L/usr/local/lib -o libry.so ./lgp-py.o ./ry.o -lCore -lKin -lKOMO -lLGP -lOperate -lRosCom -lPerception `python3-config --ldflags` -lrt -shared 
lto1: internal compiler error: in lto_tag_to_tree_code, at lto-streamer.h:1005
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
lto-wrapper: fatal error: g++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
../../build/generic.mk:299: recipe for target 'libry.so' failed
make[1]: *** [libry.so] Error 1
make[1]: Target 'default' not remade because of errors.
make[1]: Leaving directory '/home/fia/robotics-course/rai/rai/ry'
     ***** FAILED    rai/rai/ry/libry.so

我假设 "internal compiler error" 行告诉我出了什么问题,但我不知道如何解决它...我重新安装了 g++ 并重新下载了 git 存储库几次但似乎没有任何效果。我已经想到也许我的操作系统有问题? 我已经考虑重新安装 Ubuntu...

因此,如果有人有想法,我将非常感激! 问候 菲亚

"Internal compiler error" 听起来好像编译器中有错误,所以这里有一些尝试解决它的想法。

您可以尝试使用 clang++ 而不是 g++ 来编译它。安装使用:

sudo apt-get install clang

然后使用类似的东西构建:

CC=clang CXX=clang++ LD=clang make

因为错误提到 lto,您也可以关闭 link 时间优化:

LDFLAGS=-fno-lto make