Maybe? I would appreciate your help in this matter. What is the quickest way to confirm that the change makes sense, doesn't break previous ios related stuff, and get it into the next go release? I don't want to hold things up as I google "change list" with various combinations of "golang", "git" and "submit go patch".
I had thought about raising a golang issue as the next step. Would this make sense? On Monday, October 23, 2017 at 12:31:44 PM UTC-4, Elias Naur wrote: > > Fantastic! Would you like to send this patch as a change list? > > - elias > > On Monday, October 23, 2017 at 6:24:05 PM UTC+2, pru...@gmail.com wrote: >> >> Making the following change fixes the original problem and allows my ios >> apps to be uploaded: >> >> diff --git a/src/cmd/link/internal/ld/lib.go >> b/src/cmd/link/internal/ld/lib.go >> index bd3abbba0a..45642e8ad7 100644 >> --- a/src/cmd/link/internal/ld/lib.go >> +++ b/src/cmd/link/internal/ld/lib.go >> @@ -1105,7 +1105,7 @@ func (ctxt *Link) hostlink() { >> switch ctxt.BuildMode { >> case BuildModeExe: >> if ctxt.HeadType == objabi.Hdarwin { >> - argv = append(argv, "-Wl,-pagezero_size,4000000") >> + argv = append(argv, >> "-Wl,-pagezero_size,100000000") >> } >> case BuildModePIE: >> // ELF. >> >> >> On Monday, October 23, 2017 at 11:54:41 AM UTC-4, pru...@gmail.com wrote: >>> >>> On the off chance that it might be useful, here is some information on >>> the bind example that validated: >>> >>> >>> ~/Library/Developer/Xcode/Archives/2017-10-23/bind 2017-10-23, 11.24 >>> AM.xcarchive/Products/Applications/bind.app: size -x -l -m bind >>> >>> Segment __PAGEZERO: 0x100000000 (vmaddr 0x0 fileoff 0) >>> >>> Segment __TEXT: 0x94000 (vmaddr 0x100000000 fileoff 0) >>> >>> Section __text: 0x8a3e0 (addr 0x1000077e8 offset 30696) >>> >>> Section __stubs: 0x258 (addr 0x100091bc8 offset 596936) >>> >>> Section __stub_helper: 0x270 (addr 0x100091e20 offset 597536) >>> >>> Section __objc_methname: 0xd1a (addr 0x100092090 offset 598160) >>> >>> Section __cstring: 0x412 (addr 0x100092daa offset 601514) >>> >>> Section __objc_classname: 0x8f (addr 0x1000931bc offset 602556) >>> >>> Section __objc_methtype: 0x8e7 (addr 0x10009324b offset 602699) >>> >>> Section __gcc_except_tab: 0x3b8 (addr 0x100093b34 offset 604980) >>> >>> Section __const: 0x8 (addr 0x100093ef0 offset 605936) >>> >>> Section __unwind_info: 0x108 (addr 0x100093ef8 offset 605944) >>> >>> total 0x8c812 >>> >>> Segment __DATA: 0xc4000 (vmaddr 0x100094000 fileoff 606208) >>> >>> Section __got: 0x38 (addr 0x100094000 offset 606208) >>> >>> Section __la_symbol_ptr: 0x190 (addr 0x100094038 offset 606264) >>> >>> Section __mod_init_func: 0x18 (addr 0x1000941c8 offset 606664) >>> >>> Section __cfstring: 0x1e0 (addr 0x1000941e0 offset 606688) >>> >>> Section __objc_classlist: 0x38 (addr 0x1000943c0 offset 607168) >>> >>> Section __objc_protolist: 0x28 (addr 0x1000943f8 offset 607224) >>> >>> Section __objc_imageinfo: 0x8 (addr 0x100094420 offset 607264) >>> >>> Section __objc_const: 0x1710 (addr 0x100094428 offset 607272) >>> >>> Section __objc_selrefs: 0x130 (addr 0x100095b38 offset 613176) >>> >>> Section __objc_classrefs: 0x60 (addr 0x100095c68 offset 613480) >>> >>> Section __objc_superrefs: 0x30 (addr 0x100095cc8 offset 613576) >>> >>> Section __objc_ivar: 0x2c (addr 0x100095cf8 offset 613624) >>> >>> Section __objc_data: 0x230 (addr 0x100095d28 offset 613672) >>> >>> Section __data: 0x5a40 (addr 0x100095f60 offset 614240) >>> >>> Section __rodata: 0x3b7b4 (addr 0x10009b9a0 offset 637344) >>> >>> Section __typelink: 0xa44 (addr 0x1000d7160 offset 880992) >>> >>> Section __itablink: 0x70 (addr 0x1000d7ba8 offset 883624) >>> >>> Section __gosymtab: 0x0 (addr 0x1000d7c18 offset 883736) >>> >>> Section __gopclntab: 0x5156d (addr 0x1000d7c20 offset 883744) >>> >>> Section __noptrdata: 0xcac4 (addr 0x1001291a0 offset 1216928) >>> >>> Section __bss: 0x1c8a0 (addr 0x100135c80 offset 0) >>> >>> Section __common: 0x10 (addr 0x100152520 offset 0) >>> >>> Section __noptrbss: 0x22f8 (addr 0x100152540 offset 0) >>> >>> total 0xc07d5 >>> >>> Segment __LINKEDIT: 0x10000 (vmaddr 0x100158000 fileoff 1277952) >>> >>> total 0x100168000 >>> >>> >>> Compared with the original bios binary that failed with “invalid segment >>> alignment” >>> >>> >>> ~/code/ghub/src/bios/admin/target/ios/Payload (master): size -x -l -m >>> bios.app/bios >>> >>> Segment __PAGEZERO: 0x4000000 (vmaddr 0x0 fileoff 0) >>> >>> Segment __TEXT: 0x144000 (vmaddr 0x4000000 fileoff 0) >>> >>> Section __stubs: 0x204 (addr 0x40069b0 offset 27056) >>> >>> Section __stub_helper: 0x21c (addr 0x4006bb4 offset 27572) >>> >>> Section __text: 0x1381f8 (addr 0x4006dd0 offset 28112) >>> >>> Section __const: 0x58 (addr 0x413efc8 offset 1306568) >>> >>> Section __objc_methname: 0xda1 (addr 0x413f020 offset 1306656) >>> >>> Section __objc_classname: 0x5a (addr 0x413fdc1 offset 1310145) >>> >>> Section __objc_methtype: 0xa0a (addr 0x413fe1b offset 1310235) >>> >>> Section __cstring: 0x3733 (addr 0x4140825 offset 1312805) >>> >>> Section __unwind_info: 0xa4 (addr 0x4143f58 offset 1326936) >>> >>> total 0x13d64c >>> >>> Segment __DATA: 0x13c000 (vmaddr 0x4144000 fileoff 1327104) >>> >>> Section __got: 0x20 (addr 0x4144000 offset 1327104) >>> >>> Section __la_symbol_ptr: 0x158 (addr 0x4144020 offset 1327136) >>> >>> Section __const: 0x80 (addr 0x4144178 offset 1327480) >>> >>> Section __cfstring: 0x80 (addr 0x41441f8 offset 1327608) >>> >>> Section __objc_classlist: 0x10 (addr 0x4144278 offset 1327736) >>> >>> Section __objc_protolist: 0x20 (addr 0x4144288 offset 1327752) >>> >>> Section __objc_imageinfo: 0x8 (addr 0x41442a8 offset 1327784) >>> >>> Section __objc_const: 0xf98 (addr 0x41442b0 offset 1327792) >>> >>> Section __objc_selrefs: 0xf0 (addr 0x4145248 offset 1331784) >>> >>> Section __objc_classrefs: 0x28 (addr 0x4145338 offset 1332024) >>> >>> Section __objc_superrefs: 0x8 (addr 0x4145360 offset 1332064) >>> >>> Section __objc_ivar: 0x14 (addr 0x4145368 offset 1332072) >>> >>> Section __objc_data: 0xa0 (addr 0x4145380 offset 1332096) >>> >>> Section __rodata: 0x6f038 (addr 0x4145420 offset 1332256) >>> >>> Section __typelink: 0x12f4 (addr 0x41b4460 offset 1786976) >>> >>> Section __itablink: 0x2c8 (addr 0x41b5758 offset 1791832) >>> >>> Section __gopclntab: 0x8f0fd (addr 0x41b5a20 offset 1792544) >>> >>> Section __gosymtab: 0x0 (addr 0x4244b1d offset 2378525) >>> >>> Section __noptrdata: 0x109a0 (addr 0x4244b20 offset 2378528) >>> >>> Section __data: 0x72a0 (addr 0x42554c0 offset 2446528) >>> >>> Section __bss: 0x1d1f8 (addr 0x425c760 offset 0) >>> >>> Section __noptrbss: 0x2338 (addr 0x4279960 offset 0) >>> >>> Section __common: 0x1638 (addr 0x427bc98 offset 0) >>> >>> total 0x1392b5 >>> >>> Segment __LINKEDIT: 0x78000 (vmaddr 0x4280000 fileoff 2490368) >>> >>> total 0x42f8000 >>> >>> >>> On Monday, October 23, 2017 at 11:28:13 AM UTC-4, pru...@gmail.com >>> wrote: >>>> >>>> Ok thank you!. Bind does validate after setting ENABLE_BITCODE to NO in >>>> the build settings. >>>> >>>> On Monday, October 23, 2017 at 11:03:51 AM UTC-4, Elias Naur wrote: >>>>> >>>>> To successfully build the bind example you need to disable bitcode >>>>> (and import the framework as you did). Sorry. >>>>> >>>>> - elias >>>>> >>>>> Den man. 23. okt. 2017 17.00 skrev <pru...@gmail.com>: >>>>> >>>>>> Trying bind this time. >>>>>> Not able to build in Xcode with bind example. Xcode can't find the >>>>>> Hello module when following the instructions. Dropping the >>>>>> hello.framework >>>>>> into the ios folder seems to help but leads to the following linker >>>>>> error: >>>>>> >>>>>> ld: '/Users/rust/code/src/ >>>>>> golang.org/x/mobile/example/bind/ios/Hello.framework/Hello(000002.o)' >>>>>> does not contain bitcode. You must rebuild it with bitcode enabled >>>>>> (Xcode >>>>>> setting ENABLE_BITCODE), obtain an updated library from the vendor, or >>>>>> disable bitcode for this target. for architecture arm64 >>>>>> >>>>>> clang: error: linker command failed with exit code 1 (use -v to see >>>>>> invocation) >>>>>> >>>>>> Do the bind instructions from >>>>>> https://github.com/golang/go/wiki/Mobile work for you in Xcode 9? I >>>>>> accepted all Xcode fixes. Is it better to not do this? >>>>>> >>>>>> On Monday, October 23, 2017 at 10:27:24 AM UTC-4, Elias Naur wrote: >>>>>> >>>>>>> >>>>>>> >>>>>>> On Mon, Oct 23, 2017 at 2:09 PM <pru...@gmail.com> wrote: >>>>>>> >>>>>>>> I reproduced the problem using the gomobile bind example with the >>>>>>>> following code changes. >>>>>>>> >>>>>>>> diff --git a/cmd/gomobile/build_iosapp.go >>>>>>>> b/cmd/gomobile/build_iosapp.go >>>>>>>> >>>>>>>> index 0b2a923..8480790 100644 >>>>>>>> >>>>>>>> --- a/cmd/gomobile/build_iosapp.go >>>>>>>> >>>>>>>> +++ b/cmd/gomobile/build_iosapp.go >>>>>>>> >>>>>>>> @@ -31,7 +31,7 @@ func goIOSBuild(pkg *build.Package) >>>>>>>> (map[string]bool, error) { >>>>>>>> >>>>>>>> infoplist := new(bytes.Buffer) >>>>>>>> >>>>>>>> if err := infoplistTmpl.Execute(infoplist, >>>>>>>> infoplistTmplData{ >>>>>>>> >>>>>>>> // TODO: better bundle id. >>>>>>>> >>>>>>>> - BundleID: "org.golang.todo." + productName, >>>>>>>> >>>>>>>> + BundleID: "com.galvanizedlogic.bios", >>>>>>>> >>>>>>>> Name: strings.Title(path.Base(pkg.ImportPath)), >>>>>>>> >>>>>>>> }); err != nil { >>>>>>>> >>>>>>>> return nil, err >>>>>>>> >>>>>>>> @@ -97,7 +97,7 @@ func goIOSBuild(pkg *build.Package) >>>>>>>> (map[string]bool, error) { >>>>>>>> >>>>>>>> // Build and move the release build to the output directory. >>>>>>>> >>>>>>>> cmd = exec.Command( >>>>>>>> >>>>>>>> "xcrun", "xcodebuild", >>>>>>>> >>>>>>>> - "-configuration", "Release", >>>>>>>> >>>>>>>> + "-configuration", "Release", >>>>>>>> "-allowProvisioningUpdates", >>>>>>>> >>>>>>>> "-project", tmpdir+"/main.xcodeproj", >>>>>>>> >>>>>>>> ) >>>>>>>> >>>>>>>> if err := runCmd(cmd); err != nil { >>>>>>>> >>>>>>>> @@ -312,12 +312,14 @@ const projPbxproj = `// !$*UTF8*$! >>>>>>>> >>>>>>>> ORGANIZATIONNAME = Developer; >>>>>>>> >>>>>>>> TargetAttributes = { >>>>>>>> >>>>>>>> 254BB83D1B1FD08900C56DE9 = { >>>>>>>> >>>>>>>> - CreatedOnToolsVersion = 6.3.1; >>>>>>>> >>>>>>>> + CreatedOnToolsVersion = 9.0; >>>>>>>> >>>>>>>> + DevelopmentTeam = 9829M3WGFP; >>>>>>>> >>>>>>>> + ProvisioningStyle = Automatic; >>>>>>>> >>>>>>>> }; >>>>>>>> >>>>>>>> }; >>>>>>>> >>>>>>>> }; >>>>>>>> >>>>>>>> buildConfigurationList = 254BB8391B1FD08900C56DE9 /* Build >>>>>>>> configuration list for PBXProject "main" */; >>>>>>>> >>>>>>>> - compatibilityVersion = "Xcode 3.2"; >>>>>>>> >>>>>>>> + compatibilityVersion = "Xcode 8.0"; >>>>>>>> >>>>>>>> developmentRegion = English; >>>>>>>> >>>>>>>> hasScannedForEncodings = 0; >>>>>>>> >>>>>>>> knownRegions = ( >>>>>>>> >>>>>>>> Then repackaged bios.app and bios.ipa using the binary from the >>>>>>>> gomobile basic.app (avoids a bunch of invalid or missing icon errors). >>>>>>>> Validated that the app runs on an iphone 7. The upload ipa resulted in >>>>>>>> the >>>>>>>> following errors: >>>>>>>> >>>>>>>> >>>>>>>> The "Invalid Bundle" is because gomobile builds a binary with both >>>>>>>> 32 and 64 bit executables. >>>>>>>> I can't explain the PIE error. I did not get this error in the bios >>>>>>>> build even though I saw the "-nopie" when looking at a previous bios >>>>>>>> linker >>>>>>>> debug output. >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> This seems like the "gomobile build" mode, not gomobile bind. There >>>>>>> is a difference: build is for apps in 100% Go, while bind are for apps >>>>>>> where a part is in Go. With gomobile bind, the Go part is built as a >>>>>>> c-archive library and packaged in a framework. I know that you're >>>>>>> interested in the gomobile build mode, but knowing whether gomobile >>>>>>> bind >>>>>>> apps have the same validation errors might help to debug the problem. >>>>>>> >>>>>>> - elias >>>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to a topic in >>>>>> the Google Groups "golang-nuts" group. >>>>>> To unsubscribe from this topic, visit >>>>>> https://groups.google.com/d/topic/golang-nuts/DaCOnoSWvBw/unsubscribe >>>>>> . >>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>> golang-nuts...@googlegroups.com. >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.