[XForms] Statically linked application

Todd Denniston Todd.Denniston at ssa.crane.navy.mil
Fri Oct 6 09:04:23 EDT 2006

Jens Thoms Toerring wrote:
> To subscribers of the xforms list
> On Fri, Oct 06, 2006 at 10:36:08AM +0200, Gerald Emig wrote:
>> is there any information available on how to create
>> a statically linked XForms program ?
> Since, as far as I can see, there's a static as well as a dynamic
> version of the XForms library installed per default you should
> mostly only need to use the appropriate compiler/linker flags to
> create a static program. E.g. for gcc you would need the option
> '-static'. But, of course, you also need static library versions
> of all other libraries involved to be installed on your system.
> On mine (Linux) all required libraries (libm, libpthread, libX11,
> libXpm) seem to exist in static versions except glibc, which I
> would have to install in order to be able to create a program
> without any external dependencies. On the other hand, the linker
> just complains a bit about the program still requiring at runtime
> the shared version of glib, but the resulting executable seems to
> work fine, and perhaps you can live with that since a glibc will
> probably exist on all systems you try to run the program on. Other-
> wise install a static version of glibc on the system you build the
> program on. Just don't be surprised about the size difference, a
> small test program that was statically linked - as far as possible,
> i.e. still dependent on the shared glic - is over 4 MB while, when
> linked without '-static', it's only about 10k....
>                                  Regards, Jens

Although I have forgotten how, it is possible to specify how each individual 
library should be linked, i.e., it is possible to tell the compiler link 
libforms static and libc dynamic, thus you could build on a box with Xforms 
and put it on systems that don't have Xforms installed.

Todd Denniston
Crane Division, Naval Surface Warfare Center (NSWC Crane)
Harnessing the Power of Technology for the Warfighter

More information about the Xforms mailing list