-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Description
Please answer these questions before submitting your issue. Thanks!
go version go1.10rc1 darwin/amd64
(the same with 1.9.3)
go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/unsacrificed/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/unsacrificed/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/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/qr/tv0txk2s0zv4579x79sp67m00000gn/T/go-build552297888=/tmp/go-build -gno-record-gcc-switches -fno-common"
I try to go tool cgo -godefs cgodefs.go
where cgodefs.go
contains
// +build ignore
package tmp
//go:generate go tool cgo -godefs cgodefs.go
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
*/
import "C"
type CGPoint C.CGPoint
and I expect to see source with compatible CGPoint structure. Instead of it I receive a lot of compilation errors:
In file included from /Users/unsacrificed/go/src/gui/cgodefs.go:10:
In file included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:8:
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:503:1: error: expected identifier or '('
@class NSString, Protocol;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:505:9: error: unknown type name 'NSString'
typedef NSString * NSExceptionName NS_EXTENSIBLE_STRING_ENUM;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:506:9: error: unknown type name 'NSString'
typedef NSString * NSRunLoopMode NS_EXTENSIBLE_STRING_ENUM;
... (100000+ lines of errors)
On the other hand I can successfully build and run GoLang app with Objective-C code.