-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/link: darwin_amd64: running dsymutil failed: signal: segmentation fault #26237
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
Comments
CC @thanm Can you check whether this is fixed in the 1.11beta1 beta release? Thanks. |
Hi @pcman312 -- I'd like to take a closer look at this, but I'm not sure there is much I can do without a stand-alone reproducer. Perhaps you could share an example with the same imports even if it doesn't cause the crash? Also worth mentioning: folks have seen DWARF problems with older versions of Xcode, for example in $ xcodebuild -version Thanks. |
I'm not sure how much of this I can share since it's proprietary code dealing with our database unfortunately. I should be able to put something together that has the same dependency tree, just no functional contents if that works. |
This is very unlikely to help, sorry. DWARF problems of this sort can be tricky to reproduce. |
No kidding. I was just looking through it to try to narrow it down to a smaller program that I could share and discovered a couple other dependencies that when removed makes the compile error disappear. Do you have any recommendations for things I can do to try to reproduce this for you? |
I have a version of this that I can share that reproduces the error. I haven't been able to get this to reduce any further: I confirmed this by having a coworker try to compile it and he got the same error. When I mess around with the imports in |
Interesting further investigation: I had another engineer who did not have Go set up on his computer try building that test and his succeeded. That suggests there is some difference between my local version of either of the two libraries in question. I will upload copies of my local versions to the |
Thanks for creating the reproducer. So far I can't reproduce the dsymutil crash on my mac with either 1.10.3 or the 1.11 beta candidate... I'll keep poking around at it to see what I can figure out. |
I've uploaded copies of those two libraries to the |
SGTM. |
I uploaded my local copy of
The first engineer (whom can reproduce this error) is on the same version of OSX and clang. Their versions of xcodebuild are different (can reproduce - |
I'm running Xcode 9.4 Build version 9F1027a, so in theory my machine should have the same setup as yours. Hmm. One other shot in the dark: generated DWARF is sensitive to the length of pathnames. If you could please send me the number of characters in your GOPATH and/or GOROOT settings, I can try to replicate them in my setup. E.g. $ go env GOPATH here length = 17 chars. |
My xcode is giving me an error when I ask for a version, but the engineer who can reproduce the error has version 9.2, not 9.4. The length of my path to the
The path to the top of the service in question is 58 characters. From there it goes to Obligatory relevant XKCD: https://m.xkcd.com/688/ Edit: |
I recreated my environment using GOPATH/GOROOT directories with string lengths that match your setup -- still can't reproduce the issue on my system (no dsymutil errors). I am mostly out of ideas at this point. |
Is it possible for you to downgrade clang to 9.0.0? I'm going to try to find some other computers with 9.0.0 installed and see if it reproduces on those machines. |
OK, now I think we're finally getting somewhere. I downgraded Xcode on my machine to 9.0.1, and I am finally able to trigger the dsymutil crash. I ran the link with "go build -x -work -ldflags="-v -tmpdir=/tmp/xxx", then picked apart the intermediate objects. It looks like the DWARF in /tmp/xxx/go.o is bad... running dwarf-check on it I get:
I'll have to look more closely, but at this point it certainly looks like a compiler bug, probably something similar to #23374. More to come later. |
That's excellent news! I've been trying to gather as much data as I can on my side regarding versions and so far I've gotten 6 people on 9.1.0 and 3 people on 9.0.0. All of the 9.1.0's have built successfully while 9.0.0 has failed. Edit: Also someone with 8.1.0 got the segfault as well |
I have a fix for this that I will be sending shortly. The construct that is triggering this bug is a package import whose terminal directory contains a "." character. Within the compiler such package paths are canonicalized to mangled/hide the dot (this mangling is not supposed to be exposed to the user, it's simply something to make symbol handling easier); the bug was that part of the DWARF generation code wasn't canonicalizing an import path where it was supposed to, which later on triggered an inconsistency in the DWARF. |
Change https://golang.org/cl/123036 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes. I was originally on
10.2
but upgraded to10.3
to see if a fix already existed and the issue persisted.What operating system and processor architecture are you using (
go env
)?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 importsES "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:
When I pulled in the olivere library and compiled it, I got this error:
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:
This import segfaults as above:
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:
Also succeeds:
Fails:
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.
The text was updated successfully, but these errors were encountered: