Re: Static compilation of hello world



The order of libraries / object files given on GCCs command line is
significant. I guess that GCC does not reorder the arguments when it
passes them to ld. The linker will only link in object files which
provide something that was referenced in some file it has seen before.

Try specifying your source file as the first argument on GCCs command
line:

gcc base.c `pkg-config --libs --cflags gtk+-2.0`  -static -o base-static

Thank you very much, you were correct, the order is significant. I execute 
with base.c at following gcc. To work I only had to add the option -lpthread, 
so the correct is:

gcc base.c `pkg-config --libs --cflags gtk+-2.0` -lpthread -static -o 
base-static

And it works!!! However, the executable of a simple window in gtk is 11 Mb, 
and 2Mb after making strip.

Thank you very much for your replies!!!!!
-- 
Patricia Balbastre Betoret
Departamento de Informatica de Sistemas y Computadores
Camino de Vera, 14, E-46071, Valencia, Spain
Tel: +34 96 387 70 00 Ext 75707
Fax: +34 96 387 75 79
http://ttt.upv.es/~patbalb1
-----------------------------
http://www.fsf.org/philosophy/no-word-attachments.es.html




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]