g++ segfaults

110 views
Skip to first unread message

Damien Towning

unread,
Jul 11, 2022, 11:24:17 PM7/11/22
to Chipyard
Hello everyone this is my first post. Details are as follows.

uname -a

Linux mixotricha-ThinkPad-E480 5.15.0-40-generic #43-Ubuntu SMP Wed Jun 15 12:54:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

uname -r

5.15.0-40-generic

lsb_release -a

No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04 LTS
Release:    22.04
Codename:    jammy

Autoconf : 2.71
Make : 4.3
Gcc : 11.2.0
G++ : 11.2.0

Head Checked Out : 1.7.0

I have tried the latest head. Also head 1.60. Currently trying 1.7.0. Getting similar errors during build with all of them. Completey cleaned out and started again for each try.

This is my pre build script. I am pulling verilator 4.100 as I saw this recommended somewhere and also universal-ctags instead of ctags.  

-----------------------------

#!/bin/bash

set -ex

sudo apt-get install -y build-essential bison flex software-properties-common curl
sudo apt-get install -y libgmp-dev libmpfr-dev libmpc-dev zlib1g-dev vim default-jdk default-jre
#install sbt: https://www.scala-sbt.org/release/docs/Installing-sbt-on-Linux.html#Ubuntu+and+other+Debian-based+distributions
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install -y sbt
sudo apt-get install -y texinfo gengetopt
sudo apt-get install -y libexpat1-dev libusb-dev libncurses5-dev cmake
# deps for poky
sudo apt-get install -y python3.8 patch diffstat texi2html texinfo subversion chrpath wget
# deps for qemu
sudo apt-get install -y libgtk-3-dev gettext
# deps for firemarshal
sudo apt-get install -y python3-pip python3.8-dev rsync libguestfs-tools expat universal-ctags
# install DTC
sudo apt-get install -y device-tree-compiler
sudo apt-get install -y python
# install git >= 2.17
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y

# install verilator
sudo apt-get install -y autoconf
git clone http://git.veripool.org/git/verilator
cd verilator
git checkout v4.100
autoconf && ./configure && make -j$(nproc) && sudo make install

----------------------------

After doing the clone and checking out either main or 1.6.0 or 1.7.0 and doing

./scripts/build-toolchains.sh riscv-tools

Build goes well for awhile but then eventually starts to segfault g++.

Sample Of OutPut From Build :

-------------------------
g++ -fno-PIE -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common -Wno-unused -DHAVE_CONFIG_H -I. -I. -I../../../riscv-gcc/gcc -I../../../riscv-gcc/gcc/. -I../../../riscv-gcc/gcc/../include -I../../../riscv-gcc/gcc/../libcpp/include  -I../../../riscv-gcc/gcc/../libdecnumber -I../../../riscv-gcc/gcc/../libdecnumber/dpd -I../libdecnumber -I../../../riscv-gcc/gcc/../libbacktrace   -o gimple-match.o -MT gimple-match.o -MMD -MP -MF ./.deps/gimple-match.TPo gimple-match.c
during RTL pass: vartrack
gimple-match.c: In function ‘bool gimple_simplify_NE_EXPR(gimple_match_op*, gimple**, tree_node* (*)(tree), code_helper, tree, tree, tree)’:
gimple-match.c:73873:1: internal compiler error: Segmentation fault
73873 | }
      | ^
0x7fbfbe15d51f ???
    ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fbfbe144d8f __libc_start_call_main
    ../sysdeps/nptl/libc_start_call_main.h:58
0x7fbfbe144e3f __libc_start_main_impl
    ../csu/libc-start.c:392
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
make[2]: *** [Makefile:1116: gimple-match.o] Error 1
make[2]: Leaving directory '/home/mixotricha/workspace/chipyard/toolchains/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib-stage1/gcc'
make[1]: *** [Makefile:4312: all-gcc] Error 2
make[1]: Leaving directory '/home/mixotricha/workspace/chipyard/toolchains/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib-stage1'
make: *** [Makefile:432: stamps/build-gcc-newlib-stage1] Error 2
---------------------

Seems like g++ is segfaulting. If I go into individual directories and build things I can often get past a segfault. But I have yet to manage a successful build. 

Damien Towning

unread,
Jul 19, 2022, 7:45:22 PM7/19/22
to Chipyard
What resolved this was 18.04 LTS and adding more ram
Reply all
Reply to author
Forward
0 new messages