gotk3: Build fails with GTK 3.22

I’m running on debian, with GTK packages:

$ dpkg -l libgtk-3\*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                              Version               Architecture          Description
+++-=================================-=====================-=====================-========================================================================
ii  libgtk-3-0:amd64                  3.22.11-1             amd64                 GTK+ graphical user interface library
ii  libgtk-3-bin                      3.22.11-1             amd64                 programs for the GTK+ graphical user interface library
ii  libgtk-3-common                   3.22.11-1             all                   common files for the GTK+ graphical user interface library
ii  libgtk-3-dev:amd64                3.22.11-1             amd64                 development files for the GTK+ library

The build fails as follows:

$ go get -v -tags gtk_3_22 github.com/gotk3/gotk3/gtk
github.com/gotk3/gotk3/glib
github.com/gotk3/gotk3/cairo
github.com/gotk3/gotk3/gdk
github.com/gotk3/gotk3/pango
github.com/gotk3/gotk3/gtk
# github.com/gotk3/gotk3/gtk
cgo-gcc-prolog: In function ‘_cgo_ec24e68943f7_Cfunc_gtk_widget_override_background_color’:
cgo-gcc-prolog:305:2: warning: ‘gtk_widget_override_background_color’ is deprecated [-Wdeprecated-declarations]
In file included from /usr/include/gtk-3.0/gtk/gtkapplication.h:27:0,
                 from /usr/include/gtk-3.0/gtk/gtkwindow.h:33,
                 from /usr/include/gtk-3.0/gtk/gtkdialog.h:32,
                 from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
                 from /usr/include/gtk-3.0/gtk/gtk.h:31,
                 from ../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:8:
/usr/include/gtk-3.0/gtk/gtkwidget.h:1148:14: note: declared here
 void         gtk_widget_override_background_color (GtkWidget     *widget,
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# github.com/gotk3/gotk3/gtk
cgo-gcc-prolog: In function ‘_cgo_ec24e68943f7_Cfunc_gtk_widget_override_font’:
cgo-gcc-prolog:617:2: warning: ‘gtk_widget_override_font’ is deprecated [-Wdeprecated-declarations]
In file included from /usr/include/gtk-3.0/gtk/gtkapplication.h:27:0,
                 from /usr/include/gtk-3.0/gtk/gtkwindow.h:33,
                 from /usr/include/gtk-3.0/gtk/gtkdialog.h:32,
                 from /usr/include/gtk-3.0/gtk/gtkaboutdialog.h:30,
                 from /usr/include/gtk-3.0/gtk/gtk.h:31,
                 from ../../go/src/github.com/gotk3/gotk3/gtk/label.go:6:
/usr/include/gtk-3.0/gtk/gtkwidget.h:1153:14: note: declared here
 void         gtk_widget_override_font             (GtkWidget                  *widget,
              ^~~~~~~~~~~~~~~~~~~~~~~~
# github.com/gotk3/gotk3/gtk
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:66: cannot use (*C.gchar)(cstr) (type *C.gchar) as type *C.char in argument to func literal
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:71: cannot use (func literal)(v.native()) (type *C.char) as type *C.gchar in argument to stringReturn
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:190: cannot use (*C.gchar)(cstr) (type *C.gchar) as type *C.char in argument to func literal
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:195: cannot use (func literal)(v.native()) (type *C.char) as type *C.gchar in argument to stringReturn
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:202: cannot use (*C.gchar)(cstr) (type *C.gchar) as type *C.char in argument to func literal
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:207: cannot use (func literal)(v.native()) (type *C.char) as type *C.gchar in argument to stringReturn
../../go/src/github.com/gotk3/gotk3/gtk/gtk_since_3_20.go:212: cannot use _Cfunc_CString(color) (type *C.char) as type *C.gchar in argument to _Cfunc_gdk_rgba_parse

The behavior is the same with and without -tags gtk_3_22.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@SamWhited, #318 has just been reported and it looks the same. fptrace of any go build failing with g_value_get_enum would be very useful.

I decided to reinstall all and wrote step by step what I did.

  • Downloaded and install latest msys from http://repo.msys2.org/distrib/x86_64/
  • run msys pacman -Syu close window by pressing X
  • run msys again and run pacman -Su
  • then run pacman --noconfirm -S mingw-w64-x86_64-gcc mingw64/mingw-w64-x86_64-pkg-config mingw-w64-x86_64-gtk3
  • run pacman -S mingw-w64-x86_64-go //Install GO directly to msys
  • run bash -c “sed -i -e ‘s/-Wl,-luuid/-luuid/g’ C:/msys64/mingw64/lib/pkgconfig/gdk-3.0.pc”
  • edit path, added C:\msys64\mingw64\bin
  • Create vatiable GOPATH c:\GoPath
  • Create valiable GOROOT C:\msys64\mingw64\lib\go\
  • then I run cmd and run go get github.com/gotk3/gotk3/gtk

and got the same error

C:\Users\111>go get github.com/gotk3/gotk3/gtk
# github.com/gotk3/gotk3/pango
C:\Users\111\AppData\Local\Temp\go-build113739042\b034\_x002.o: In function 
`_cgo_d7fe93989068_Cfunc_g_value_get_enum':
/tmp/go-build/cgo-gcc-prolog:56: undefined reference to `g_value_get_enum'
C:\Users\111\AppData\Local\Temp\go-build113739042\b034\_x004.o: In function 
`_cgo_d7fe93989068_Cfunc_g_value_get_boxed':
/tmp/go-build/cgo-gcc-prolog:62: undefined reference to `g_value_get_boxed'
collect2.exe: error: ld returned 1 exit status

Then I run your example

C:\GoPath\src\Home\GuiTest>go get -v github.com/gotk3/gotk3-examples/gtk-examples/simple
github.com/gotk3/gotk3-examples (download)
github.com/gotk3/gotk3/pango
# github.com/gotk3/gotk3/pango
C:\Users\111\AppData\Local\Temp\go-build561467870\b035\_x002.o: In function 
`_cgo_d7fe93989068_Cfunc_g_value_get_enum':
/tmp/go-build/cgo-gcc-prolog:56: undefined reference to `g_value_get_enum'
C:\Users\111\AppData\Local\Temp\go-build561467870\b035\_x004.o: In function 
`_cgo_d7fe93989068_Cfunc_g_value_get_boxed':
/tmp/go-build/cgo-gcc-prolog:62: undefined reference to `g_value_get_boxed'
collect2.exe: error: ld returned 1 exit status

and finaly I did

go get github.com/orivej/fptrace
C:\GoPath\src\Home\GuiTest>go get github.com/orivej/fptrace
# github.com/orivej/fptrace
..\..\github.com\orivej\fptrace\main.go:28:2: undefined: syscall.PTRACE_EVENT_FORK
..\..\github.com\orivej\fptrace\main.go:29:2: undefined: syscall.PTRACE_EVENT_VFORK
..\..\github.com\orivej\fptrace\main.go:30:2: undefined: syscall.PTRACE_EVENT_VFORK_DONE
..\..\github.com\orivej\fptrace\main.go:31:2: undefined: syscall.PTRACE_EVENT_CLONE
..\..\github.com\orivej\fptrace\main.go:183:8: undefined: syscall.PTRACE_EVENT_FORK
..\..\github.com\orivej\fptrace\main.go:184:4: undefined: syscall.PTRACE_EVENT_VFORK
..\..\github.com\orivej\fptrace\main.go:185:4: undefined: syscall.PTRACE_EVENT_VFORK_DONE
..\..\github.com\orivej\fptrace\main.go:186:4: undefined: syscall.PTRACE_EVENT_CLONE
..\..\github.com\orivej\fptrace\main.go:188:20: undefined: syscall.PtraceGetEventMsg
..\..\github.com\orivej\fptrace\trace.go:17:24: undefined: syscall.PtraceRegs
..\..\github.com\orivej\fptrace\main.go:188:20: too many errors

I just found that this is a Linux utilite, it’s why I got this errors. As I wrote in the #318 I can’t install it on Win7 x64. Can I do somthing to help you find a solution ?

@SamWhited, #318 has just been reported and it looks the same. fptrace of any go build failing with g_value_get_enum would be very useful.