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: No type or protocol named 'goSeqRefInterface' #24343

Closed
alvatar opened this issue Mar 10, 2018 · 6 comments
Closed

x/mobile: No type or protocol named 'goSeqRefInterface' #24343

alvatar opened this issue Mar 10, 2018 · 6 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@alvatar
Copy link

alvatar commented Mar 10, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/alvatar/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/alvatar/go/"
GORACE=""
GOROOT="/Users/alvatar/go/go1.10"
GOTMPDIR=""
GOTOOLDIR="/Users/alvatar/go/go1.10/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
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/mf/9y9xgfm910lg169q75sp1f5w0000gn/T/go-build610131228=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Generate Go bindings with gomobile bind -target ios <package>, then import it, configure it, and call any of the Go functions from ObjC

What did you expect to see?

A correct build

What did you see instead?

Universe.objc.h:22:37: No type or protocol named 'goSeqRefInterface'

The solution was to include
#include "ref.h"
in Universe.objc.h, so I suppose the fix is just to add this to the code generator?

@gopherbot gopherbot added this to the Unreleased milestone Mar 10, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Mar 10, 2018
@eliasnaur
Copy link
Contributor

Can you provide more specific steps to reproduce the problem? On my setup (mac mini, macOS 10.13, Xcode 9.2), this works and produces a Hello.framework:

$ go get -u golang.org/x/mobile/cmd/... && gomobile bind -target=ios golang.org/x/mobile/example/bind/hello

@alvatar
Copy link
Author

alvatar commented Mar 16, 2018

Thanks @eliasnaur .
The generation works well, but just importing (in your case “Headers/Hello.h”) won’t be enough, you need to import ref.h too. This is minor, but I suspect it should be imported in Universe.objc.h instead, and be done already by the generated code.

@eliasnaur
Copy link
Contributor

Are you importing with the module form: @import Hello? In any case, with current gomobile, replacing @import Hello with #include "Hello/Hello.h" in the golang.org/x/mobile/example/bind/hello project still works for me.

@alvatar
Copy link
Author

alvatar commented Mar 16, 2018

I was importing with #include .... That fails for me.
However, replacing that with the @import form fixes it without the need to manually include "ref.h".
Sorry, I'm actually pretty new to ObjC.
Thank you @eliasnaur !

@Neurrone
Copy link

I ran into this too while trying to auto generate c# API definitions for a go package framework generated with gomobile, and adding the missing include fixed it.

If adding this missing include doesn't cause any problems, I don't see any harm in doing so.

@eliasnaur
Copy link
Contributor

Please open a new issue with steps to reproduce the error. Thanks.

@golang golang locked and limited conversation to collaborators Dec 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

4 participants