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

compile error, gomobile bind hello example with -target=ios #31015

Closed
ReboundKay opened this issue Mar 24, 2019 · 11 comments
Closed

compile error, gomobile bind hello example with -target=ios #31015

ReboundKay opened this issue Mar 24, 2019 · 11 comments

Comments

@ReboundKay
Copy link

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

$ go version
go version go1.12 darwin/amd64

Does this issue reproduce with the latest release?

yes, i've updated gomobile to the newest version

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/stargame/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/usr/local/work"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/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/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/go-build681457514=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

gomobile bind -target=ios golang.org/x/mobile/example/bind/hello

gobind

In file included from _cgo_export.c:4:
In file included from go_hellomain.go:10:
In file included from /var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/seq.h:7:
In file included from /var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/seq_darwin.h:10:
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:23:29: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:23:29: note: insert '_Nullable' if the pointer may be null
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:23:29: note: insert '_Nonnull' if the pointer should never be null
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:25:4: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:25:4: note: insert '_Nullable' if the pointer may be null
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:25:4: note: insert '_Nonnull' if the pointer should never be null
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:25:30: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness]
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:25:30: note: insert '_Nullable' if the pointer may be null
/var/folders/hz/vk6pt2sd58z8hnj41p9wntrw0000gn/T/gomobile-work-881160448/src/gobind/Universe.objc.h:25:30: note: insert '_Nonnull' if the pointer should never be null

What did you expect to see?

I would like to see the lib file could be made successfully.

What did you see instead?

the errors above
I wonder if my xcode is not a suitable version for this version of gomobile/gobind .(my xcode version: Version 9.2 (9C40b))
and I want to ask if I can set some build flag to ignore this kind of errors, and how. Thanks.

@ReboundKay ReboundKay changed the title Failed to bind hello example with -target=ios compile error, gomobile bind hello example with -target=ios Mar 25, 2019
@cryptix
Copy link

cryptix commented Mar 26, 2019

I also came here to report error: pointer is missing a nullability type specifier but for me it was introduced by updating to Xcode Version 10.2 (10E125). It worked before using the previous version (all running go1.12).

@DavidCorsha
Copy link

DavidCorsha commented Mar 26, 2019

Seeing this as well with yesterday's release of Xcode 10.2. For now I have just disabled the warning:

diff --git a/cmd/gomobile/env.go b/cmd/gomobile/env.go
index 31878bb..6a8c32c 100644
--- a/cmd/gomobile/env.go
+++ b/cmd/gomobile/env.go
@@ -129,6 +129,7 @@ func envInit() (err error) {
                        panic(fmt.Errorf("unknown GOARCH: %q", arch))
                }
                cflags += " -fembed-bitcode"
+               cflags += " -Wno-nullability-completeness"
                if err != nil {
                        return err
                }

@ReboundKay
Copy link
Author

@DavidCorsha
@cryptix
Thanks!! This works well.

@whoerau
Copy link

whoerau commented Mar 27, 2019

@ReboundKay @DavidCorsha
I did as DavidCorsha said
and "go install golang.org/x/mobile/cmd/gomobile"
it works
thank you very much

@halseth
Copy link

halseth commented Mar 27, 2019

I'm also seeing this after upgrading to Xcode 10.2.

@ReboundKay Maybe keep the issue open until it is fixed in gomobile? :)

@prcela
Copy link

prcela commented Mar 27, 2019

I did as @DavidCorsha said. The Api.framework has been built successfully with gomobile and I put it in the xcode project. But, xcode compilation has failed with following error:

ld: '.../Api.framework/Api(go.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64

I suspect it could be because I am using go minor version 1.12.1 instead of building go from source code from master branch. https://golang.org/doc/install/source

@cryptix
Copy link

cryptix commented Mar 27, 2019

Different issue but you can disable bitcode in your project settings as well.

@prcela
Copy link

prcela commented Mar 29, 2019

As I supposed the error was because the non latest version of go language.
I have edited env.go, installed the latest source version of go and gomobile with:

brew install go --HEAD
go install golang.org/x/mobile/cmd/gomobile
gomobile bind -target=ios  -v myApi

After that, the xcode project is properly built with enabled bitcode

@halseth
Copy link

halseth commented Apr 5, 2019

I re-opened this here, as I'm still seeing it: #31284

@constantinevassil
Copy link

As I supposed the error was because the non latest version of go language.
I have edited env.go, installed the latest source version of go and gomobile with:

brew install go --HEAD
go install golang.org/x/mobile/cmd/gomobile
gomobile bind -target=ios  -v myApi

After that, the xcode project is properly built with enabled bitcode

Hw do you use the --HEAD version when you
perform gomobile bind -target=ios -v myApi?

@fanktom
Copy link

fanktom commented Jun 6, 2019

@prcela Thanks for your help. Unfortunately I'm unable to find any information on which version of go is required to enable bitcode support.

Can anybody elaborate why this is dependent on the go version?
And, is there a setting to tweak the ENABLE_BITCODE during a gomobile bind?

@golang golang locked and limited conversation to collaborators Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants