Open
Description
What version of Go are you using (go version
)?
$ go version go version go1.12.6 darwin/amd64
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 GOARCH="amd64" GOBIN="" GOCACHE="/Users/myname/Library/Caches/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="darwin" GOOS="darwin" GOPATH="/Users/myname/go" GOPROXY="" GORACE="" GOROOT="/usr/local/opt/go/libexec" GOTMPDIR="" GOTOOLDIR="/usr/local/opt/go/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/cy/b0lrq2m55js29jlf_hhm4xtc0000gn/T/go-build880588199=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
I created a go package and used gomobile to bind it for iOS:
gomobile bind -v -target=ios mypackage
And then referenced the framework in my iOS project
Then complied the iOS project
What did you expect to see?
The project should compile
What did you see instead?
error messge
ld: in /PATH_TO_THE_FRAMEWORK(go.o), building for iOS, but linking in object file (/PATH_TO_THE_FRAMEWORK(go.o)) built for , for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
[-]x/mobile: [/-][+]x/mobile: iOS project won't compile with framework built by gomobile[/+]bcmills commentedon Jul 3, 2019
CC @steeve @hyangah
bcmills commentedon Jul 3, 2019
Please provide more concrete steps to reproduce the failure. What commands did you run to compile the project? Which command specifically produced the observed error message?
steeve commentedon Jul 3, 2019
Is the problem in Xcode or
gomobile build
?@ibigbug, can you please provide a sample project ?
cc @eliasnaur
ibigbug commentedon Jul 3, 2019
Thanks guys for prompt reply.
I created a sample reproduce here https://github.com/ibigbug/SampleGomobile and put the steps in the README file.
A bit more information might be helpful, I'm using the latest Xcode beta. and it worked with an older version of gomobile, it compiles, but output of that version of gomobile doesn't have bitcode, so I upgraded to the latest gomobile and see this issue.
ibigbug commentedon Jul 5, 2019
ping @steeve @bcmills
I'm using buildmode with c-archive to workaround this, but would be great to know how to fix this
bcmills commentedon Jul 8, 2019
@ibigbug, this issue has the
help wanted
label because the solution is not obvious to me, and I don't know of anyone on the Go project who has the available bandwidth to look into it.steeve commentedon Jul 9, 2019
I believe this is linked to golang/mobile@9487ef5
You can either:
ibigbug commentedon Jul 20, 2019
thanks @steeve
Using go1.13beta is and manually passing
CGO_FLAGS
with-fembed-bitcode
worked for me.Though I'm building c-archive directly via
go build
, I haven't tried gomobile again, but I assume it would also work.ibigbug commentedon Jul 21, 2019
I'm trying to switch back to standard
gomobile
, however I don't seem to find doc saying how use a particular go version for gomobile.I tried:
Can someone point me to a way to upgrade go version for gomoible?
Found similar one #24389
ibigbug commentedon Jul 21, 2019
cc @steeve @bcmills