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: OSX internal linker generates invalid App store executable #6198

Open
gopherbot opened this Issue Aug 20, 2013 · 5 comments

Comments

Projects
None yet
4 participants
@gopherbot

gopherbot commented Aug 20, 2013

by rustf3:

What steps will reproduce the problem?
   > go build hello  (hello world will do)
   > otool -l hello | grep LC_  (compare this output with valid output below)
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_UNIXTHREAD
      cmd LC_SYMTAB
      cmd LC_DYSYMTAB
      cmd LC_LOAD_DYLINKER

The OSX executable produced is fine except that it will be rejected if submitted to the
Mac App Store.  The error that comes back after submitting the app is:

    "Missing DWARF data - Your app does not include DWARF data with architecture information in
     Contents/MacOS/Bampf . In your Xcode build settings, ensure that the debug information is set
     to "DWARF with dSYM" and that the list of valid architectures does not include PPC." 

What is the expected output?
    A workaround is to use the external linker as follows:
   > go build -ldflags "-linkmode=external" hello.go 
   > otool -l hello | grep LC_
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_SEGMENT_64
      cmd LC_DYLD_INFO_ONLY
      cmd LC_SYMTAB
      cmd LC_DYSYMTAB
      cmd LC_LOAD_DYLINKER
      cmd LC_UUID                               <-- needed for Mac App Store?
      cmd LC_VERSION_MIN_MACOSX
      cmd LC_SOURCE_VERSION
      cmd LC_MAIN
      cmd LC_LOAD_DYLIB
      cmd LC_FUNCTION_STARTS
      cmd LC_DATA_IN_CODE
      cmd LC_DYLIB_CODE_SIGN_DRS

What do you see instead?
   The golang internal linker produces OSX executables that can be packaged signed, and self distributed.  Ideally it would also produce OSX executables that could be submitted to the App store by creating output similar to the native OSX gcc/ld.

Which compiler are you using (5g, 6g, 8g, gccgo)?
  6g

Which operating system are you using?
  OS X 10.8.4 (12E55)

Which version are you using?  (run 'go version')
   go version go1.1.2 darwin/amd64 (also happens with go1.1.1)

Please provide any additional information below.
   This problem appears similar in nature to https://golang.org/issue/5238 where the external linker was used to produce system specific fields in the binary.
@robpike

This comment has been minimized.

Contributor

robpike commented Aug 20, 2013

Comment 1:

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@rsc

This comment has been minimized.

Contributor

rsc commented Sep 9, 2013

Comment 3:

We don't know from the report exactly why the App Store is rejecting the binaries, and
some of these could be a fair amount of work. The workaround for now should be to use
-linkmode=external. Good thing we have that!
There will be more linker work in Go 1.3.
Russ

Labels changed: added go1.3maybe, removed go1.2maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 4, 2013

Comment 4:

Labels changed: added release-none, removed go1.3maybe.

@rsc

This comment has been minimized.

Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added repo-main.

@james4k

This comment has been minimized.

Contributor

james4k commented Aug 5, 2014

Comment 6:

Were you successful in the end? Would be great to know that there are no blocking issues
for getting on the App Store.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015

@rsc rsc changed the title from cmd/ld: OSX internal linker generates invalid App store executable to cmd/link: OSX internal linker generates invalid App store executable Jun 8, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment