conformal / gotk3

Go bindings for GTK3
ISC License
471 stars 84 forks source link

Windows Install #84

Open 5k3105 opened 9 years ago

5k3105 commented 9 years ago
λ go get github.com/conformal/gotk3/gtk
# github.com/conformal/gotk3/gtk
In file included from c:\mingw64\x86_64-w64-mingw32\include\stddef.h:7:0,
                 from c:\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\stddef.h:1,
                 from C:/Fedora/include/glib-2.0/glib/gmacros.h:40,
                 from C:/Fedora/lib/glib-2.0/include/glibconfig.h:9,
                 from C:/Fedora/include/glib-2.0/glib/gtypes.h:34,
                 from C:/Fedora/include/glib-2.0/glib/galloca.h:34,
                 from C:/Fedora/include/glib-2.0/glib.h:32,
                 from C:/Fedora/include/gtk-3.0/gdk/gdkconfig.h:13,
                 from C:/Fedora/include/gtk-3.0/gdk/gdk.h:30,
                 from C:/Fedora/include/gtk-3.0/gtk/gtk.h:30,
                 from C:\Go\gocode\src\github.com\conformal\gotk3\gtk\gtk.go:48:
c:\mingw64\x86_64-w64-mingw32\include\crtdefs.h:26:1: error: unknown type name 'size_t'
 typedef size_t rsize_t;
 ^

Many more lines like this. Win 7.

davecgh commented 9 years ago

Are you following https://github.com/conformal/gotk3/wiki/Installing-on-Windows?

5k3105 commented 9 years ago

Yes. The last step at 'Test pkg-config' works correctly.

5k3105 commented 9 years ago

Here's what I have:

λ pkg-config --cflags --libs gtk+-3.0
-mms-bitfields -IC:/Fedora/include/gtk-3.0 
-IC:/Fedora/include/atk-1.0 
-IC:/Fedora/include/cairo 
-IC:/Fedora/include/gdk-pixbuf-2.0 
-IC:/Fedora/include/glib-2.0 -IC:/Fedora/lib/glib-2.0/include 
-IC:/Fedora/include/pango-1.0 
-IC:/Fedora/include/pixman-1 
-IC:/Fedora/include 
-IC:/Fedora/include/freetype2 
-IC:/Fedora/include/libpng16 
-IC:/Fedora/include/harfbuzz  -Wl,-luuid 
-LC:/Fedora/lib -lgtk-3 -lgdk-3 -limm32 -lshell32 -lole32 -lwinmm -latk-1.0 
-lgio-2.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo-gobject -lpangoft2-1.0 
-lpangowin32-1.0 -lgdi32 -lfontconfig -lfreetype -lpango-1.0 -lm -lcairo 
-lgobject-2.0 -lglib-2.0 -lintl
jrick commented 9 years ago

This looks like it could be an error in mingw32 (or the amd64 port), but I have never run into it before. size_t should be defined by stddef.h but it appears that stddef.h is including crtdefs.h, which references the size_t type, but size_t doesn't exist yet.

Are you able to try with a more recent mingw-w64?

5k3105 commented 9 years ago

Is there more recent? This is x64-4.8.1-posix-seh-rev5.

Attempting to use TDM-GCC-64 I get the same thing:

λ go get -u github.com/conformal/gotk3/gtk
# github.com/conformal/gotk3/gtk
In file included from c:\tdm-gcc-64\x86_64-w64-mingw32\include\stddef.h:7:0,
                 from c:\tdm-gcc-64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\stddef.h:1,
                 from C:/Fedora/include/glib-2.0/glib/gmacros.h:40,
                 from C:/Fedora/lib/glib-2.0/include/glibconfig.h:9,
                 from C:/Fedora/include/glib-2.0/glib/gtypes.h:34,
                 from C:/Fedora/include/glib-2.0/glib/galloca.h:34,
                 from C:/Fedora/include/glib-2.0/glib.h:32,
                 from C:/Fedora/include/gtk-3.0/gdk/gdkconfig.h:13,
                 from C:/Fedora/include/gtk-3.0/gdk/gdk.h:30,
                 from C:/Fedora/include/gtk-3.0/gtk/gtk.h:30,
                 from C:\Go\gocode\src\github.com\conformal\gotk3\gtk\gtk.go:48:
c:\tdm-gcc-64\x86_64-w64-mingw32\include\crtdefs.h:26:1: error: unknown type name 'size_t'
 typedef size_t rsize_t;
 ^
In file included from c:\tdm-gcc-64\x86_64-w64-mingw32\include\stddef.h:7:0,
                 from c:\tdm-gcc-64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\stddef.h:1,
                 from C:/Fedora/include/glib-2.0/glib/gmacros.h:40,
                 from C:/Fedora/lib/glib-2.0/include/glibconfig.h:9,
                 from C:/Fedora/include/glib-2.0/glib/gtypes.h:34,
                 from C:/Fedora/include/glib-2.0/glib/galloca.h:34,
                 from C:/Fedora/include/glib-2.0/glib.h:32,
                 from C:/Fedora/include/gtk-3.0/gdk/gdkconfig.h:13,
                 from C:/Fedora/include/gtk-3.0/gdk/gdk.h:30,
                 from C:/Fedora/include/gtk-3.0/gtk/gtk.h:30,
                 from C:\Go\gocode\src\github.com\conformal\gotk3\gtk\gtk.go:48:
c:\tdm-gcc-64\x86_64-w64-mingw32\include\crtdefs.h:183:5: error: unknown type name 'wchar_t'
     wchar_t *wlocale;
     ^
In file included from c:\tdm-gcc-64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\stddef.h:1:0,
                 from C:/Fedora/include/glib-2.0/glib/gmacros.h:40,
                 from C:/Fedora/lib/glib-2.0/include/glibconfig.h:9,
                 from C:/Fedora/include/glib-2.0/glib/gtypes.h:34,
                 from C:/Fedora/include/glib-2.0/glib/galloca.h:34,
                 from C:/Fedora/include/glib-2.0/glib.h:32,
                 from C:/Fedora/include/gtk-3.0/gdk/gdkconfig.h:13,
                 from C:/Fedora/include/gtk-3.0/gdk/gdk.h:30,
                 from C:/Fedora/include/gtk-3.0/gtk/gtk.h:30,
                 from C:\Go\gocode\src\github.com\conformal\gotk3\gtk\gtk.go:48:
c:\tdm-gcc-64\x86_64-w64-mingw32\include\stddef.h:20:19: error: expected ',' or ';' before '_set_errno'
   errno_t __cdecl _set_errno(int _Value);
                   ^
c:\tdm-gcc-64\x86_64-w64-mingw32\include\stddef.h:21:19: error: expected ',' or ';' before '_get_errno'
   errno_t __cdecl _get_errno(int *_Value);
                   ^
c:\tdm-gcc-64\x86_64-w64-mingw32\include\stddef.h:26:36: error: expected ',' or ';' before '__threadhandle'
   _CRTIMP extern uintptr_t __cdecl __threadhandle(void);

etc..

jrick commented 9 years ago

I thought there would be a GCC 4.9-based mingw-w64 but it appears to not be out yet. It does look like they released 4.8.2, however.

jrick commented 9 years ago

Also, what version of Go are you using?

5k3105 commented 9 years ago

I don't see 4.8.2.

λ go version
go version go1.3 windows/386
jrick commented 9 years ago

You cannot use windows/386 Go with the amd64 mingw32 port and amd64 Fedora packages. Install the amd64 Go instead.

Also, you should update to Go 1.3.1. Go 1.3 shipped with a broken cgo and doesn't always successfully build gotk3. 1.3.2 was released which fixes a security issue in the tls package, but the release is also broken on Windows, so use 1.3.1 for now and update to 1.3.3 when it's out in a few more days.

5k3105 commented 9 years ago

Aha! Thanks for catching that. I'll let you know how it goes.

5k3105 commented 9 years ago
λ go version
go version go1.3.1 windows/amd64
λ go get github.com/conformal/gotk3/gtk
package github.com/conformal/gotk3/gtk
        imports errors: unrecognized import path "errors"
package github.com/conformal/gotk3/gtk
        imports fmt: unrecognized import path "fmt"
package github.com/conformal/gotk3/gtk
        imports os: unrecognized import path "os"
package github.com/conformal/gotk3/gtk
        imports reflect: unrecognized import path "reflect"
package github.com/conformal/gotk3/gtk
        imports runtime: unrecognized import path "runtime"
package github.com/conformal/gotk3/gtk
        imports runtime/cgo: unrecognized import path "runtime/cgo"
package github.com/conformal/gotk3/gtk
        imports sync: unrecognized import path "sync"
package github.com/conformal/gotk3/gtk
        imports syscall: unrecognized import path "syscall"
package github.com/conformal/gotk3/gtk
        imports unsafe: unrecognized import path "unsafe"
c:/go/64/bin/go.exe build  [C:/Go/64/gocode/src/github.com/conformal/gotk3/gtk/examples/simple]
# github.com/conformal/gotk3/glib
In file included from c:\mingw64\x86_64-w64-mingw32\include\stddef.h:7:0,
                 from c:\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\stddef.h:1,
                 from C:/Fedora/include/glib-2.0/glib/gmacros.h:40,
                 from C:/Fedora/lib/glib-2.0/include/glibconfig.h:9,
                 from C:/Fedora/include/glib-2.0/glib/gtypes.h:34,
                 from C:/Fedora/include/glib-2.0/glib/galloca.h:34,
                 from C:/Fedora/include/glib-2.0/glib.h:32,
                 from ..\..\..\glib\glib.go:22:
c:\mingw64\x86_64-w64-mingw32\include\crtdefs.h:26:1: error: unknown type name 'size_t'
 typedef size_t rsize_t;
 ^

more errors like this...

jrick commented 9 years ago

The official Go binary expects its GOROOT to be C:\Go. You will need to set an alternative GOROOT if you put it in a different location (like C:\Go\64), or it won't be able to find the stdlib packages and other Go tools.

5k3105 commented 9 years ago

oops. Thanks.

λ go get -u github.com/conformal/gotk3/gtk
# github.com/conformal/gotk3/glib
In file included from c:\mingw64\x86_64-w64-mingw32\include\stddef.h:7:0,
                 from c:\mingw64\lib\gcc\x86_64-w64-mingw32\4.8.1\include\stddef.h:1,
                 from C:/Fedora/include/glib-2.0/glib/gmacros.h:40,
                 from C:/Fedora/lib/glib-2.0/include/glibconfig.h:9,
                 from C:/Fedora/include/glib-2.0/glib/gtypes.h:34,
                 from C:/Fedora/include/glib-2.0/glib/galloca.h:34,
                 from C:/Fedora/include/glib-2.0/glib.h:32,
                 from C:\Go\64\gocode\src\github.com\conformal\gotk3\glib\glib.go:22:
c:\mingw64\x86_64-w64-mingw32\include\crtdefs.h:26:1: error: unknown type name 'size_t'
 typedef size_t rsize_t;

etc..

5k3105 commented 9 years ago

The packages I downloaded:

mingw64-atk-2.10.0-1.fc20.noarch.rpm                                    2013-09-27 16:39  242K 

mingw64-cairo-1.12.16-1.fc20.noarch.rpm                                 2013-09-18 16:19  503K 

mingw64-expat-2.1.0-5.fc20.noarch.rpm                                   2013-08-16 07:22  124K  

mingw64-fontconfig-2.10.95-1.fc20.noarch.rpm                            2013-09-18 16:17  170K  

mingw64-freetype-2.5.0.1-1.fc20.noarch.rpm                              2013-09-18 16:19  425K  

mingw64-gdk-pixbuf-2.28.2-4.fc20.noarch.rpm                             2013-08-14 09:03  507K  

mingw64-gettext-0.18.3.1-1.fc20.noarch.rpm                              2013-09-18 16:14  2.0M  

mingw64-glib2-2.38.0-1.fc20.noarch.rpm                                  2013-09-27 16:38  2.3M  

mingw64-gtk3-3.10.0-1.fc20.noarch.rpm                                   2013-09-27 16:39  5.7M  

mingw64-harfbuzz-0.9.20-1.fc20.noarch.rpm                               2013-09-18 16:15  170K  

mingw64-libffi-3.0.13-4.fc20.noarch.rpm                                 2013-08-14 07:15   42K  

mingw64-libpng-1.6.3-1.fc20.noarch.rpm                                  2013-09-18 16:22  252K  

mingw64-pango-1.36.0-1.fc20.noarch.rpm                                  2013-09-27 16:39  261K  

mingw64-pixman-0.30.0-4.fc20.noarch.rpm                                 2013-09-05 16:57  203K  

mingw64-win-iconv-0.0.4-3.fc20.noarch.rpm                               2013-08-14 05:14   33K  

mingw64-zlib-1.2.8-2.fc20.noarch.rpm                                    2013-08-16 06:57   90K  
5k3105 commented 9 years ago

I cleaned up my env vars, was able to install some other sw I was having problems with and re-ran go get:

λ go get -u github.com/conformal/gotk3/gtk
# github.com/conformal/gotk3/gtk
37: error: 'GtkPopover' undeclared (first use in this function)
37: error: 'gtk_popover_set_position' undeclared (first use in this function)
37: error: 'gtk_popover_get_position' undeclared (first use in this function)
37: error: 'gtk_popover_get_type' undeclared (first use in this function)
37: error: 'gtk_popover_set_relative_to' undeclared (first use in this function)
37: error: 'gtk_popover_get_relative_to' undeclared (first use in this function)
38: error: 'gtk_widget_get_margin_start' undeclared (first use in this function)
38: error: 'gtk_widget_set_margin_start' undeclared (first use in this function)
38: error: 'gtk_popover_new' undeclared (first use in this function)
38: error: 'gtk_popover_set_modal' undeclared (first use in this function)
38: error: 'gtk_popover_get_modal' undeclared (first use in this function)
38: error: 'gtk_widget_get_margin_end' undeclared (first use in this function)
38: error: 'gtk_widget_set_margin_end' undeclared (first use in this function)

This happens when I try to run example programs too.

jrick commented 9 years ago

Be sure to use the right build tag options (-tags gtk_3_10) or it will default to a 3.12 build. Alternatively, you could try newer Fedora packages if they include GTK 3.12.

5k3105 commented 9 years ago

That worked. However, when I build an example, the executable complains that it can't find libgcc_s_seh-1.dll.

libgcc_s_seh-1.dll is in the mingw64 folder though and on the env var 'path'.

5k3105 commented 9 years ago

Ok, it's working when I make a copy and rename libgcc_s_seh_64-1.dll to libgcc_s_seh-1.dll