If I'm statically linking a GTK+ program under FreeBSD 8, gtk_builder_add_from_file()
suddenly returns with an error:
Invalid object type `GtkWindow'
How to fix that? With dynamic linking everything works fine.
Update: linking is done by:
cc -o foobar foo.o bar.o main.o -Wall -pedantic -std=c99 D_THREAD_SAFE -DORBIT2=1 -D_REENTRANT -I/usr/local/include/gtk-2.0 -I/usr/local/lib/gtk-2.0/include -I/usr/local/include/atk-1.0 -I/usr/local/include/cairo -I/usr/local/include/pango-1.0 -I/usr/local/include -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/pixman-1 -I/usr/local/include/freetype2 -I/usr/local/include/gconf/2 -I/usr/local/include/orbit-2.0 -I/usr/local/include/dbus-1.0 -I/usr/local/include/dbus-1.0/include -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED=1 -DGTK_MULTIHEAD_SAFE=1 -export-dynamic -static -pthread -L/usr/local/lib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lgio-2.0 -lXinerama -lXi -lXcursor -lXcomposite -lXdamage -lpangoft2-1.0 -lXext -lXfixes -lcairo -lpixman-1 -lpng -lxcb-render-util -lXrender -lxcb-render -lX11 -lxcb -lXau -lXdmcp -lpango-1.0 -lfontconfig -lexpat -lfreetype -lz -lgconf-2 -lORBit-2 -lm -ldbus-1 -lgmodule-2.0 -lgthread-2.0 -lgobject-2.0 -lglib-2.0 -liconv -lintl -lpcre
or in another words, in Makefile I have:
CFLAGS := -Wall -pedantic -std=c99 LDFLAGS := -export-dynamic -static CFLAGS += $(shell pkg-config --cflags gtk+-2.0 gconf-2.0) \ -DGTK_DISABLE_DEPRECATED=1 -DGDK_DISABLE_DEPRECATED \ -DGDK_PIXBUF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED=1 \ -DGTK_MULTIHEAD_SAFE=1 LDFLAGS += $(shell pkg-config --libs --static gtk+-2.0 gconf-2.0) -lintl -lpcre ... $(NAME): $(OBJ) cc -o $@ $^ $(CFLAGS) $(LDFLAGS)