Re: Static compilation of hello world



On Thu, 2003-06-19 at 13:18, Miguel Mendez wrote:
gcc `pkg-config --libs --cflags gtk+-2.0`  -static -o base-static \
base-static.c

should do the trick.

Note that the order of options to gcc is significant.
Putting -static *after* all the libraries is probably not what you want.
Also, you'll need the .c file to be inspected *before* the libraries, or
you will likely get "unresolved symbol" errors.

So, I'd try,

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

If you're not using gcc, check the man page (man cc, or whatever) to
see if it's -static, --static, -Bstatic, or whatever.  You can also
use, man gcc, for that matter.  You can intermix -static and -dynamic
options to change the way you link to specific libraries --
cc .... -dynamic -lxxx -static ....

(how many people does it take to compile a lightbulb?)

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Ankh: irc.sorcery.net www.valinor.sorcery.net irc.gnome.org www.advogato.org
Author, Open Source XML Database Toolkit, Wiley August 2000
Co-author: The XML Specification Guide, Wiley 1999; Mastering XML, Sybex 2001




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