I can not install / reinstall GTK for Go windows 7 x64. The fact is that the comrade could not cope with the above-stated task, and I decided to help (it works for me). The setting seems primitive to horror:

  • On the system with the installed golang install msys2 (64 bit) with MinGW-w64
  • In MinGW-w64 console, using pacman, download everything you need.
  • write path to x86_64-w64-mingw32 \ bin in path

In general, all of the instructions, https://github.com/gotk3/gotk3/wiki/Installing-on-Windows with one difference: mysys is the last.

Usually this was enough and go get github.com/gotk3/gotk3/gtk worked fine and pulled the necessary package, as well as a simple examle.go from the examples worked.

But not at this time.

go get github.com/gotk3/gotk3/gtk # github.com/gotk3/gotk3/pango C:\Users\Admin\AppData\Local\Temp\go-build074518798\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\Admin\AppData\Local\Temp\go-build074518798\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 

For some reason, GO does not see the C function used in C. pango. Get_value_get_enum. I decided to repeat the installation at my place - I renamed the msys64 folder -> msys64_ and reinstalled it again - it works. After that I renamed Go -> Go_ and reinstalled GO, and only then I received the same error as that of my friend. Renamed Go_ back to Go again, everything works, looked at the version of the old go1.11.2 newly installed go.1.11.4. Comrade replacing my daddy with go1.11.2 did not solve the problem. The question arose, what is it all missing, the Internet is silent on the above problems. For earlier grateful for the help.

  • Try to put go through pacman inside msys. - zed
  • Thanks for the referral, unfortunately it did not help. I deleted the c: \ Go folder, installed Go via msys (#pacman -S mingw-w64-x86_64-go), corrected the paths to the new GOROOT, rebooted. But with go get github.com/gotk3/gotk3/gtk one more error was added go build github.com/gotk3/gotk3/gdk: invalid flag in pkg-config --libs: -Wl, -luuid, corrected it with # bash -c "sed -i -e 's / -Wl, -luuid / -luuid / g' C: /msys64/mingw64/lib/pkgconfig/gdk-3.0.pc", but everything else is the same. - Sergii Kirichok
  • About the "undefined reference to" you here . - αλεχολυτ
  • Thank you, I read this. But, for example, pango-layout.go imports C like something like import "C", and then, for example, on line 194 C.g_value_get_enum ((* C.GValue) (unsafe.Pointer (p) )) and at the exit we will feel the error. Although other appeals "C.Xxxx" pass without problems. Here the question arises why this particular function is not being worked out? - Sergii Kirichok 1:28 pm

1 answer 1

Resolved!
Helping - replacing #cgo pkg-config: pango with #cgo pkg-config: pango gobject-2.0 in pango-layout.go and pango-attributes.go

  • As a longtime gtk developer, I highly recommend that you use something else. Something unpleasant happens to gtk : constant and deliberate failure of API and ABI . The gtk developers call it intensive development. It causes very serious problems, especially in the long term. Especially when using bindings to other languages. For a long time we tried to keep up with the ever-breaking toolkit. But this is impossible. It seems to me that all this aggressive development is a consequence of the fact that both the developers themselves and themselves do not understand what to do with all this. - MGNeo