how to static link?

Charles S. Wilson
Wed Jun 13 08:31:00 GMT 2001

Corinna Vinschen wrote:
> On Wed, Jun 13, 2001 at 11:11:21AM +0800, D G wrote:
> > I've tried linking with gcc -static, and even specified static libraries as /usr/X11R6/lib/libX11.a, but still cygwin produces a dynamically linked executable.  How can I compile a statically linked executable?
> You can't. Cygwin isn't statically linkable.

Corinna is referring to the cygwin1.dll dependency.  However, the X11
libraries are ALSO only distributed as dll's --- that "libX11.a" file is
NOT a static lib.  It's an import lib for /usr/X11R6/bin/libX11.dll.

Some libraries are distributed in the cygwin package as both static libs
and as dll's (zlib, libpng, a few others).  You may use -static along
with certain compiletime flags to force static linking to *those*
libraries --- but you'll still be dynamically linked to cygwin1.dll and
the Xlibs.  For more information, see the README's in /usr/doc/Cygwin/


Want to unsubscribe from this list?
Check out:

More information about the Cygwin mailing list