-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/link: c-archive iOS App Store submissions fail without -w #31022
Comments
CL 111275 you linked to only disables DWARF combining for buildmode=exe, which is what gomobile's build_iosapp.go is generating. For c-archive, Xcode is supposed to split the DWARF from the archive during its build. |
The issue occurs when I try to "recompile from bitcode" in Xcode's Organizer with an archived ipa. If I disable __asm then I have to disable bitcode, in which case I can't attempt to "recompile from bitcode" anymore. |
Yes, but your initial problem was the error email from Apple. I'm trying to work why -w is needed. If it is needed because of the __asm section and bitcode then we'll just do -w by default. If not, then I'd like to figure out what else could cause the problem. Including DWARF in object files and archives shouldn't be a problem. The special Apple dwarf splitting happens for executables. |
Since the apple email mentions app thinning, I'm pretty sure a bitcode=off build won't trigger it. But I will try uploading a build with bitcode off but __asm included to see what happens. It would be nice to be able to emit debug information for the golang code. I'm guessing the dwarf format it expects for asm is slightly different? I will poke at the generated sections and see if I notice anything different between real assembled objects vs go.o |
Stack traces on mobile is #22716. |
I disabled bitcode on my project, removed the
It seems something about the combination of __asm and DWARF in the go.o object causes the entire app object to end up with broken debug symbols. Previously I was using fastlane to upload my builds and not Xcode, so just to make sure I re-enabled bitcode (still without The underlying problem seems the same, it just depends on where the symbol extraction is happening. If you force it locally with bitcode recompile or non-bitcode build you can see the error right away, but if you upload a bitcode build it happens on Apple's servers and errors out the same way there. Unfortunately it seems like now that we're emitting __asm unconditionally, it's not possible to submit either bitcode or non-bitcode builds as long as DWARF generation for go.o is enabled. |
For reference, here's what
vs for
It's a bit strange that
|
Can you try removing the __asm generating code from Go just to make sure that's the reason -w doesn't work? |
Good idea! I removed just the with the logs showing:
So clearly this is not related to the __asm bit and something else is going on. I will try go1.12 next to see if it has the same behavior. |
Same thing, I can't get it working at all on go1.12.1 unless I add I also tried go1.11.6 and it has the same behavior. Since this is my first time trying to use golang on iOS/tvOS I'm not sure if this ever worked in the past. |
So here's a simple test that shows that the
|
I got a tip on twitter that the newly release Xcode 10.2 might help: https://twitter.com/MarkVillacampa/status/1110309609464455169?s=20 Unfortunately there was no difference. The behavior of
and when I try uploading from Xcode I get the same "Symbols tool failed". |
I don't see you're using GOARCH so it seems to me this won't even work for macOS programs; I suppose submitting to the macOS App Store will probably also fail without -w? |
Correct, the issue affects all mach-o objects linked by golang regardless of architecture or OS.
What's interesting is that I'm not sure how best to proceed from here, either. I can try opening a radar with apple to see if they have any insights. It might be worth trying to disable SIP and running |
Same here :(,have any luck with that ? |
@tmm1 what are the downsides to using |
You lose debug information. However its unclear if the debug symbols were being used in the first place, so there may be no practical downside. |
@eliasnaur I was able to make diff --git a/src/cmd/link/internal/ld/macho.go b/src/cmd/link/internal/ld/macho.go
index d13857081a..3cd118942d 100644
--- a/src/cmd/link/internal/ld/macho.go
+++ b/src/cmd/link/internal/ld/macho.go
@@ -560,7 +560,7 @@ func Asmbmacho(ctxt *Link) {
ms = newMachoSeg("", 40)
ms.fileoffset = Segtext.Fileoff
- if ctxt.Arch.Family == sys.ARM || ctxt.BuildMode == BuildModeCArchive {
+ if ctxt.Arch.Family == sys.ARM /*|| ctxt.BuildMode == BuildModeCArchive*/ {
ms.filesize = Segdata.Fileoff + Segdata.Filelen - Segtext.Fileoff
} else {
ms.filesize = Segdwarf.Fileoff + Segdwarf.Filelen - Segtext.Fileoff AFAICT this is all legacy workaround code and the whole if block can probably be removed. |
Great! Does it fix #28997 as well? Can you submit your change as a CL? As a test you can add the |
Hmm, so with my patch above, However what's strange.. if I build with
If I build without
The behavior is the opposite of what I would expect, and indicates that something is still not quite right in our mach-o generation. |
I sent a CL so we can see how the trybots react to the change. |
Change https://golang.org/cl/170377 mentions this issue: |
Change https://golang.org/cl/170451 mentions this issue: |
According to the I am at a loss as to why the DWARF data is not being parsed correctly (especially since
|
I have opened a technical support incident (TSI) with Apple about this issue, as well as detailed the problem in rdar://49599876. They are forwarding to the relevant teams/developers and hopefully we can get some insight into what's wrong with our generated mach-o objects. |
I heard back on my TSI!!
|
I confirmed that the following change makes diff --git a/src/cmd/internal/dwarf/dwarf.go b/src/cmd/internal/dwarf/dwarf.go
index df80039063..b0349a15bc 100644
--- a/src/cmd/internal/dwarf/dwarf.go
+++ b/src/cmd/internal/dwarf/dwarf.go
@@ -434,7 +434,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
{DW_AT_low_pc, DW_FORM_addr},
{DW_AT_high_pc, DW_FORM_addr},
{DW_AT_call_file, DW_FORM_data4},
- {DW_AT_call_line, DW_FORM_udata},
+ //{DW_AT_call_line, DW_FORM_udata},
},
},
@@ -446,7 +446,7 @@ var abbrevs = [DW_NABRV]dwAbbrev{
{DW_AT_abstract_origin, DW_FORM_ref_addr},
{DW_AT_ranges, DW_FORM_sec_offset},
{DW_AT_call_file, DW_FORM_data4},
- {DW_AT_call_line, DW_FORM_udata},
+ //{DW_AT_call_line, DW_FORM_udata},
},
},
I tried changing the |
Can you open a new issue or amend #28997? You could also CC someone from the the Go team with DWARF knowledge. |
…Store Passing test that shows Apple's symbols utility can now read DWARF data in go.o, after the fix in CL174538 Updates #31022 #22716 #31459 Change-Id: I56c3517ad6d0a9f39537182f63cef56bb198aa83 Reviewed-on: https://go-review.googlesource.com/c/go/+/170451 Reviewed-by: Than McIntosh <[email protected]>
@steeve i'm excited that symbols will now work properly based on that first commit, and bitcode support on the whole. Do we yet know when this will land in a release build? |
@rudyrichter I believe everything will be in 1.13 |
I've been using the new golang patches on master for a few days and have been able to run my golang code in the simulator and on tvOS/iOS devices. (Note that I am still using
go
directly to generatelib.a
as outlined above instead of leveraging gomobile).Now I'm trying to submit an app to the store and running into some weird issues. When submitting to the App Store, I get an email saying processing was stopped:
I tried the debugging steps linked in the Tech Note to "rebuild from bitcode" in Xcode, and am getting a strange error about dSYMs missing in
IDEDistributionPipeline.log
:I noticed this:
https://github.com/golang/mobile/blob/6621de06e1e9d52c38a8c542770bdbeac9ecfef6/cmd/gomobile/build_iosapp.go#L74-L75
So I tried again with
-ldflags=-w
, and that worked! I assumed that wasn't necessary anymore after bcdbd58 but I guess it is still required.I am now able to submit builds up to App Store:
Originally posted by @tmm1 in #22395 (comment)
The text was updated successfully, but these errors were encountered: