Cross-compiling GTK+, missing icons

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Cross-compiling GTK+, missing icons

Gerardo Ballabio-2
Hello all,

I'm trying to cross-compile GTK+ for Windows on Linux (Debian) using MXE (http:/ 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:/ and follow the instructions. The GTK+ 3 library is configured with the following options (specified in the src/ file in the MXE source tree):

--disable-glibtest --disable-cups --disable-test-print-backend --disable-gtk-doc --disable-man --with-included-immodules --enable-win32-backend

MXE also applies a few patches to the GTK+ sources (file src/gtk3-1-fixes.patch).

Thank you in advance for any help that you can provide.


gtk-list mailing list
[hidden email]

spinbutton-gtk3.png (59K) Download Attachment
toolbar-gtk3.png (65K) Download Attachment
toolbar-gtk2.png (19K) Download Attachment
spinbutton-gtk3.c (948 bytes) Download Attachment
toolbar-gtk3.c (2K) Download Attachment
toolbar-gtk2.c (1K) Download Attachment