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+unsubscr...@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.

Reply via email to