Skip to content

x/mobile/cmd/gomobile: issues linking frameworks in Xcode #28517

@taybart

Description

@taybart

What version of Go are you using (go version)?

go: 1.11.1 (also 1.11 and 1.10.3 were tested)
gomobile: master (a27dd33d354d004b2de14a791df5af8a00f68b8e)
Xcode: 10.1 (10B61)

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/taybartski/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/taybarski/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.1/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.1/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/vw/bxwt77n10r90nc1dbrjgt31m0000gn/T/go-build422606684=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

[This was after gomobile/golang/xcode update]

I was successfully using gomobile bind, it seems that something with the build process has changed. I have a .framework that I generated last week that still works, however, the new ones that I create are failing to link in the newest Xcode.

The output below was generated with the example from the wiki. This may be an Xcode issue, but the fact that the old .framework is still compiling makes be think it may be in gomobile.

Looking at the lastest change that happened in gomobile, it seems unlikely that it is that. I am at a loss though. Xcode was updated along with the command line tools. Any insight would be very helpful.

What did you expect to see?

Successful linking of .framework

What did you see instead?

Xcode error:

ld: warning: ignoring file /Users/taybartski/go/src/golang.org/x/mobile/example/bind/ios/Hello.framework/Hello, file is universal (4 slices) but does not contain the x86_64 architecture: /Users/taybartski/go/src/golang.org/x/mobile/example/bind/ios/Hello.framework/Hello
Undefined symbols for architecture x86_64:
  "_HelloGreetings", referenced from:
      -[ViewController loadView] in ViewController.o
ld: symbol(s) not found for architecture x86_64
$ 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions