Re: Static compilation of hello world



Patricia Balbastre Betoret wrote:

Hi!!

I want to build statically a simple Hello World program. I have compiled glib, pango, atk and gtk with --enable-static, so I have all .a libraries. However, I get this error when compiling:

gcc `pkg-config --libs --cflags gtk+-2.0`  -static -o base-static
/usr/lib/gcc-lib/i386-linux/3.3/../../../crt1.o(.text+0x18): In function `_start':
: undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [static] Error 1

There is no problem when I compile without the static label:
gcc `pkg-config --libs --cflags gtk+-2.0`  -o base base.c

I have read somewhere that static compilation does not work very well in gtk, but I do not know why. I really need to make gtk applications static, so if it will be impossible (or very difficult) in gtk, it will be better for me to know it in advance before continue.

Thank you very much for your replies.

so this works:
gcc `pkg-config --libs --cflags gtk+-2.0`  -o base base.c


and this doesn't:
gcc `pkg-config --libs --cflags gtk+-2.0`  -static -o base-static


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


Cheers,
               -Tristan

PS:
I sincerely hope I'm wrong ;-)





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