go get fatal error: runtime: bsdthread_register error (unset DYLD_INSERT_LIBRARIES)

672 views
Skip to first unread message

蜗牛

unread,
Sep 29, 2015, 8:33:17 AM9/29/15
to golang-nuts
hi guys:

I come across fatal error when execute go get golang.org/x/net/http2 on mac osx 10.10.5 with go 1.5.1 installed, error message:

fatal error: runtime: bsdthread_register error (unset DYLD_INSERT_LIBRARIES)

runtime stack:
runtime.throw(0x4641c0, 0x3f)
/usr/local/Cellar/go/1.5.1/libexec/src/runtime/panic.go:527 +0x90 fp=0x7fff5fbfe3f0 sp=0x7fff5fbfe3d8
runtime.goenvs()
/usr/local/Cellar/go/1.5.1/libexec/src/runtime/os1_darwin.go:71 +0x74 fp=0x7fff5fbfe418 sp=0x7fff5fbfe3f0
runtime.schedinit()
/usr/local/Cellar/go/1.5.1/libexec/src/runtime/proc1.go:60 +0x83 fp=0x7fff5fbfe460 sp=0x7fff5fbfe418
runtime.rt0_go(0x7fff5fbfe498, 0x1d, 0x7fff5fbfe498, 0x0, 0x0, 0x1d, 0x7fff5fbfe788, 0x7fff5fbfe7c0, 0x7fff5fbfe7c3, 0x7fff5fbfe81f, ...)
/usr/local/Cellar/go/1.5.1/libexec/src/runtime/asm_amd64.s:109 +0x132 fp=0x7fff5fbfe468 sp=0x7fff5fbfe460


$ go version
go version go1.5.1 darwin/amd64

$ go env
GOARCH="amd64"
GOBIN="/Users/Neo/go_projects/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Neo/go_projects"
GORACE=""
GOROOT="/usr/local/opt/go/libexec"
GOTOOLDIR="/usr/local/opt/go/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT=""
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

$ xcodebuild -version
Xcode 7.0
Build version 7A220

the same error also occured when execute go get golang.org/x/tools/imports, I can not figure out why it happened and how to resolve it 

Dave Cheney

unread,
Sep 29, 2015, 8:40:50 AM9/29/15
to golang-nuts
Do you have any sort of AV software installed on your laptop ? This is the usual cause of this error.

Dave Cheney

unread,
Sep 29, 2015, 8:42:36 AM9/29/15
to golang-nuts
Also, it looks like you have set GOROOT. Please unset GOROOT, it is not necessary to set GOROOT. Please also check that the version of Go you are using is the one you expect, ie you may have multiple installs, one in  /usr/local/Cellar/go/1.5.1/ from homebrew, and another in /usr/local/opt/go.

蜗牛

unread,
Sep 30, 2015, 3:12:35 AM9/30/15
to golang-nuts
I did not have any sort of AV software installed, after unset GOROOT, the go env return:
$ go env
GOARCH="amd64"
GOBIN="/Users/Neo/go_projects/bin"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Neo/go_projects"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.5.1/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.5.1/libexec/pkg/tool/darwin_amd64"
GO15VENDOREXPERIMENT=""
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"
CXX="clang++"
CGO_ENABLED="1"

I execute "go install golang.org/x/tools/importsyesterday later and then every thing goes fine, meanwhile I noticed that env var exported in ~/.bash_profile:
    export GOROOT=/usr/local/opt/go/libexec/
    export GOPATH=$HOME/go_projects
    export GOBIN=$GOPATH/bin
    export GOPKG=$GOPATH/pkg
    export PATH=$PATH:$GOBIN:$GOROOT/bin
then changed to:
    export GOROOT=/usr/local/opt/go/libexec/
    export GOPATH=$HOME/go_projects
    export GOBIN=$GOPATH/bin
    export GOPKG=$GOPATH/pkg
    export PATH=$PATH:$GOROOT/bin:$GOBIN

after that the go get worked, every thing goes fine! 

thanks anyway for your reply!

在 2015年9月29日星期二 UTC+8下午8:42:36,Dave Cheney写道:

minux

unread,
Sep 30, 2015, 3:12:51 AM9/30/15
to 蜗牛, golang-nuts
On Tue, Sep 29, 2015 at 1:05 AM, 蜗牛 <qingsh...@gmail.com> wrote:
I come across fatal error when execute go get golang.org/x/net/http2 on mac osx 10.10.5 with go 1.5.1 installed, error message:

fatal error: runtime: bsdthread_register error (unset DYLD_INSERT_LIBRARIES)
Have you set $DYLD_INSERT_LIBRARIES ?
If yes, please unset it (you probably use that to set a transparent socks proxy), but
it's incompatible with pure Go programs (those that don't use cgo) for technical reasons.
(Or you can force external linking with -ldflags '-linkmode external' and reinstall Go so
that each binary is dynamic linked. For example, use this to reinstall all Go commands:
DYLD_INSERT_LIBRARIES="" go install -a -v -ldflags '-linkmode external' cmd

蜗牛

unread,
Oct 17, 2015, 2:48:31 AM10/17/15
to golang-nuts, qingsh...@gmail.com
thanks minux, I need to use proxychains as a transparent socks proxy to use go get sometimes becauseof China's Firewall ! I switched the way the proxy is used, then go get works,  every thing goes fine!  Thanks. 

在 2015年9月30日星期三 UTC+8下午3:12:51,minux写道:

danie...@gmail.com

unread,
Nov 22, 2015, 11:01:07 PM11/22/15
to golang-nuts, qingsh...@gmail.com
Hi 蜗牛, 

I also encounter this problem with proxychains. When I uninstall proxychains but it doesn't work. Would you share the detail how you resolve this problem? thank you very much!

danie...@gmail.com

unread,
Nov 22, 2015, 11:01:41 PM11/22/15
to golang-nuts, qingsh...@gmail.com
Hi 蜗牛,  I also encounter the problem with proxychains, I uninstall proxychains but it doesn't work. Would you share how to resolve this problem? Thank you very much!


On Saturday, October 17, 2015 at 2:48:31 PM UTC+8, 蜗牛 wrote:

minux

unread,
Dec 3, 2015, 3:46:14 AM12/3/15
to danie...@gmail.com, golang-nuts
On Sun, Nov 22, 2015 at 7:30 AM, <danie...@gmail.com> wrote:
I also encounter this problem with proxychains. When I uninstall proxychains but it doesn't work. Would you share the detail how you resolve this problem? thank you very much!

You probably need to unset $DYLD_INSERT_LIBRARIES.
Reply all
Reply to author
Forward
0 new messages