Skip to content
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

cmd/go: build -a: segmentation fault #29183

Closed
two opened this issue Dec 12, 2018 · 8 comments

Comments

Projects
None yet
5 participants
@two
Copy link

commented Dec 12, 2018

What version of Go are you using (go version)?

$ go version
go version go1.10.3 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/work/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/work/gowork"
GORACE=""
GOROOT="/home/work/soft/go"
GOTMPDIR=""
GOTOOLDIR="/home/work/soft/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build300205902=/tmp/go-build -gno-record-gcc-switches"

What did you do?

source code:

package main

import (
	"fmt"
	 _ "github.com/gin-gonic/gin"
)

func main() {
	fmt.Println("Hello, World")
}

when use go build main.go to build the programe, it's work, but use go build -a main.go , when run the programe builded , an error occured: [1] 22468 segmentation fault ./main

What did you expect to see?

hello world

What did you see instead?

[1] 22468 segmentation fault ./main

@ALTree ALTree changed the title go build -a: segmentation fault cmd/go: build -a: segmentation fault Dec 12, 2018

@ALTree

This comment has been minimized.

Copy link
Member

commented Dec 12, 2018

Does this happen with any package, or just with a specific package? If it's the latter, can you share a complete reproducer? Also, go1.10 is quite old. Can you reproduce this with go1.11 or the current tip (to be 1.12)?

@two

This comment has been minimized.

Copy link
Author

commented Dec 14, 2018

Q: Does this happen with any package, or just with a specific package?
A: when I only import "fmt", it works fine; but when i add import _ "github.com/gin-gonic/gin", the error message will appear。
by the way, this error will only appear on some machines。

@ALTree

This comment has been minimized.

Copy link
Member

commented Dec 17, 2018

Thanks for the answer. Honestly this smells like a local issue of the Go installation on the machine where it fails...

I would still like to know this:

Can you reproduce this with go1.11 or the current tip (to be 1.12)?

Since if it's a local issue with the Go installation it'll probably go away with a clean upgrade.

@agnivade

This comment has been minimized.

Copy link
Member

commented Dec 18, 2018

Could you set GOTRACEBACK so that we can investigate the coredump ?

ulimit -c unlimited
GOTRACEBACK=crash ./main
@two

This comment has been minimized.

Copy link
Author

commented Dec 29, 2018

Could you set GOTRACEBACK so that we can investigate the coredump ?

ulimit -c unlimited
GOTRACEBACK=crash ./main

➜ test gdb ./main core.2400
GNU gdb (GDB) 7.11
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
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 "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./main...done.
[New LWP 2400]

warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `./main'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00000000000003a0 in ?? ()
Loading Go Runtime support.
(gdb) bt
#0 0x00000000000003a0 in ?? ()
#1 0x00007f41eeaee694 in _dl_catch_error () from /opt/compiler/gcc-4.8.2/lib64/ld-linux-x86-64.so.2
#2 0x000000318af259e5 in _dl_vdso_vsym () from /lib64/libc.so.6
#3 0x000000318ae1eb2e in _init () from /lib64/libc.so.6
#4 0x00007f41eeaee7cd in call_init.part () from /opt/compiler/gcc-4.8.2/lib64/ld-linux-x86-64.so.2
#5 0x00007f41eeaee8f3 in _dl_init_internal () from /opt/compiler/gcc-4.8.2/lib64/ld-linux-x86-64.so.2
#6 0x00007f41eeae11ca in _dl_start_user () from /opt/compiler/gcc-4.8.2/lib64/ld-linux-x86-64.so.2
#7 0x0000000000000001 in ?? ()
#8 0x00007ffcecbbb610 in ?? ()
#9 0x0000000000000000 in ?? ()
(gdb)

@bcmills

This comment has been minimized.

Copy link
Member

commented Jan 15, 2019

Realistically this is unlikely to be fixed in 1.10, since we still don't know the cause. Please see if you can reproduce it with 1.11.4 or 1.12beta2.

@gopherbot

This comment has been minimized.

Copy link

commented Feb 15, 2019

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@gopherbot gopherbot closed this Feb 15, 2019

@two

This comment has been minimized.

Copy link
Author

commented Mar 11, 2019

use CGO_ENABLED=0 go build -a will be ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.