Skip to content

bootstrap: segmentation fault during build #9800

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Stefan-Code opened this issue Feb 7, 2015 · 9 comments
Closed

bootstrap: segmentation fault during build #9800

Stefan-Code opened this issue Feb 7, 2015 · 9 comments

Comments

@Stefan-Code
Copy link

I'm trying to build from source on this system:
Linux Synology 3.2.40 #5022 SMP PREEMPT Wed Jan 7 14:19:42 CST 2015 i686 GNU /Linux synology_evansport_214play
And for building I'm running:


    ~/temp/go-go1.4/src # sh all.bash
    # Building C bootstrap tool.
    cmd/dist
    Segmentation fault (core dumped)
    ~/temp/go-go1.4/src #

The same thing happens for make.bash. Any ideas what's happening?

@davecheney
Copy link
Contributor

What processor does your synology use, you may need to export GOSSE=387 to
disable the use of sse2 instruction.

Dave
On 7 Feb 2015 20:09, "Stefan" [email protected] wrote:

I'm trying to build from source on this system:
Linux Synology 3.2.40 #5022 SMP PREEMPT Wed Jan 7 14:19:42 CST 2015 i686
GNU /Linux synology_evansport_214play
And for building I'm running:

~/temp/go-go1.4/src # sh all.bash
Building C bootstrap tool.

cmd/dist

Segmentation fault (core dumped)

The same thing happens for make.bash. Any ideas what's happening?


Reply to this email directly or view it on GitHub
#9800.

@minux
Copy link
Member

minux commented Feb 7, 2015 via email

@Stefan-Code
Copy link
Author

The box is a DS214play so it's using an Intel Atom CE5335 i686. I tried exporting GOSSE=387 with no luck. The output of bash -x is:


    root@Synology:/root/temp/go-go1.4/src# export GOSSE=387
    root@Synology:/root/temp/go-go1.4/src# bash -x all.bash
    + set -e
    + '[' '!' -f make.bash ']'
    + OLDPATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/opt/bin:/usr/syno/bin:/usr/local/sbin:/opt/share/go/bin:/root/go/bin:/usr/local/bin
    + . ./make.bash --no-banner
    ++ set -e
    ++ '[' '!' -f run.bash ']'
    ++ case "$(uname)" in
    +++ uname
    ++ ld --version
    ++ grep 'gold.* 2\.20'
    ++ for se_mount in /selinux /sys/fs/selinux
    ++ '[' -d /selinux -a -f /selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ']'
    ++ for se_mount in /selinux /sys/fs/selinux
    ++ '[' -d /sys/fs/selinux -a -f /sys/fs/selinux/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ']'
    +++ uname -s
    ++ '[' Linux == GNU/kFreeBSD ']'
    ++ rm -f ./runtime/runtime_defs.go
    ++ echo '# Building C bootstrap tool.'
    # Building C bootstrap tool.
    ++ echo cmd/dist
    cmd/dist
    +++ cd ..
    +++ pwd
    ++ export GOROOT=/root/temp/go-go1.4
    ++ GOROOT=/root/temp/go-go1.4
    ++ GOROOT_FINAL=/root/temp/go-go1.4
    ++ DEFGOROOT='-DGOROOT_FINAL="/root/temp/go-go1.4"'
    ++ mflag=
    ++ case "$GOHOSTARCH" in
    +++ uname
    ++ '[' Linux == Darwin ']'
    +++ type -t gcc
    +++ type -t clang
    ++ '[' -z '' -a -z file -a -n '' ']'
    ++ gcc -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist '-DGOROOT_FINAL="/root/temp/go-go1.4"' cmd/dist/arm.c cmd/dist/buf.c cmd/dist/build.c cmd/dist/buildgc.c cmd/dist/buildgo.c cmd/dist/buildruntime.c cmd/dist/main.c cmd/dist/plan9.c cmd/dist/unix.c cmd/dist/windows.c
    +++ ./cmd/dist/dist env -p
    +++ echo FAIL=true
    ++ eval FAIL=true
    +++ FAIL=true
    ++ '[' true = true ']'
    ++ exit 1
    root@Synology:/root/temp/go-go1.4/src# 

and ./cmd/dist/dist debugged outputs:


    root@Synology:/root/temp/go-go1.4/src# gdb ./cmd/dist/dist
    dlopen failed on 'libthread_db.so.1' - libthread_db.so.1: cannot open shared object file: No such file or directory
    GDB will not be able to debug pthreads.

@minux
Copy link
Member

minux commented Feb 7, 2015 via email

@minux
Copy link
Member

minux commented Feb 8, 2015

That's weird. cmd/dist/dist in Go 1.4 shouldn't link to libpthread
at all.

what's the output of ldd cmd/dist/dist?

@Stefan-Code
Copy link
Author

So, running it under gdb like you suggested outputs:


        root@Synology:/root/temp/go-go1.4/src# gdb --args ./cmd/dist/dist env -p
    dlopen failed on 'libthread_db.so.1' - libthread_db.so.1: cannot open shared object file: No such file or directory
    GDB will not be able to debug pthreads.
    GNU gdb 6.8
    Copyright (C) 2008 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later 
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
    and "show warranty" for details.
    This GDB was configured as "i686-linux-gnu"...
    (gdb) run
    Starting program: /root/temp/go-go1.4/src/cmd/dist/dist env -p
    Program received signal SIGSEGV, Segmentation fault.
    0x080e1643 in ?? ()
    (gdb)

Unfortunately I don't have access to ldd because it's not installed on the Synology boxes and not in any package i can easily install so I'd have to build that one from source too...
Thanks for your help.

@minux
Copy link
Member

minux commented Feb 8, 2015

Try compile the dist program with debugging symbols:
gcc -O0 -Wall -Werror -ggdb -o cmd/dist/dist -Icmd/dist '-DGOROOT_FINAL="/root/temp/go-go1.4"' cmd/dist/*.c

and then run gdb again.

Use bt to get the full stack trace.

@Stefan-Code
Copy link
Author

Ok, now it says:


    Starting program: /root/temp/go-go1.4/src/cmd/dist/dist env -p
    Program received signal SIGSEGV, Segmentation fault.
    0x080e0dd3 in ?? ()
    (gdb) bt
    #0  0x080e0dd3 in ?? ()
    #1  0x08053ce0 in strstr@@GLIBC_2.0 ()
    #2  0xb77c46b0 in ?? ()
    #3  0x00000001 in ?? ()
    #4  0x00000001 in ?? ()
    #5  0x00000000 in ?? ()
    (gdb)

@mikioh mikioh changed the title Segmentation fault during build boorstrap: segmentation fault during build Feb 8, 2015
@mikioh mikioh changed the title boorstrap: segmentation fault during build bootstrap: segmentation fault during build Feb 8, 2015
@rsc
Copy link
Contributor

rsc commented Apr 10, 2015

I'm sorry, but you must have a bad gcc installed.

All this script does is (effectively) gcc *.c and run the resulting binary. In your case the resulting binary doesn't work. You should look into trying to reduce the test case and report it to your Linux distribution, or (less work) make sure all your compiler and library packages are up to date.

@rsc rsc closed this as completed Apr 10, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants