Le ven 11/06/2004 à 06:39, Mirco Mueller a écrit : > Hello there everybody! > > After reading the web and one straight day/night of trying out stuff, I > cannot figure out why static linking doesn't work. According to the > DirectFB-project this seem to be possible > (http://www.directfb.org/documentation/GTK_Embedded/). > > I got those libs: > > atk-1.6.0 > fontconfig-2.2.2 > freetype-2.1.8 > glib-2.4.0 > gtk+-2.4.1 > jpeg-6b > libpng-1.2.5 > pango-1.4.0 > tiff-v3.6.1 > zlib-1.2.1 > > All (if possible) where compiled with --enable-static. After "make > install" I really have all those *.a files in <prefix>/lib > > Now trying to compile test-static.c (see bottom of eMail) with the > command... > > gcc `pkg-config --cflags gtk+-2.0` -L/home/mirco/test-system/lib > -lgtk-x11-2.0 test-static.c -o test-static > > ... works as expected. The resulting binary test-static compiles and > runs. > > If I try the same with static linking like... > > gcc `pkg-config --cflags gtk+-2.0` -static -L/home/mirco/test-system/lib > -Wl,-Bstatic -lgtk-x11-2.0 test-static.c -o test-static > > ... I get these errors: > > /tmp/ccuoq9YZ.o(.text+0xe): In function `delete_event': > : undefined reference to `g_print' > /tmp/ccuoq9YZ.o(.text+0x20): In function `destroy': > : undefined reference to `gtk_main_quit' > /tmp/ccuoq9YZ.o(.text+0x50): In function `main': > : undefined reference to `gtk_init' > /tmp/ccuoq9YZ.o(.text+0x5c): In function `main': > : undefined reference to `gtk_window_new' > /tmp/ccuoq9YZ.o(.text+0x72): In function `main': > : undefined reference to `g_type_check_instance_cast' > /tmp/ccuoq9YZ.o(.text+0xa2): In function `main': > : undefined reference to `g_signal_connect_data' > /tmp/ccuoq9YZ.o(.text+0xb5): In function `main': > : undefined reference to `g_type_check_instance_cast' > /tmp/ccuoq9YZ.o(.text+0xe5): In function `main': > : undefined reference to `g_signal_connect_data' > /tmp/ccuoq9YZ.o(.text+0xf0): In function `main': > : undefined reference to `gtk_widget_show' > /tmp/ccuoq9YZ.o(.text+0xf5): In function `main': > : undefined reference to `gtk_main' > collect2: ld returned 1 exit status > > BTW, I'm using gcc 3.4.0. > > Any help is greatly appreciated! Thanks in advance for your time and > kind advice! > > Best regards... > > Mirco > > test-static.c: > > #include <gtk/gtk.h> > > static gboolean delete_event(GtkWidget* widget, > GdkEvent* event, > gpointer data) > { > g_print ("delete event occurred\n"); > return FALSE; > } > > static void destroy (GtkWidget *widget, gpointer data) > { > gtk_main_quit (); > } > > int main (int argc, char** argv) > { > GtkWidget* window; > > gtk_init (&argc, &argv); > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > g_signal_connect (G_OBJECT (window), > "delete_event", > G_CALLBACK (delete_event), > NULL); > g_signal_connect (G_OBJECT (window), > "destroy", > G_CALLBACK (destroy), > NULL); > gtk_widget_show (window); > gtk_main (); > > return 0; > } I am not sure, but I think I encountered an analogous problem at once. The order of the options might be significant. Try the following: gcc test-static.c -L/home/mirco/test-system/lib `pkg-config --cflags --libs gtk+-2.0` -static -Wl,-Bstatic -o test-static
Attachment:
signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=