I'm trying to cross-compile GTK+ for Windows on Linux (Debian) using MXE (http:/mxe.cc/). My goal is to produce a statically linked executable that just runs without having to install anything else (libraries, themes, etc.). I saw that in a previous thread someone said that GTK+ can't be statically linked, but that isn't true, it actually works fine (at least on Windows).
There is only one thing that doesn't work: the icons that are part of the standard interface (for example, the "+" and "-" that appear on the buttons of a GtkSpinButton) aren't displayed. When I run it, the program prints a warning saying that it can't find the "hicolor" theme, and all icons are replaced by a "missing icon" symbol.
I suppose that if I installed the theme on the target system, it would work (although I'm not sure in which directories GTK+ looks for it). But as I wrote above, I want the icons to be embedded in the executable, so that one can just download the file and run it. That is definitely possible with GTK+ 2, I compiled several programs and they all work without issues. But I haven't been able to make it work with GTK+ 3, so I'm asking for your help.
The problem is demonstrated by the attached screenshots:
- a window containing a GtkSpinButton (spinbutton-gtk3.png)
- a window containing a GtkToolbar with two buttons (toolbar-gtk3.png)
- the latter program rewritten for GTK+ 2 (toolbar-gtk2.png). As you can see, here the icons are displayed correctly.
I'm also attaching the source code of those examples.
I've tried to dig into the GTK+ sources to find where the icons are generated, but got lost. I found that there's a program called gtk-update-icon-cache that I guess might have to do with that, but I didn't understand how it's supposed to be used and where it's called during the build process (if it's called at all).
To reproduce what I did, go to http:/mxe.cc/ and follow the instructions. The GTK+ 3 library is configured with the following options (specified in the src/gtk3.mk file in the MXE source tree):