go-gtk icon indicating copy to clipboard operation
go-gtk copied to clipboard

Installing on Mac OS-X os a convoluted process

Open jaytaylor opened this issue 11 years ago • 8 comments

"Don't forget, that you need the GTK-Development-Packages." isn't particularly helpful.

Please update the docs to include the following info for mac users:

# Install dependencies.
$ brew install cairo pixman fontconfig freetype libpng gtksourceview

# Ensure they can be found by exporting the PKG_CONFIG_PATH.
$ export PKG_CONFIG_PATH=":/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/pixman/lib/pkgconfig:/usr/local/opt/fontconfig/lib/pkgconfig:/usr/local/opt/freetype/lib/pkgconfig:/usr/local/opt/libpng/lib/pkgconfig:/usr/X11/lib/pkgconfig:/usr/local/opt/gtksourceview/lib/pkgconfig:${PKG_CONFIG_PATH}"

$ make all

jaytaylor avatar Aug 01 '13 20:08 jaytaylor

Hi,

I'm trying to install the package, with

go get github.com/mattn/go-gtk

and I get

# github.com/mattn/go-gtk/pango
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'
# github.com/mattn/go-gtk/glib
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'
# github.com/mattn/go-gtk/gdk
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'

if I clone the repo. and then

make all

cd pango && go get -x
WORK=/var/folders/z2/n_fpsfzj3dl5k0l7k2j2m98h0000gn/T/go-build018142297
mkdir -p $WORK/go-gtk/pango/_obj/
mkdir -p $WORK/go-gtk/
cd /Users/allochi/Projects/gocode/src/go-gtk/pango
pkg-config --cflags pango
pkg-config --libs pango
/usr/local/Cellar/go/1.1.2/pkg/tool/darwin_amd64/cgo -objdir $WORK/go-gtk/pango/_obj/ -- -D_REENTRANT -I/usr/local/Cellar/pango/1.34.1/include/pango-1.0 -I/usr/local/Cellar/glib/2.36.4/include/glib-2.0 -I/usr/local/Cellar/glib/2.36.4/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I $WORK/go-gtk/pango/_obj/ pango.go
# go-gtk/pango
clang: error: argument unused during compilation: '-fno-eliminate-unused-debug-types'
make: *** [all] Error 2

Not sure why, could you please help? Thanks!

allochi avatar Oct 18 '13 20:10 allochi

Could you please try: CC=gcc go get github.com/mattn/go-gtk ? Probably your go is using clang?

mattn avatar Oct 21 '13 00:10 mattn

Thanks! Sorry, I didn't check my emails, now I get this:

can't load package: package github.com/mattn/go-gtk: no Go source files in /Users/allochi/Projects/gocode/src/github.com/mattn/go-gtk

allochi avatar Oct 23 '13 14:10 allochi

Clang is default compiler on os x 10.9, gcc is only symbolic link to it. You have to install gcc to use go's C package:

sudo port install gcc49
sudo ln -nsf $(which gcc-4.9) /usr/bin/gcc

You also need to meet some dependencies which I still haven't met. I'll report if I manage to do that.

solusipse avatar Nov 11 '13 20:11 solusipse

I managed to run it on OS X 10.9. There is how it looks:

gogtk

I used macports to install all dependancies. Some of them were:

sudo port install gtk2
sudo port install gdk-pixbuf2
brew install pango

XQuartz is also needed, couple other things probably too. Compilation of everything took about 2-3 hours.

solusipse avatar Nov 12 '13 00:11 solusipse

Compilation of everything took about 2-3 hours.

:-(

mattn avatar Nov 12 '13 00:11 mattn

Are the dependencies listed just to compile, as in distributed compiled apps only need macs with XQuartz to run? I ask as I might write some software using this. Asking users to install XQuartz isn't bad, asking them to compile libraries is another matter.

Thanks.

krolaw avatar Dec 01 '13 08:12 krolaw

You don't have to ask them to compile libraries on their own, you can provide them with your program. XQuartz isn't also always needed. I found some informations on this subject (but haven't tested): http://bfwiki.tellefsen.net/index.php/Building_a_native_(no_X11)_MacOSX_binary https://github.com/conformal/gotk3/wiki/Installing-on-OSX#osx-native

solusipse avatar Dec 01 '13 13:12 solusipse