conformal / gotk3

Go bindings for GTK3
ISC License
470 stars 81 forks source link

Problem compiling with gccgo-4.9 #58

Open russel opened 10 years ago

russel commented 10 years ago

"go get -u github.com/conformal/gotk3/gtk" works fine. However a subsequent "go install -compiler gccgo -gccgoflags -O github.com/conformal/gotk3/gtk" results in:

# github.com/conformal/gotk3/gtk
gtk/gtk.go:2241:61: error: invalid type conversion (cannot use type gdk.Atom as type unsafe.Pointer)
  c := C.gtk_clipboard_get(C.GdkAtom(unsafe.Pointer(atom)))
                                                             ^
gtk/gtk.go:2256:32: error: invalid type conversion (cannot use type gdk.Atom as type unsafe.Pointer)
   C.GdkAtom(unsafe.Pointer(atom)))
                                ^

I am on Debian Sid with gc from default/tip of a clone and gccgo-4.9 from the Debian repository.

jrick commented 10 years ago

I've seen this problem before and it's an issue with gccgo not being able to convert from defined uintptr types (type MyType uintptr) directly to an unsafe.Pointer. Can you add an additional uintptr conversion before the unsafe.Pointer conversion and confirm that resolves the issue?

I'm not on a machine with commit access atm otherwise I could push a fix now.