Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile: gomobile bind iOS library with bitcode error #43060

Closed
wsvn53 opened this issue Dec 8, 2020 · 2 comments
Closed

x/mobile: gomobile bind iOS library with bitcode error #43060

wsvn53 opened this issue Dec 8, 2020 · 2 comments
Labels
Milestone

Comments

@wsvn53
Copy link

@wsvn53 wsvn53 commented Dec 8, 2020

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

$ go version
go version go1.15.5 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
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/Ethan/Library/Caches/go-build"
GOENV="/Users/Ethan/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/Ethan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/Ethan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.15.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.15.5/libexec/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/fs/1m2nwwm11zn56pfvxrhqwvf00000gn/T/go-build888622441=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Create a simple golang project;
  2. Then, try gomobile bind -v -target=ios/arm64,ios/amd64 . to build iOS target library;
  3. Get failed:
write /var/folders/fs/1m2nwwm11zn56pfvxrhqwvf00000gn/T/gomobile-work-716664106/src/go.mod
go: downloading golang.org/x/mobile v0.0.0-20200801112145-973feb4309de
go: found wsen.me/test in wsen.me/test v0.0.0-00010101000000-000000000000
golang.org/x/mobile/bind/java
runtime/cgo
go build runtime/cgo: invalid flag in go:cgo_ldflag: -fembed-bitcode
gomobile: darwin-arm64: go build -tags ios -v -buildmode=c-archive -o /var/folders/fs/1m2nwwm11zn56pfvxrhqwvf00000gn/T/gomobile-work-716664106/gomobilebitcode-arm64.a ./gobind failed: exit status 1

If I remove line:163 in source file golang.org/x/mobile/cmd/gomobile/env.go: cflags += " -fembed-bitcode", and rebuild gomobile, then try again, it's working properly.

What did you expect to see?

Successfull build iOS library from golang sources without embed-bitcode errror.

What did you see instead?

No

@gopherbot gopherbot added this to the Unreleased milestone Dec 8, 2020
@AlexRouSg
Copy link
Contributor

@AlexRouSg AlexRouSg commented Dec 8, 2020

#42647 (comment)

Looks like the golang.org/x/mobile build sets CGO_LDFLAGS, so this is a dup of #42565. It should be fixe din 1.15.6. Sorry for the trouble.

Please update to 1.15.6 and try again

@toothrot
Copy link
Contributor

@toothrot toothrot commented Dec 8, 2020

Closing as a duplicate, and please try with the latest release and let us know if you have issues.

@toothrot toothrot closed this Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
@toothrot @wsvn53 @AlexRouSg @gopherbot and others