Skip to content

x/mobile: gomobile bind produces broken xcframework when used with Xcode 14 #55028

@darrarski

Description

@darrarski

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

$ go version
go version go1.17.13 darwin/arm64

Does this issue reproduce with the latest release?

Yes

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

go env output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/darrarski/Library/Caches/go-build"
GOENV="/Users/darrarski/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/darrarski/.go-1.17/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/darrarski/.go-1.17"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/opt/[email protected]/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/opt/[email protected]/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.17.13"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bh/t75dvhh939lbvnsq6n60mgtr0000gn/T/go-build1822123435=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I tried to build xcframework for iOS/macOS using Xcode 14 (14A309) developer tools with the following command:

$ gomobile bind -target ios,iossimulator,macos gitlab.com/elixxir/client/bindings

What did you expect to see?

I expected the command to create xcframework that can be used from iOS/macOS applications.

What did you see instead?

When trying to compile the iOS/macOS application that uses the resulting xcframework, following error occurs:

Undefined symbols for architecture arm64:
  "_objc_msgSend$initWithObject:", referenced from:
      -[RefTracker assignRefnumAndIncRefcount:] in Bindings(000007.o)
  "_objc_msgSend$setObject:forKeyedSubscript:", referenced from:
      -[RefTracker assignRefnumAndIncRefcount:] in Bindings(000007.o)
  "_objc_msgSend$intValue", referenced from:
  ...
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I truncated the output because it just lists all functions and methods that gomobile exposes from go to Objective-C.

When creating the same xcframework with Xcode 13.4.1, everything works fine, without any issues.

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