Xcode is not detecting architectures on a gomobile (bind) produced framework

556 Views Asked by At

I have a framework that I produced with gomobile. I have written up most of my detail in this issue. It may have to do with Xcode/ld, but I have a different version of the framework that does compile. I am not sure this is entirely go (although it does seem like it) so I thought I should put a stack overflow q up. The output of file is listed in the issue but I will put it here as well:

$ file Hello.framework/Hello
Hello.framework/Hello: Mach-O universal binary with 4 architectures: [arm_v7:current ar archive] [arm64]
Hello.framework/Hello (for architecture armv7):  current ar archive
Hello.framework/Hello (for architecture i386):   current ar archive
Hello.framework/Hello (for architecture x86_64): current ar archive
Hello.framework/Hello (for architecture arm64):  current ar archive

ld is not happy with the file.

Warning ignoring file ./Hello.framework/Hello, file is universal (4 slices) but does not contain the x86_64 architecture: ./Hello.framework/Hello
1

There are 1 best solutions below

0
On

In my case, the problem appeared because I wanted to free some space on my mac and deleted some of the older deployment target files. Before this, I used to build for iOS development target 10.3 and now, since I deleted those files, I had to build for 12.4.

Calling $(go env GOPATH)/bin/gomobile init before $(go env GOPATH)/bin/gomobile bind worked for me. Probably init scans the files in /Users/<user>/Library⁩/Developer⁩/Xcode⁩/iOS DeviceSupport⁩ and following calls to bind use them correctly.