into the gui pond

In my previous post about getting Pond running on Yosemite, I ran into an issue with the GUI. The CLI interface seems to be fully-functional and pleasant enough for me, but GUI-errors are no guid. So yesterday I tried to figure out what the problem was, and somehow fixed it in the process. Naturally I was not keeping detailed logs.

It went something like this.

gtk3

First, I made sure I could run something else using GTK, so:

> gtk3-demo

This technically ran, but produced a lot of warnings and errors, e.g.

(gtk3-demo:99098): Gtk-WARNING **: Error loading theme icon 'image-missing' for stock: Icon 'image-missing' not present in theme
(gtk3-demo:99098): GLib-GObject-CRITICAL **: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

which is possibly a related problem to the one I had with Pond, but given Pond now works for me, and I still get these errors, I suspect they have different origins/are not directly causally related.

becoming one with the error

So I tried to understand the actual error I was getting (from this log):

panic: (*gdkpixbuf._Ctype_struct__GError) (0x4383380,0x5c6be20)

This involved following the golden braid deeper into the inner workings of go and gdk-pixbuf, in the hopes that something would start to make sense.

Clarity was not forthcoming. I got to look at non-scientific code for a while, and I decided gdk-pixbuf was to blame, but otherwise learned little. This isn't terribly surprising given my lack of knowledge of Go/gtk/OSX/etc. I tried. At least I had a witch (gdk-pixbuf) to burn.

fun with reinstalling everything repeatedly

I thought about trying to test gdkpixbuf.PixbufLoaderWithType("png") on its own, but I was lazy and foolish, so I just tried reinstalling gdk-pixbuf instead.

brew install gdk-pixbuf
/usr/local/Cellar/gdk-pixbuf/2.30.8/bin/gdk-pixbuf-query-loaders --update-cache

I think this is when I introduced a new problem, thought 'damn, OK I'll just fix this problem and get back to carefully recording how I fix this GUI error', and in the process fixed the GUI. Naturally. The problem I introduced looked like this:

> client

dyld: Library not loaded: /usr/local/lib/libgdk_pixbuf-2.0.0.dylib
  Referenced from: [$GOPATH]/bin/client
    Reason: Incompatible library version: client requires version 3101.0.0 or later, but libgdk_pixbuf-2.0.0.dylib provides version 3001.0.0
    Trace/BPT trap: 5

Which looks suspiciously like a version got messed up, maybe because I installed gdk-pixbuf individually, maybe because of magic. So I then uninstalled it, reinstalled gtk+3 (which pulled gdk-pixbuf down first; error persisted), reinstalled gtkspell3, all to no avail. Then I did a brew cleanup and it deleted some old versions and cached bottles. Determined to somehow update my gdk-pixbuf (naively believing that the newest version of a thing must be the optimal one), I explored:

> brew info gdk-pixbuf

gdk-pixbuf: stable 2.30.8 (bottled)
http://gtk.org
/usr/local/Cellar/gdk-pixbuf/2.30.8 (209 files, 4.3M) *
  Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/gdk-pixbuf.rb
==> Dependencies
Build: xz , pkg-config 
Required: glib , jpeg , libtiff , libpng , gobject-introspection 
==> Options
--universal
    Build a universal binary
==> Caveats
Programs that require this module need to set the environment variable
  export GDK_PIXBUF_MODULEDIR="/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders"
If you need to manually update the query loader cache, set GDK_PIXBUF_MODULEDIR then run
  /usr/local/Cellar/gdk-pixbuf/2.30.8/bin/gdk-pixbuf-query-loaders --update-cache

maximum gdk-pixbuf installation

I don't feel proud of this, but I liked the sound of a 'universal binary' so I went for that.

> brew reinstall --universal gdk-pixbuf

==> Installing dependencies for gdk-pixbuf: sqlite, gdbm, makedepend, openssl, python, xz, gettext, glib, jpeg, libtiff, libpng, gobject-intros

. . . But then it was taking too long, so I cancelled it during gettext. I'm so, so sorry.

The next event I have recorded in my logs was me uninstalling gdk-pixbuf and gtk+3, then reinstalling gtk+3. All for good measure. I then tried to cleanly reinstall pond, so

> cd $GOPATH
> rm -r *
> go get github.com/agl/pond/client

. . . and . .

> client
Feb  1 02:03:50: Starting fetch from home server

It Just Worked.

I was hoping the dylib problem would go away and I could return to my GUI issues, but nope. All fixed. I tried uninstalling things (gtk+3, go, gtkspell3, mercurial, gdk-pixbuf, pond) in an attempt to recreate the original (or subsequent) issue(s), but it refused to be broken. I have a list of all the dependencies I installed during this fiasco, so I could in theory spend more time trying to break it again, or I could not.

at the end of the magical vortex, a thousand bald yaks

Incidentally, after all of this, it transpires that that One Weird Trick:

> gdk-pixbuf-query-loaders > $GOPATH/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache

is no longer required for client to run. So that's fewer files and more GUIs, what could be better?