Skip to content

cmd/link: darwin_amd64: running dsymutil failed: signal: segmentation fault #26237

@pcman312

Description

@pcman312

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

$ go version
go version go1.10.3 darwin/amd64

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G1114

$ clang --version
Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

Does this issue reproduce with the latest release?

Yes. I was originally on 10.2 but upgraded to 10.3 to see if a fix already existed and the issue persisted.

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

$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE=[snip]
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH=[snip]
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1n/x7xttf9n7ylbl8vn50830dsh6qmzqb/T/go-build029428003=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do? / What did you expect to see? / What did you see instead?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

We have a REST service that accesses an elasticsearch database. In the main it imports a package in the service that accesses ES (.../db/elastic). That sub-package imports ES "gopkg.in/olivere/elastic.v3". I'm refactoring some things around and pulled that library into the main in addition to the sub-package.

We format our imports like this:

[stdlib]

[not-our code - this is where the olivere library is]

[our code - both this service as well as any internal libraries we are using]

When I pulled in the olivere library and compiled it, I got this error:

/usr/local/go/pkg/tool/darwin_amd64/link: /usr/local/go/pkg/tool/darwin_amd64/link: running dsymutil failed: signal: segmentation fault

I've been playing around with it to try to narrow down what's causing it and so far I've been able to narrow my suspicions down to the order of imports.

This import successfully builds:

[other external imports]

ES "gopkg.in/olivere/elastic.v3"
".../db/elastic"
[other service/internal imports]

This import segfaults as above:

[other external imports]
ES "gopkg.in/olivere/elastic.v3"

".../db/elastic"
[other service/internal imports]

If I put the olivere import in a separate block (newlines around it), it seems to have to be strictly after the service import .../db/elastic:

Succeeds:

[other imports]

".../db/elastic"

ES "gopkg.in/olivere/elastic.v3"

[other imports]

Also succeeds:

[other imports]

// The order doesn't matter if they don't have newlines between them
ES "gopkg.in/olivere/elastic.v3"
".../db/elastic"

[other imports]

Fails:

[other imports]

ES "gopkg.in/olivere/elastic.v3"

".../db/elastic"

[other imports]

I've been trying to build a standalone program that I can reproduce this in, but so far I have been unsuccessful. When I pull out the code in question to a sandbox program, I am unable to reproduce it. It's possible that some other import is playing some sort of role, but I haven't been able to narrow it down because it does not seem to matter where I put the two imports as long as they are in the same block (without newlines between them) or are in a specific order.

Also worth noting: when I do a cross compile to linux, this succeeds regardless of how I organize the imports.

The behavior seems very similar to #23374 but I don't know if it's related beyond using the same compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions