sourcegraph / go-webkit2

WebKit API bindings (WebKitGTK+ v2) for Go
https://sourcegraph.com/github.com/sourcegraph/go-webkit2
Other
313 stars 61 forks source link

go-webkit2 wont compile with go 1.3 #12

Closed mdimec4 closed 7 years ago

mdimec4 commented 10 years ago

Hi I have problem compiling go-webkit2 with new Go 1.3 compiler. Go 1.3 has corrected a cgo bug that some C code binding libs seam to depend on. http://golang.org/doc/go1.3#cgo

I belive that two libs that go-webkit2 depends on have this problem. One of them also "github.com/sqs/gojs".

If this turns out to be a big problem I am prepared to help you correcting this bug. Best Miha

Compiler output:

miha@miha-work:~/Koala_intro/koala2 (develop)$ go version
go version go1.3 linux/amd64
miha@miha-work:~/Koala_intro/koala2 (develop)$ go build -tags gtk_3_10 github.com/visionect/go-webkit2/webkit2
# github.com/visionect/gotk3/glib
src/github.com/visionect/gotk3/glib/glib.go:359: cannot use idleSrc (type *C.GSource) as type *C.struct__GSource in argument to sourceAttach
src/github.com/visionect/gotk3/glib/glib.go:382: cannot use timeoutSrc (type *C.GSource) as type *C.struct__GSource in argument to sourceAttach
src/github.com/visionect/gotk3/glib/glib.go:393: cannot use src (type *C.struct__GSource) as type *C.GSource in argument to _Cfunc_g_source_destroy
src/github.com/visionect/gotk3/glib/glib.go:419: cannot use src (type *C.struct__GSource) as type *C.GSource in argument to _Cfunc_g_source_destroy
src/github.com/visionect/gotk3/glib/glib.go:426: cannot use src (type *C.struct__GSource) as type *C.GSource in argument to _Cfunc_g_source_set_closure
src/github.com/visionect/gotk3/glib/glib.go:430: cannot use src (type *C.struct__GSource) as type *C.GSource in argument to _Cfunc_g_source_attach
src/github.com/visionect/gotk3/glib/glib.go:756: cannot use glist (type *C.struct__GList) as type *C.GList in argument to _Cfunc_g_list_append
src/github.com/visionect/gotk3/glib/glib.go:756: cannot use _Cfunc_g_list_append(glist, C.gpointer(data)) (type *C.GList) as type *C.struct__GList in assignment
src/github.com/visionect/gotk3/glib/glib.go:763: cannot use glist (type *C.struct__GList) as type *C.GList in argument to _Cfunc_g_list_prepend
src/github.com/visionect/gotk3/glib/glib.go:763: cannot use _Cfunc_g_list_prepend(glist, C.gpointer(data)) (type *C.GList) as type *C.struct__GList in assignment
src/github.com/visionect/gotk3/glib/glib.go:763: too many errors
# github.com/sqs/gojs
src/github.com/sqs/gojs/context.go:13: cannot use (*[0]uint8)(c_nil) (type *[0]uint8) as type *C.struct_OpaqueJSClass in argument to _Cfunc_JSGlobalContextCreate
sqs commented 10 years ago

Thanks for the report. If you could help with a fix, that'd be great!

Sent from my iPhone

On Jun 27, 2014, at 05:45, Mihael Dimec notifications@github.com wrote:

He I have problem compiling go-webkit2 with new Go 1.3 compiler. Go 1.3 has corrected a cgo bug that some C code binding libs seam to depend on. http://golang.org/doc/go1.3#cgo

I belive that two libs that go-webkit2 depends on have this problem. One of them also "github.com/sqs/gojs".

If this turns out to be a big problem I am prepared to help you correcting this bug. Best Miha

Compiler output:

miha@miha-work:~/Koala_intro/koala2 (develop)$ go version go version go1.3 linux/amd64 miha@miha-work:~/Koala_intro/koala2 (develop)$ go build -tags gtk_3_10 github.com/visionect/go-webkit2/webkit2

github.com/visionect/gotk3/glib

src/github.com/visionect/gotk3/glib/glib.go:359: cannot use idleSrc (type C.GSource) as type C.structGSource in argument to sourceAttach src/github.com/visionect/gotk3/glib/glib.go:382: cannot use timeoutSrc (type C.GSource) as type C.structGSource in argument to sourceAttach src/github.com/visionect/gotk3/glib/glib.go:393: cannot use src (type C.struct__GSource) as type C.GSource in argument to _Cfunc_g_source_destroy src/github.com/visionect/gotk3/glib/glib.go:419: cannot use src (type C.struct__GSource) as type C.GSource in argument to _Cfunc_g_source_destroy src/github.com/visionect/gotk3/glib/glib.go:426: cannot use src (type C.struct__GSource) as type C.GSource in argument to _Cfunc_g_source_set_closure src/github.com/visionect/gotk3/glib/glib.go:430: cannot use src (type C.struct__GSource) as type C.GSource in argument to _Cfunc_g_source_attach src/github.com/visionect/gotk3/glib/glib.go:756: cannot use glist (type C.struct__GList) as type C.GList in argument to _Cfunc_g_list_append src/github.com/visionect/gotk3/glib/glib.go:756: cannot use _Cfunc_g_list_append(glist, C.gpointer(data)) (type C.GList) as type C.structGList in assignment src/github.com/visionect/gotk3/glib/glib.go:763: cannot use glist (type *C.structGList) as type C.GList in argument to _Cfunc_g_list_prepend src/github.com/visionect/gotk3/glib/glib.go:763: cannot use _Cfunc_g_list_prepend(glist, C.gpointer(data)) (type C.GList) as type *C.struct__GList in assignment src/github.com/visionect/gotk3/glib/glib.go:763: too many errors

github.com/sqs/gojs

src/github.com/sqs/gojs/context.go:13: cannot use ([0]uint8)(c_nil) (type [0]uint8) as type *C.struct_OpaqueJSClass in argument to _Cfunc_JSGlobalContextCreate

— Reply to this email directly or view it on GitHub.

mdimec4 commented 10 years ago

Ok for start can you apply this patch to gojs please? http://pastebin.com/Kg1iWrcq

Best Miha

sqs commented 10 years ago

Sure, done.

sajal commented 10 years ago

I have a similar issue in ubuntu 14.04

sajal@sajal-lappy:~$ uname -a
Linux sajal-lappy 3.13.0-30-generic #54-Ubuntu SMP Mon Jun 9 22:45:01 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
sajal@sajal-lappy:~$ go version
go version go1.3 linux/amd64
sajal@sajal-lappy:~$ go get github.com/sourcegraph/go-webkit2/webkit2
# github.com/sqs/gotk3/gtk
go/src/github.com/sqs/gotk3/gtk/gtk.go:1023: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get
go/src/github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use display.Native() (type *gdk.C.struct__GdkDisplay) as type *C.struct__GdkDisplay in argument to _Cfunc_gtk_clipboard_get_for_display
go/src/github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get_for_display
sajal@sajal-lappy:~$ 

No experience with cgo (or C)

dorajistyle commented 9 years ago

I have got exactly same issue with sajal in manjaro linux

[dorajistyle@manjaro go-gin-canjs-i18n]$ uname -a
Linux manjaro 3.14.18-1-MANJARO #1 SMP PREEMPT Sat Sep 6 09:36:47 UTC 2014 x86_64 GNU/Linux
[dorajistyle@manjaro go-gin-canjs-i18n]$ go version
go version go1.3.1 linux/amd64
[dorajistyle@manjaro go-gin-canjs-i18n]$ go get --tags gtk_3_10 github.com/sourcegraph/go-webkit2/...
# github.com/sqs/gotk3/gtk
../../sqs/gotk3/gtk/gtk.go: In function ‘_cgo_fcfc107522cb_Cfunc_gtk_dialog_get_action_area’:
../../sqs/gotk3/gtk/gtk.go:812:2: warning: ‘gtk_dialog_get_action_area’ is deprecated (declared at /usr/include/gtk-3.0/gtk/gtkdialog.h:205) [-Wdeprecated-declarations]
 // for wrapper functions that wrap around a C GTK function taking a
  ^
# github.com/sqs/gotk3/gtk
../../sqs/gotk3/gtk/gtk.go:1023: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get
../../sqs/gotk3/gtk/gtk.go:1036: cannot use display.Native() (type *gdk.C.struct__GdkDisplay) as type *C.struct__GdkDisplay in argument to _Cfunc_gtk_clipboard_get_for_display
../../sqs/gotk3/gtk/gtk.go:1036: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get_for_display
mdimec4 commented 9 years ago

I found out that for me using go 1.3.1 solves most of the problems.

2014-10-08 12:08 GMT+02:00 JoongSeob Vito Kim notifications@github.com:

I have got exactly same issue with sajal in manjaro linux

[dorajistyle@manjaro go-gin-canjs-i18n]$ uname -a Linux manjaro 3.14.18-1-MANJARO #1 https://github.com/sourcegraph/go-webkit2/issues/1 SMP PREEMPT Sat Sep 6 09:36:47 UTC 2014 x86_64 GNU/Linux [dorajistyle@manjaro go-gin-canjs-i18n]$ go version go version go1.3.1 linux/amd64 [dorajistyle@manjaro go-gin-canjs-i18n]$ go get --tags gtk_3_10 github.com/sourcegraph/go-webkit2/... github.com/sqs/gotk3/gtk

../../sqs/gotk3/gtk/gtk.go: In function ‘_cgo_fcfc107522cb_Cfunc_gtk_dialog_get_action_area’: ../../sqs/gotk3/gtk/gtk.go:812:2: warning: ‘gtk_dialog_get_action_area’ is deprecated (declared at /usr/include/gtk-3.0/gtk/gtkdialog.h:205) [-Wdeprecated-declarations] // for wrapper functions that wrap around a C GTK function taking a ^ github.com/sqs/gotk3/gtk

../../sqs/gotk3/gtk/gtk.go:1023: cannot use atom.Native() (type gdk.C.GdkAtom) as type C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get ../../sqs/gotk3/gtk/gtk.go:1036: cannot use display.Native() (type gdk.C.structGdkDisplay) as type *C.structGdkDisplay in argument to _Cfunc_gtk_clipboard_get_for_display ../../sqs/gotk3/gtk/gtk.go:1036: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get_for_display

— Reply to this email directly or view it on GitHub https://github.com/sourcegraph/go-webkit2/issues/12#issuecomment-58336513 .

alexanderritola commented 9 years ago

I've tried to use this lib on OS X and Arch Linux. On OS X I don't think I was able to fully satisfy the dependencies, but on Arch Linux I was able to. I tried on 1.2.2 1.3 1.3.1 and 1.3.3 and I keep getting more or less the same errors (there have been a few variations but I'm pretty sure they share the same root cause that's causing others similar problems).

# github.com/sqs/gotk3/gtk
../../github.com/sqs/gotk3/gtk/gtk.go: In function '_cgo_fcfc107522cb_Cfunc_gtk_dialog_get_action_area':
../../github.com/sqs/gotk3/gtk/gtk.go:812:2: warning: 'gtk_dialog_get_action_area' is deprecated (declared at /usr/include/gtk-3.0/gtk/gtkdialog.h:205) [-Wdeprecated-declarations]
 // for wrapper functions that wrap around a C GTK function taking a
  ^
# github.com/sqs/gotk3/gtk
../../github.com/sqs/gotk3/gtk/gtk.go:1023: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get
../../github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use display.Native() (type *gdk.C.struct__GdkDisplay) as type *C.struct__GdkDisplay in argument to _Cfunc_gtk_clipboard_get_for_display
../../github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get_for_display
sqs commented 9 years ago

Hmm, to make it easier to debug we should first make it not use my gotk3 fork anymore and just use te upstream. They have incorporated my patches and might have fixed this issue. Do you have time to try that?

On Oct 11, 2014, at 05:12, Alexander Ritola notifications@github.com wrote:

I've tried to use this lib on OS X and Arch Linux. On OS X I don't think I was able to fully satisfy the dependencies, but on Arch Linux I was able to. I tried on 1.2.2 1.3 1.3.1 and 1.3.3 and I keep getting more or less the same errors (there have been a few variations but I'm pretty sure they share the same root cause that's causing others similar problems).


../../github.com/sqs/gotk3/gtk/gtk.go: In function '_cgo_fcfc107522cb_Cfunc_gtk_dialog_get_action_area':
../../github.com/sqs/gotk3/gtk/gtk.go:812:2: warning: 'gtk_dialog_get_action_area' is deprecated (declared at /usr/include/gtk-3.0/gtk/gtkdialog.h:205) [-Wdeprecated-declarations]
// for wrapper functions that wrap around a C GTK function taking a
^

github.com/sqs/gotk3/gtk

../../github.com/sqs/gotk3/gtk/gtk.go:1023: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get
../../github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use display.Native() (type *gdk.C.struct__GdkDisplay) as type *C.struct__GdkDisplay in argument to _Cfunc_gtk_clipboard_get_for_display
../../github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get_for_display```

—
Reply to this email directly or view it on GitHub.
tenmozes commented 9 years ago

Hi, tried to get this lib, got:

go get github.com/sourcegraph/go-webkit2/webkit2
# github.com/sqs/gotk3/gtk
.../src/github.com/sqs/gotk3/gtk/gtk.go:1023: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get
.../src/github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use display.Native() (type *gdk.C.struct__GdkDisplay) as type *C.struct__GdkDisplay in argument to _Cfunc_gtk_clipboard_get_for_display
.../src/github.com/sqs/gotk3/gtk/gtk.go:1036: cannot use atom.Native() (type gdk.C.GdkAtom) as type *C.struct__GdkAtom in argument to _Cfunc_gtk_clipboard_get_for_display

go version go1.3.1 linux/amd64 Ubuntu 14.04

sqs commented 9 years ago

I am working on fixing this. In my unpushed branch I am now using conformal/gotk3 instead of my sqs/gotk3 fork. Still getting these errors but am working on them.

$ go build -i -tags gtk_3_10 ./webkit2
# github.com/sourcegraph/go-webkit2/webkit2
webkit2/webview.go:134: cannot convert _Cfunc_webkit_javascript_result_get_global_context(jsResult) (type C.JSGlobalContextRef) to type gojs.RawContext
webkit2/webview.go:135: cannot convert _Cfunc_webkit_javascript_result_get_value(jsResult) (type C.JSValueRef) to type gojs.RawValue
sqs commented 9 years ago

OK, can folks please try this now?

# be sure to update to the latest
$ go get -u -tags gtk_3_10 github.com/sourcegraph/go-webkit2/...
$ go test -tags gtk_3_10 github.com/sourcegraph/go-webkit2/webkit2
$ echo document.title | webkit-eval-js https://google.com /dev/stdin

It's working for me on Ubuntu 14.04 as of https://github.com/sourcegraph/go-webkit2/commit/5aa11369df4551dfa0e92d80f18ec625c61d0a40.

paultag commented 7 years ago

I've been able to build on Go 1.6; since this issue calls it 'new', this might be worth closing!