mattn / go-gtk

Go binding for GTK
http://mattn.github.com/go-gtk
BSD 3-Clause "New" or "Revised" License
2.12k stars 246 forks source link

Can't install go-gtk on Mac OSX Yosemite (10.10.4) #245

Closed achedeuzot closed 8 years ago

achedeuzot commented 9 years ago

When I try to install it using the command go get github.com/mattn/go-gtk/gtk, I get the following error:

 # github.com/mattn/go-gtk/gdk
 ../../../golang/src/github.com/mattn/go-gtk/gdk/gdk_darwin.go:5:10: fatal error: 'gdk/gdkx.h' file not found
 #include <gdk/gdkx.h>
          ^
 1 error generated.

I've checked and pkg-config is correctly configured (I installed gtk+ with brew):

 $ pkg-config --cflags gdk-2.0
 -D_REENTRANT -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/local/Cellar/gtk+/2.24.28_2/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.28_2/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.36.8_1/include/pango-1.0 -I/usr/local/Cellar/gdk-pixbuf/2.30.8/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.17/include/libpng16 -I/usr/local/Cellar/glib/2.44.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.44.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include

and the files that it searches exist (gdk/gdkx.h).

Any suggestions on how to solve this ? Thanks a lot !

mattn commented 9 years ago

could you please show me go get -x github.com/mattn/go-gtk/gtk

achedeuzot commented 9 years ago

Of course, here it is:

    WORK=/var/folders/zc/sbpcg8qx7456m579jjjymlj00000gn/T/go-build733179269
mkdir -p $WORK/github.com/mattn/go-gtk/gdk/_obj/
mkdir -p $WORK/github.com/mattn/go-gtk/
cd /Users/achedeuzot/golang/src/github.com/mattn/go-gtk/gdk
pkg-config --cflags gdk-2.0 gthread-2.0
pkg-config --libs gdk-2.0 gthread-2.0
CGO_LDFLAGS="-g" "-O2" "-L/opt/X11/lib" "-L/usr/local/Cellar/gtk+/2.24.28_2/lib" "-L/usr/local/Cellar/pango/1.36.8_1/lib" "-L/usr/local/Cellar/gdk-pixbuf/2.30.8/lib" "-L/usr/local/Cellar/glib/2.44.1/lib" "-L/usr/local/opt/gettext/lib" "-lgdk-quartz-2.0" "-lpangocairo-1.0" "-lpango-1.0" "-lcairo" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lgthread-2.0" "-lglib-2.0" "-lintl" /usr/local/Cellar/go/1.4.2/libexec/pkg/tool/darwin_amd64/cgo -objdir $WORK/github.com/mattn/go-gtk/gdk/_obj/ -- -D_REENTRANT -I/opt/X11/include/cairo -I/opt/X11/include/pixman-1 -I/opt/X11/include -I/opt/X11/include/freetype2 -I/opt/X11/include/libpng15 -I/opt/X11/include -I/usr/local/Cellar/gtk+/2.24.28_2/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.28_2/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.36.8_1/include/pango-1.0 -I/usr/local/Cellar/gdk-pixbuf/2.30.8/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.17/include/libpng16 -I/usr/local/Cellar/glib/2.44.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.44.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I $WORK/github.com/mattn/go-gtk/gdk/_obj/ gdk.go gdk_darwin.go
# github.com/mattn/go-gtk/gdk
../../../golang/src/github.com/mattn/go-gtk/gdk/gdk_darwin.go:5:10: fatal error: 'gdk/gdkx.h' file not found
#include <gdk/gdkx.h>
         ^
1 error generated.
hachi8833 commented 9 years ago

I got the same error on gdk_darwin.go.

Lazyshot commented 9 years ago

I'm also having this issue and it apparently originates from gtk+ using the quartz backend instead of x11.

gdkx.h is x11's backend header file gdkquartz.h is quartz's backend header file

not sure if the solution is to add support for quartz or a way to get gtk+ compiled with x11.

I've installed everything via brew, which appears to have dropped all support for x11.

FWIW: These guys had a similar issue, not sure exactly how they fixed it as I'm not really a Haskell guy.

https://github.com/gtk2hs/gtk2hs/pull/40

juniorz commented 9 years ago

X11 backend is gone (https://github.com/Homebrew/homebrew/pull/39868). GTK+ homebrew formula is quartz only now.

petschephp commented 8 years ago

If you have xQuartz installed on your computer, all you need to do is create a symlink to the header files

ln -s /opt/X11/include/X11 /usr/local/include/X11

baiyuxiong commented 8 years ago

I have this issue too:

go get -x github.com/mattn/go-gtk/gtk WORK=/var/folders/kw/zqb4h35d5_5bcwb8b4sd_gc00000gn/T/go-build869683713 mkdir -p $WORK/github.com/mattn/go-gtk/gdk/_obj/ mkdir -p $WORK/github.com/mattn/go-gtk/ cd /Users/username/go/src/github.com/mattn/go-gtk/gdk pkg-config --cflags gdk-2.0 gthread-2.0 pkg-config --libs gdk-2.0 gthread-2.0 CGO_LDFLAGS="-g" "-O2" "-L/usr/local/Cellar/gtk+/2.24.28_3/lib" "-L/usr/local/Cellar/pango/1.38.1/lib" "-L/usr/local/Cellar/cairo/1.14.4/lib" "-L/usr/local/Cellar/gdk-pixbuf/2.32.1/lib" "-L/usr/local/Cellar/glib/2.46.1_1/lib" "-L/usr/local/opt/gettext/lib" "-lgdk-quartz-2.0" "-lpangocairo-1.0" "-lpango-1.0" "-lcairo" "-lgdk_pixbuf-2.0" "-lgobject-2.0" "-lgthread-2.0" "-lglib-2.0" "-lintl" /usr/local/go/pkg/tool/darwin_amd64/cgo -objdir $WORK/github.com/mattn/go-gtk/gdk/_obj/ -importpath github.com/mattn/go-gtk/gdk -- -D_REENTRANT -I/usr/local/Cellar/gtk+/2.24.28_3/include/gtk-2.0 -I/usr/local/Cellar/gtk+/2.24.28_3/lib/gtk-2.0/include -I/usr/local/Cellar/pango/1.38.1/include/pango-1.0 -I/usr/local/Cellar/harfbuzz/1.0.4/include/harfbuzz -I/usr/local/Cellar/pango/1.38.1/include/pango-1.0 -I/usr/local/Cellar/cairo/1.14.4/include/cairo -I/usr/local/Cellar/pixman/0.32.8/include/pixman-1 -I/usr/local/Cellar/fontconfig/2.11.1/include -I/usr/local/Cellar/freetype/2.5.3_1/include/freetype2 -I/usr/local/Cellar/freetype/2.6_1/include/freetype2 -I/usr/local/Cellar/libpng/1.6.18/include/libpng16 -I/usr/local/Cellar/gdk-pixbuf/2.32.1/include/gdk-pixbuf-2.0 -I/usr/local/Cellar/libpng/1.6.18/include/libpng16 -I/usr/local/Cellar/glib/2.46.1_1/include/glib-2.0 -I/usr/local/Cellar/glib/2.46.1_1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I $WORK/github.com/mattn/go-gtk/gdk/_obj/ gdk.go gdk_darwin.go

github.com/mattn/go-gtk/gdk

go/src/github.com/mattn/go-gtk/gdk/gdk_darwin.go:7:10: fatal error: 'gdk/gdkx.h' file not found

include <gdk/gdkx.h>

     ^

1 error generated.

mattn commented 8 years ago

Sorry, I don't have Mac OSX. So anyone please give us hints.

baiyuxiong commented 8 years ago

$ pwd /usr/local/Cellar/gtk+/2.24.28_3/include/gtk-2.0/gdk $ ls gdk.h gdk.h $ ls gdkx.h ls: gdkx.h: No such file or directory

juniorz commented 8 years ago

248 fixes this, but it has never been merged.

I recommend people to try https://github.com/gotk3/gotk3

jekabolt commented 7 years ago

пиздец