public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* segfault when building gcc
@ 2021-09-22 20:25 Andrew Benson
  2021-09-22 21:37 ` Jeff Law
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Benson @ 2021-09-22 20:25 UTC (permalink / raw)
  To: gcc-help

I'm attempting to build GCC (current git master) but am running into a 
segfault.

I'm configuring using:

./gcc-git/configure --prefix=/home/abenson--enable-languages=c,c++,fortran --
disable-multilib

which appears to succeed. Then running make eventually gives

libtool: link:  /home/abenson/gcc-build/./gcc/xgcc -shared-libgcc -B/home/
abenson/gcc-build/./gcc -nostdinc++ -L/home/abenson/gcc-build/x86_64-pc-linux-
gnu/libstdc++-v3/src -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-
v3/src/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/
libsupc++/.libs -B/home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/bin/ -B/
home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/lib/ -isystem /home/abenson/
Galacticus/Tools/x86_64-pc-linux-gnu/include -isystem /home/abenson/
Galacticus/Tools/x86_64-pc-linux-gnu/sys-include   -fno-checking  -fPIC -DPIC 
-D_GLIBCXX_SHARED -shared -nostdlib /usr/lib/../lib64/crti.o /home/abenson/
gcc-build/./gcc/crtbeginS.o  .libs/compatibility.o .libs/compatibility-
debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o 
.libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/
compatibility-chrono.o .libs/compatibility-condvar.o  -Wl,--whole-archive ../
libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc+
+98convenience.a ../src/c++11/.libs/libc++11convenience.a ../src/c++17/.libs/
libc++17convenience.a ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole-
archive  -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc+
+/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/
home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -lm -L/home/
abenson/gcc-build/./gcc -L/lib/../lib64 -L/usr/lib/../lib64 -lc -lgcc_s /home/
abenson/gcc-build/./gcc/crtendS.o /usr/lib/../lib64/crtn.o  -Wl,-O1 -Wl,-z -
Wl,relro -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver   -Wl,-
soname -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.29
collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
compilation terminated.
make[6]: *** [libstdc++.la] Error 1
make[6]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
libstdc++-v3/src'
make[5]: *** [all-recursive] Error 1
make[5]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
libstdc++-v3/src'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
libstdc++-v3'
make[3]: *** [all] Error 2
make[3]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
libstdc++-v3'
make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
make[2]: Leaving directory `/home/abenson/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/abenson/gcc-build'
make: *** [all] Error 2

Using "git bisect" shows that the first bad commit causing this problem is:

https://gcc.gnu.org/git/?
p=gcc.git;a=commit;h=a68412117fa47786bd82ab79b009ec7933aef476

Has any one else found this problem, or know how to work around it?

Thanks,
Andrew



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: segfault when building gcc
  2021-09-22 20:25 segfault when building gcc Andrew Benson
@ 2021-09-22 21:37 ` Jeff Law
  2021-09-22 21:47   ` Andrew Benson
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff Law @ 2021-09-22 21:37 UTC (permalink / raw)
  To: Andrew Benson, gcc-help



On 9/22/2021 2:25 PM, Andrew Benson via Gcc-help wrote:
> I'm attempting to build GCC (current git master) but am running into a
> segfault.
>
> I'm configuring using:
>
> ./gcc-git/configure --prefix=/home/abenson--enable-languages=c,c++,fortran --
> disable-multilib
>
> which appears to succeed. Then running make eventually gives
>
> libtool: link:  /home/abenson/gcc-build/./gcc/xgcc -shared-libgcc -B/home/
> abenson/gcc-build/./gcc -nostdinc++ -L/home/abenson/gcc-build/x86_64-pc-linux-
> gnu/libstdc++-v3/src -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-
> v3/src/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/
> libsupc++/.libs -B/home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/bin/ -B/
> home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/lib/ -isystem /home/abenson/
> Galacticus/Tools/x86_64-pc-linux-gnu/include -isystem /home/abenson/
> Galacticus/Tools/x86_64-pc-linux-gnu/sys-include   -fno-checking  -fPIC -DPIC
> -D_GLIBCXX_SHARED -shared -nostdlib /usr/lib/../lib64/crti.o /home/abenson/
> gcc-build/./gcc/crtbeginS.o  .libs/compatibility.o .libs/compatibility-
> debug_list.o .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/
> compatibility-chrono.o .libs/compatibility-condvar.o  -Wl,--whole-archive ../
> libsupc++/.libs/libsupc++convenience.a ../src/c++98/.libs/libc+
> +98convenience.a ../src/c++11/.libs/libc++11convenience.a ../src/c++17/.libs/
> libc++17convenience.a ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole-
> archive  -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc+
> +/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/
> home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -lm -L/home/
> abenson/gcc-build/./gcc -L/lib/../lib64 -L/usr/lib/../lib64 -lc -lgcc_s /home/
> abenson/gcc-build/./gcc/crtendS.o /usr/lib/../lib64/crtn.o  -Wl,-O1 -Wl,-z -
> Wl,relro -Wl,--gc-sections -Wl,--version-script=libstdc++-symbols.ver   -Wl,-
> soname -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.29
> collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
> compilation terminated.
> make[6]: *** [libstdc++.la] Error 1
> make[6]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> libstdc++-v3/src'
> make[5]: *** [all-recursive] Error 1
> make[5]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> libstdc++-v3/src'
> make[4]: *** [all-recursive] Error 1
> make[4]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> libstdc++-v3'
> make[3]: *** [all] Error 2
> make[3]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> libstdc++-v3'
> make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
> make[2]: Leaving directory `/home/abenson/gcc-build'
> make[1]: *** [stage1-bubble] Error 2
> make[1]: Leaving directory `/home/abenson/gcc-build'
> make: *** [all] Error 2
>
> Using "git bisect" shows that the first bad commit causing this problem is:
>
> https://gcc.gnu.org/git/?
> p=gcc.git;a=commit;h=a68412117fa47786bd82ab79b009ec7933aef476
>
> Has any one else found this problem, or know how to work around it?
Note that you're actually getting a segfault in the linker which is part 
of the binutils project.  While the compiler might be generating 
something the linker dislikes, the linker shouldn't be segfaulting.

Jeff


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: segfault when building gcc
  2021-09-22 21:37 ` Jeff Law
@ 2021-09-22 21:47   ` Andrew Benson
  2021-09-22 21:57     ` Tom Kacvinsky
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Benson @ 2021-09-22 21:47 UTC (permalink / raw)
  To: Jeff Law; +Cc: gcc-help

Thanks for pointing that out. It seems that the actual linker command that's 
segfaulting is:

/usr/bin/ld -v --eh-frame-hdr -m elf_x86_64 -shared -o .libs/libstdc++.so.
6.0.29 -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/home/
abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/abenson/
gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -L/home/abenson/
gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -L/home/abenson/
gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/home/abenson/gcc-build/
x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/abenson/gcc-build/./gcc -L/
lib/../lib64 -L/usr/lib/../lib64 -L/home/abenson/gcc-build/./gcc -L/lib/../
lib64 -L/usr/lib/../lib64 /usr/lib/../lib64/crti.o /home/abenson/gcc-build/./
gcc/crtbeginS.o .libs/compatibility.o .libs/compatibility-debug_list.o .libs/
compatibility-debug_list-2.o .libs/compatibility-c++0x.o .libs/compatibility-
atomic-c++0x.o .libs/compatibility-thread-c++0x.o .libs/compatibility-chrono.o 
.libs/compatibility-condvar.o --whole-archive ../libsupc++/.libs/libsupc+
+convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/
libc++11convenience.a ../src/c++17/.libs/libc++17convenience.a ../src/c+
+20/.libs/libc++20convenience.a --no-whole-archive -lm -lc -lgcc_s /home/
abenson/gcc-build/./gcc/crtendS.o /usr/lib/../lib64/crtn.o -O1 -z relro --gc-
sections --version-script=libstdc++-symbols.ver -soname libstdc++.so.6GNU ld 
version 2.20.51.0.2-5.42.el6 20100205


On Wednesday, September 22, 2021 2:37:27 PM PDT Jeff Law wrote:
> On 9/22/2021 2:25 PM, Andrew Benson via Gcc-help wrote:
> > I'm attempting to build GCC (current git master) but am running into a
> > segfault.
> > 
> > I'm configuring using:
> > 
> > ./gcc-git/configure --prefix=/home/abenson--enable-languages=c,c++,fortran
> > -- disable-multilib
> > 
> > which appears to succeed. Then running make eventually gives
> > 
> > libtool: link:  /home/abenson/gcc-build/./gcc/xgcc -shared-libgcc -B/home/
> > abenson/gcc-build/./gcc -nostdinc++
> > -L/home/abenson/gcc-build/x86_64-pc-linux- gnu/libstdc++-v3/src
> > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++- v3/src/.libs
> > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/
> > libsupc++/.libs -B/home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/bin/
> > -B/ home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/lib/ -isystem
> > /home/abenson/ Galacticus/Tools/x86_64-pc-linux-gnu/include -isystem
> > /home/abenson/ Galacticus/Tools/x86_64-pc-linux-gnu/sys-include  
> > -fno-checking  -fPIC -DPIC -D_GLIBCXX_SHARED -shared -nostdlib
> > /usr/lib/../lib64/crti.o /home/abenson/ gcc-build/./gcc/crtbeginS.o 
> > .libs/compatibility.o .libs/compatibility- debug_list.o
> > .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> > .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o
> > .libs/ compatibility-chrono.o .libs/compatibility-condvar.o 
> > -Wl,--whole-archive ../ libsupc++/.libs/libsupc++convenience.a
> > ../src/c++98/.libs/libc+
> > +98convenience.a ../src/c++11/.libs/libc++11convenience.a
> > ../src/c++17/.libs/ libc++17convenience.a
> > ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole- archive 
> > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc+
> > +/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src
> > -L/ home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -lm
> > -L/home/ abenson/gcc-build/./gcc -L/lib/../lib64 -L/usr/lib/../lib64 -lc
> > -lgcc_s /home/ abenson/gcc-build/./gcc/crtendS.o /usr/lib/../lib64/crtn.o
> >  -Wl,-O1 -Wl,-z - Wl,relro -Wl,--gc-sections
> > -Wl,--version-script=libstdc++-symbols.ver   -Wl,- soname
> > -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.29
> > collect2: fatal error: ld terminated with signal 11 [Segmentation fault]
> > compilation terminated.
> > make[6]: *** [libstdc++.la] Error 1
> > make[6]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > libstdc++-v3/src'
> > make[5]: *** [all-recursive] Error 1
> > make[5]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > libstdc++-v3/src'
> > make[4]: *** [all-recursive] Error 1
> > make[4]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > libstdc++-v3'
> > make[3]: *** [all] Error 2
> > make[3]: Leaving directory `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > libstdc++-v3'
> > make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
> > make[2]: Leaving directory `/home/abenson/gcc-build'
> > make[1]: *** [stage1-bubble] Error 2
> > make[1]: Leaving directory `/home/abenson/gcc-build'
> > make: *** [all] Error 2
> > 
> > Using "git bisect" shows that the first bad commit causing this problem
> > is:
> > 
> > https://gcc.gnu.org/git/?
> > p=gcc.git;a=commit;h=a68412117fa47786bd82ab79b009ec7933aef476
> > 
> > Has any one else found this problem, or know how to work around it?
> 
> Note that you're actually getting a segfault in the linker which is part
> of the binutils project.  While the compiler might be generating
> something the linker dislikes, the linker shouldn't be segfaulting.
> 
> Jeff


-- 

* Andrew Benson: https://abensonca.github.io

* Galacticus: https://github.com/galacticusorg/galacticus




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: segfault when building gcc
  2021-09-22 21:47   ` Andrew Benson
@ 2021-09-22 21:57     ` Tom Kacvinsky
  2021-09-22 23:10       ` Andrew Benson
  0 siblings, 1 reply; 5+ messages in thread
From: Tom Kacvinsky @ 2021-09-22 21:57 UTC (permalink / raw)
  To: Andrew Benson; +Cc: Jeff Law, gcc-help

On Wed, Sep 22, 2021 at 5:47 PM Andrew Benson via Gcc-help <
gcc-help@gcc.gnu.org> wrote:

> Thanks for pointing that out. It seems that the actual linker command
> that's
> segfaulting is:
>
> /usr/bin/ld -v --eh-frame-hdr -m elf_x86_64 -shared -o .libs/libstdc++.so.
> 6.0.29 -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src
> -L/home/
> abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> -L/home/abenson/
> gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -L/home/abenson/
> gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs -L/home/abenson/
> gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/home/abenson/gcc-build/
> x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/abenson/gcc-build/./gcc
> -L/
> lib/../lib64 -L/usr/lib/../lib64 -L/home/abenson/gcc-build/./gcc -L/lib/../
> lib64 -L/usr/lib/../lib64 /usr/lib/../lib64/crti.o
> /home/abenson/gcc-build/./
> gcc/crtbeginS.o .libs/compatibility.o .libs/compatibility-debug_list.o
> .libs/
> compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> .libs/compatibility-
> atomic-c++0x.o .libs/compatibility-thread-c++0x.o
> .libs/compatibility-chrono.o
> .libs/compatibility-condvar.o --whole-archive ../libsupc++/.libs/libsupc+
> +convenience.a ../src/c++98/.libs/libc++98convenience.a ../src/c++11/.libs/
> libc++11convenience.a ../src/c++17/.libs/libc++17convenience.a ../src/c+
> +20/.libs/libc++20convenience.a --no-whole-archive -lm -lc -lgcc_s /home/
> abenson/gcc-build/./gcc/crtendS.o /usr/lib/../lib64/crtn.o -O1 -z relro
> --gc-
> sections --version-script=libstdc++-symbols.ver -soname libstdc++.so.6GNU
> ld
> version 2.20.51.0.2-5.42.el6 20100205
>
>
I'd say your binutils is way out of date for building the version of GCC
your
building. I am not sure what the recommended policy is for building GCC.

Can you try building a new binutils and putting that on PATH before building
GCC?

Tom

with a particular binutils, but 2.20 is like 17 revisions behind the
current binutils.

>
> On Wednesday, September 22, 2021 2:37:27 PM PDT Jeff Law wrote:
> > On 9/22/2021 2:25 PM, Andrew Benson via Gcc-help wrote:
> > > I'm attempting to build GCC (current git master) but am running into a
> > > segfault.
> > >
> > > I'm configuring using:
> > >
> > > ./gcc-git/configure
> --prefix=/home/abenson--enable-languages=c,c++,fortran
> > > -- disable-multilib
> > >
> > > which appears to succeed. Then running make eventually gives
> > >
> > > libtool: link:  /home/abenson/gcc-build/./gcc/xgcc -shared-libgcc
> -B/home/
> > > abenson/gcc-build/./gcc -nostdinc++
> > > -L/home/abenson/gcc-build/x86_64-pc-linux- gnu/libstdc++-v3/src
> > > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++- v3/src/.libs
> > > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/
> > > libsupc++/.libs
> -B/home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/bin/
> > > -B/ home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/lib/ -isystem
> > > /home/abenson/ Galacticus/Tools/x86_64-pc-linux-gnu/include -isystem
> > > /home/abenson/ Galacticus/Tools/x86_64-pc-linux-gnu/sys-include
> > > -fno-checking  -fPIC -DPIC -D_GLIBCXX_SHARED -shared -nostdlib
> > > /usr/lib/../lib64/crti.o /home/abenson/ gcc-build/./gcc/crtbeginS.o
> > > .libs/compatibility.o .libs/compatibility- debug_list.o
> > > .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> > > .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o
> > > .libs/ compatibility-chrono.o .libs/compatibility-condvar.o
> > > -Wl,--whole-archive ../ libsupc++/.libs/libsupc++convenience.a
> > > ../src/c++98/.libs/libc+
> > > +98convenience.a ../src/c++11/.libs/libc++11convenience.a
> > > ../src/c++17/.libs/ libc++17convenience.a
> > > ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole- archive
> > > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc+
> > > +/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src
> > > -L/ home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> -lm
> > > -L/home/ abenson/gcc-build/./gcc -L/lib/../lib64 -L/usr/lib/../lib64
> -lc
> > > -lgcc_s /home/ abenson/gcc-build/./gcc/crtendS.o
> /usr/lib/../lib64/crtn.o
> > >  -Wl,-O1 -Wl,-z - Wl,relro -Wl,--gc-sections
> > > -Wl,--version-script=libstdc++-symbols.ver   -Wl,- soname
> > > -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.29
> > > collect2: fatal error: ld terminated with signal 11 [Segmentation
> fault]
> > > compilation terminated.
> > > make[6]: *** [libstdc++.la] Error 1
> > > make[6]: Leaving directory
> `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > > libstdc++-v3/src'
> > > make[5]: *** [all-recursive] Error 1
> > > make[5]: Leaving directory
> `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > > libstdc++-v3/src'
> > > make[4]: *** [all-recursive] Error 1
> > > make[4]: Leaving directory
> `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > > libstdc++-v3'
> > > make[3]: *** [all] Error 2
> > > make[3]: Leaving directory
> `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > > libstdc++-v3'
> > > make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
> > > make[2]: Leaving directory `/home/abenson/gcc-build'
> > > make[1]: *** [stage1-bubble] Error 2
> > > make[1]: Leaving directory `/home/abenson/gcc-build'
> > > make: *** [all] Error 2
> > >
> > > Using "git bisect" shows that the first bad commit causing this problem
> > > is:
> > >
> > > https://gcc.gnu.org/git/?
> > > p=gcc.git;a=commit;h=a68412117fa47786bd82ab79b009ec7933aef476
> > >
> > > Has any one else found this problem, or know how to work around it?
> >
> > Note that you're actually getting a segfault in the linker which is part
> > of the binutils project.  While the compiler might be generating
> > something the linker dislikes, the linker shouldn't be segfaulting.
> >
> > Jeff
>
>
> --
>
> * Andrew Benson: https://abensonca.github.io
>
> * Galacticus: https://github.com/galacticusorg/galacticus
>
>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: segfault when building gcc
  2021-09-22 21:57     ` Tom Kacvinsky
@ 2021-09-22 23:10       ` Andrew Benson
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Benson @ 2021-09-22 23:10 UTC (permalink / raw)
  To: Tom Kacvinsky; +Cc: Jeff Law, gcc-help

Hi Tom,

That fixed the problem. I installed the latest binutils and now gcc builds 
without any problems.

Thanks for your help!

-Andrew

On Wednesday, September 22, 2021 2:57:46 PM PDT Tom Kacvinsky wrote:
> On Wed, Sep 22, 2021 at 5:47 PM Andrew Benson via Gcc-help <
> 
> gcc-help@gcc.gnu.org> wrote:
> > Thanks for pointing that out. It seems that the actual linker command
> > that's
> > segfaulting is:
> > 
> > /usr/bin/ld -v --eh-frame-hdr -m elf_x86_64 -shared -o .libs/libstdc++.so.
> > 6.0.29 -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src
> > -L/home/
> > abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> > -L/home/abenson/
> > gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
> > -L/home/abenson/
> > gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
> > -L/home/abenson/
> > gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src -L/home/abenson/gcc-build/
> > x86_64-pc-linux-gnu/libstdc++-v3/src/.libs -L/home/abenson/gcc-build/./gcc
> > -L/
> > lib/../lib64 -L/usr/lib/../lib64 -L/home/abenson/gcc-build/./gcc
> > -L/lib/../
> > lib64 -L/usr/lib/../lib64 /usr/lib/../lib64/crti.o
> > /home/abenson/gcc-build/./
> > gcc/crtbeginS.o .libs/compatibility.o .libs/compatibility-debug_list.o
> > .libs/
> > compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> > .libs/compatibility-
> > atomic-c++0x.o .libs/compatibility-thread-c++0x.o
> > .libs/compatibility-chrono.o
> > .libs/compatibility-condvar.o --whole-archive ../libsupc++/.libs/libsupc+
> > +convenience.a ../src/c++98/.libs/libc++98convenience.a
> > ../src/c++11/.libs/
> > libc++11convenience.a ../src/c++17/.libs/libc++17convenience.a ../src/c+
> > +20/.libs/libc++20convenience.a --no-whole-archive -lm -lc -lgcc_s /home/
> > abenson/gcc-build/./gcc/crtendS.o /usr/lib/../lib64/crtn.o -O1 -z relro
> > --gc-
> > sections --version-script=libstdc++-symbols.ver -soname libstdc++.so.6GNU
> > ld
> > version 2.20.51.0.2-5.42.el6 20100205
> 
> I'd say your binutils is way out of date for building the version of GCC
> your
> building. I am not sure what the recommended policy is for building GCC.
> 
> Can you try building a new binutils and putting that on PATH before building
> GCC?
> 
> Tom
> 
> with a particular binutils, but 2.20 is like 17 revisions behind the
> current binutils.
> 
> > On Wednesday, September 22, 2021 2:37:27 PM PDT Jeff Law wrote:
> > > On 9/22/2021 2:25 PM, Andrew Benson via Gcc-help wrote:
> > > > I'm attempting to build GCC (current git master) but am running into a
> > > > segfault.
> > > > 
> > > > I'm configuring using:
> > > > 
> > > > ./gcc-git/configure
> > 
> > --prefix=/home/abenson--enable-languages=c,c++,fortran
> > 
> > > > -- disable-multilib
> > > > 
> > > > which appears to succeed. Then running make eventually gives
> > > > 
> > > > libtool: link:  /home/abenson/gcc-build/./gcc/xgcc -shared-libgcc
> > 
> > -B/home/
> > 
> > > > abenson/gcc-build/./gcc -nostdinc++
> > > > -L/home/abenson/gcc-build/x86_64-pc-linux- gnu/libstdc++-v3/src
> > > > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++- v3/src/.libs
> > > > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/
> > > > libsupc++/.libs
> > 
> > -B/home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/bin/
> > 
> > > > -B/ home/abenson/Galacticus/Tools/x86_64-pc-linux-gnu/lib/ -isystem
> > > > /home/abenson/ Galacticus/Tools/x86_64-pc-linux-gnu/include -isystem
> > > > /home/abenson/ Galacticus/Tools/x86_64-pc-linux-gnu/sys-include
> > > > -fno-checking  -fPIC -DPIC -D_GLIBCXX_SHARED -shared -nostdlib
> > > > /usr/lib/../lib64/crti.o /home/abenson/ gcc-build/./gcc/crtbeginS.o
> > > > .libs/compatibility.o .libs/compatibility- debug_list.o
> > > > .libs/compatibility-debug_list-2.o .libs/compatibility-c++0x.o
> > > > .libs/compatibility-atomic-c++0x.o .libs/compatibility-thread-c++0x.o
> > > > .libs/ compatibility-chrono.o .libs/compatibility-condvar.o
> > > > -Wl,--whole-archive ../ libsupc++/.libs/libsupc++convenience.a
> > > > ../src/c++98/.libs/libc+
> > > > +98convenience.a ../src/c++11/.libs/libc++11convenience.a
> > > > ../src/c++17/.libs/ libc++17convenience.a
> > > > ../src/c++20/.libs/libc++20convenience.a -Wl,--no-whole- archive
> > > > -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/libsupc+
> > > > +/.libs -L/home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src
> > > > -L/ home/abenson/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> > 
> > -lm
> > 
> > > > -L/home/ abenson/gcc-build/./gcc -L/lib/../lib64 -L/usr/lib/../lib64
> > 
> > -lc
> > 
> > > > -lgcc_s /home/ abenson/gcc-build/./gcc/crtendS.o
> > 
> > /usr/lib/../lib64/crtn.o
> > 
> > > >  -Wl,-O1 -Wl,-z - Wl,relro -Wl,--gc-sections
> > > > 
> > > > -Wl,--version-script=libstdc++-symbols.ver   -Wl,- soname
> > > > -Wl,libstdc++.so.6 -o .libs/libstdc++.so.6.0.29
> > > > collect2: fatal error: ld terminated with signal 11 [Segmentation
> > 
> > fault]
> > 
> > > > compilation terminated.
> > > > make[6]: *** [libstdc++.la] Error 1
> > > > make[6]: Leaving directory
> > 
> > `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > 
> > > > libstdc++-v3/src'
> > > > make[5]: *** [all-recursive] Error 1
> > > > make[5]: Leaving directory
> > 
> > `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > 
> > > > libstdc++-v3/src'
> > > > make[4]: *** [all-recursive] Error 1
> > > > make[4]: Leaving directory
> > 
> > `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > 
> > > > libstdc++-v3'
> > > > make[3]: *** [all] Error 2
> > > > make[3]: Leaving directory
> > 
> > `/home/abenson/gcc-build/x86_64-pc-linux-gnu/
> > 
> > > > libstdc++-v3'
> > > > make[2]: *** [all-stage1-target-libstdc++-v3] Error 2
> > > > make[2]: Leaving directory `/home/abenson/gcc-build'
> > > > make[1]: *** [stage1-bubble] Error 2
> > > > make[1]: Leaving directory `/home/abenson/gcc-build'
> > > > make: *** [all] Error 2
> > > > 
> > > > Using "git bisect" shows that the first bad commit causing this
> > > > problem
> > > > is:
> > > > 
> > > > https://gcc.gnu.org/git/?
> > > > p=gcc.git;a=commit;h=a68412117fa47786bd82ab79b009ec7933aef476
> > > > 
> > > > Has any one else found this problem, or know how to work around it?
> > > 
> > > Note that you're actually getting a segfault in the linker which is part
> > > of the binutils project.  While the compiler might be generating
> > > something the linker dislikes, the linker shouldn't be segfaulting.
> > > 
> > > Jeff
> > 
> > --
> > 
> > * Andrew Benson: https://abensonca.github.io
> > 
> > * Galacticus: https://github.com/galacticusorg/galacticus


-- 

* Andrew Benson: https://abensonca.github.io

* Galacticus: https://github.com/galacticusorg/galacticus




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-22 23:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 20:25 segfault when building gcc Andrew Benson
2021-09-22 21:37 ` Jeff Law
2021-09-22 21:47   ` Andrew Benson
2021-09-22 21:57     ` Tom Kacvinsky
2021-09-22 23:10       ` Andrew Benson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).