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/cmd/gobind: gobind fails when binding ObjC imports to Go #47113

Open
ydnar opened this issue Jul 9, 2021 · 2 comments
Open

x/mobile/cmd/gobind: gobind fails when binding ObjC imports to Go #47113

ydnar opened this issue Jul 9, 2021 · 2 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ydnar
Copy link

ydnar commented Jul 9, 2021

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

$ go version
go version go1.16.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/ydnar/Library/Caches/go-build"
GOENV="/Users/ydnar/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/ydnar/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/ydnar/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.16.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.16.5/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/ydnar/development/ydnar/gomobile/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/6g/1gng3zts0t39s_qbtt7p0wsc0000gn/T/go-build3263680334=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

On current master branch of https://github.com/golang/mobile, I ran go test ./bind.

What did you expect to see?

Tests pass.

What did you see instead?

Tests fail, in particular TestGenGoObjcWrappers, when clang (run by gobind under xcrun) couldn’t find certain system headers like sys/types.h.

Output of go test ./bind:

--- FAIL: TestGenGoObjcWrappers (0.16s)
    bind_test.go:450: Foundation: clang failed to parse module: exit status 1: In file included from /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
        /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator15.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16:10: fatal error: 'sys/types.h' file not found
        #include <sys/types.h>
                 ^~~~~~~~~~~~~
        TranslationUnitDecl 0x7f9981029208 <<invalid sloc>> <invalid sloc>
        |-TypedefDecl 0x7f9981029ac0 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128'
        | `-BuiltinType 0x7f99810297a0 '__int128'
        |-TypedefDecl 0x7f9981029b30 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128'
        | `-BuiltinType 0x7f99810297c0 'unsigned __int128'
        |-TypedefDecl 0x7f9981029bd8 <<invalid sloc>> <invalid sloc> implicit referenced SEL 'SEL *'
        | `-PointerType 0x7f9981029b90 'SEL *'
        |   `-BuiltinType 0x7f9981029a00 'SEL'
        |-TypedefDecl 0x7f9981029cb8 <<invalid sloc>> <invalid sloc> implicit referenced id 'id'
        | `-ObjCObjectPointerType 0x7f9981029c60 'id'
        |   `-ObjCObjectType 0x7f9981029c30 'id'
        |-TypedefDecl 0x7f9981029d98 <<invalid sloc>> <invalid sloc> implicit referenced Class 'Class'
        | `-ObjCObjectPointerType 0x7f9981029d40 'Class'
        |   `-ObjCObjectType 0x7f9981029d10 'Class'
        |-ObjCInterfaceDecl 0x7f9981029df0 <<invalid sloc>> <invalid sloc> implicit Protocol

[+25,000 lines]

cc @hyangah

@mknyszek mknyszek changed the title mobile/cmd/gobind: gobind fails when binding ObjC imports to Go x/mobile/cmd/gobind: gobind fails when binding ObjC imports to Go Jul 9, 2021
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Jul 9, 2021
@gopherbot gopherbot added this to the Unreleased milestone Jul 9, 2021
@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 9, 2021
@mknyszek
Copy link
Contributor

mknyszek commented Jul 9, 2021

CC @hyangah via https://dev.golang.org/owners

Also maybe @hajimehoshi?

@muyuballs
Copy link

me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants