GNOME Bugzilla – Bug 61854
Test static linking
Last modified: 2011-02-04 16:16:03 UTC
We should support an entirely statically-linked application. Should try to get one running, fix issues, and document how to do it in the reference manual.
In version 1.3.10, I tried to create a static application in GTK+ and noticed that these files could not be statically linked in. They were required and had to be copied to another machine that was to run the static executable. The bigger problem was that they had to be located in the same directory as the machine with which the executable was created with -- this was problematic because root access is required to create them there. The file names and directories are: gtk/ gtk/etc/ gtk/etc/pango/ gtk/etc/pango/pango.modules gtk/etc/pango/pangox.aliases gtk/etc/pango/pangorc gtk/etc/gtk-2.0/ gtk/etc/gtk-2.0/gtk.immodules There may be more files required, but this appears to be the minimum in my case. I believe an environment variable could have been created to direct pangorc (and therefore, the other two files in the gtk/etc/pango/ directory) to look somewhere else, but ideally, it would be nice if these files were all placed within the executable some how.
Mostly what we are talking about for static linking is just not having shared libraries, not creating stand-alone executables.(No shared libraries is good for things like profiling or when you want to minimize installed size for a single program.) You'd probably want to build with a special --sysconfdir and then put the config files there.
I don't think this bug is useful to keep open; people have gone through the pain of getting static GTK+ built in various contexts, so we know it is possible, but really hard. And too hard to, I think, be worth documenting.