go: x/mobile: bind framework not found by Xcode
What version of Go are you using (go version)?
$ go version go version go1.13.4 darwin/amd64
Does this issue reproduce with the latest release?
I believe I am on the latest version
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/Users/pontusnt/Library/Caches/go-build" GOENV="/Users/pontusnt/Library/Application Support/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GONOPROXY="" GONOSUMDB="" GOOS="darwin" GOPATH="MY_GO_PATH" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64" GCCGO="gccgo" AR="ar" 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/68/_7g0dkds1zx17wwpnmh6k4wr0000gn/T/go-build239061966=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
gomobile bind -o frameworks/ios/Shared.framework -target=ios
This completed successfully and I got a folder named Shared.Framework with obj-c files.
I drag and drop this into Xcode 11.2.1 (11B500) to use it in my app.
What did you expect to see?
I expected to be able to compile the app and use the framework in my Swift code.
What did you see instead?
The Xcode project no longer compiles, but fails with:
ld: framework not found Shared clang: error: linker command failed with exit code 1 (use -v to see invocation)
I alos tried adding the absolut path to Xcode build setting Framework search paths without success.
Thankful for your help!
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (6 by maintainers)
Commits related to this issue
- cmd/gomobile: use the specified output name for the module name on iOS When the module name in *.modulemap and the framework name don't match, Xcode fails to find the framework. This CL fixes this i... — committed to roderm/mobile by hajimehoshi 4 years ago
- cmd/gomobile: use the specified output name for the module name on iOS When the module name in *.modulemap and the framework name don't match, Xcode fails to find the framework. This CL fixes this i... — committed to imWildCat/go-mobile by hajimehoshi 4 years ago
- cmd/gomobile: use the specified output name for the module name on iOS When the module name in *.modulemap and the framework name don't match, Xcode fails to find the framework. This CL fixes this i... — committed to imWildCat/go-mobile by hajimehoshi 4 years ago
Okey I got it working now! What was causing the issue was probably my use of the name “Shared” when there where no Go package called “shared” in the files I was binding.
If i omit the naming of the output
-oand just bind it, the frameworks gets a different name but this frameworks gets found by Xcode and can be used, awesome!But then a follow up question, is it not possible to name my framework to something custom?
In my case I am binding 3 different Go packages and want to create a single output framework of that. I do this like this:
gomobile bind -target=ios \ services/departure \ services/search \ presentersAnd then the name of the framework becomes
Departure, so I guess it just gets the name of the first package argument I give tobind.So it works but it would be nice to name it something else. And am I doing it right when binding my 3 packages like I do?
Thanks.