gtk+ app static linking



Hi all,

I want to statically compiled gtk+ application. And I've searched for the mail-list archives for it, knowing that there are some problems statically building gtk+ program. Is there anyone can tell me if there is a solution for it ? What's the solution ? I am eager for it, thanks very much.

My system is Fedora Core3. My simple gtk+ program can work well with dynamically linking. Since I want to build it statically linked, I download the gtk+-2.4 source package and build it with --enable-static. I got the static library libxxx*.a. But when I compiled my program statically linking (add -static in gcc option), errors as following:

/tmp/ccTDQEWx.o(.text+0x3d): In function `main':
: undefined reference to `gtk_set_locale'
/tmp/ccTDQEWx.o(.text+0x4d): In function `main':
: undefined reference to `gtk_init'
/tmp/ccTDQEWx.o(.text+0x7b): In function `main':
: undefined reference to `gtk_window_new'
/tmp/ccTDQEWx.o(.text+0x94): In function `main':
: undefined reference to `gtk_window_get_type'
。。。
。。。


I can see the symbols in my static library, such as gtk_init :
[root busonline gtk]# nm /usr/local/lib/libgtk-x11-2.0.a | grep gtk_init
00000b0c T gtk_init
00001130 T gtk_init_add
00000adc T gtk_init_check
00000028 b gtk_initialized


I wonder, why the errors above occurs ? How can I deal with it ? Isn't there a solution to build gtk+ application statically under linux (FC3) ?





需要一个2000兆的免费邮箱吗?
网易免费邮箱是中国最多人使用的电子邮箱。



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