Re: static linking



thanks for the follow-up.

but to split hairs: compiling statically is very useful, then i can
deliver my application without the user being required to have gtk+
installed on their platform.  (because when an end-user is not OS-savvy,
installing gtk+ can ultimately mean my application will never run since
they may not be able to successfully install gtk+.  and i must imagine
that the designers of gtk+ did never intend that applications built with
gtk+ aren't runnable simply because the end-user doesn't have access to a
techie.)

so my question remains: is it possible? was it ever thought of in the gtk+
design to allow for this possibility?  or is it such that because the
resulting static application would be necessarily "heavy" (or for any
number of other reasons) this is simply not possible?

thanks,

richard

> On Wed, 2005-05-04 at 15:15 +0200, riboaz xs4all nl wrote:
>> hi,
>>
>> this question was posed during the last week and i was very curious as
>> to
>> the answer, but nothing came across this particular mailing list, so i'm
>> a
>> gonna ask again:
>>
>> how does one link a gtk+ application (v2.6.2) as a static executable?
>>
>> the command
>>     pkg-config --libs
>> always returns
>>     -Wl,--export-dynamic
>>
>> presumably this dynamic link specifier disables static linking (adding
>> -static in the makefile doesn't help).
>>
>> when modifying my makefile by hand and providing the pkg-config
>> libraries
>> explicitly, (but *without* the -dynamic specifier and *with* the -static
>> specifier), the linker complains that the gtk library cannot be found.
>>
>> what i conclude is that the installation of gtk+ does not, by default,
>> create and/or install static libraries.
>>
>> is, thus, a requirement of gtk+ that all applications must run on a
>> machine where gtk+ is installed, or is there another way to compile and
>> install gtk+ so that static libraries are also included, allowing
>> statically linked gtk+ apps?
>
> static linking against gtk+ is not generally useful. You would have to
> compile in all the required modules as well, which are normally dlopened
> at runtime: theme engines, input methods, pixbuf loaders.
>
> Matthias
>
>





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