[Xlibs] Shared library support on Cygwin

Keith Packard keithp@keithp.com
Wed, 14 Jan 2004 15:04:42 +1030


Around 13 o'clock on Jan 13, Harold L Hunt II wrote:

> 1) We need to set "LDFLAGS = -no-undefined" for all libraries that do 
> not export undefined symbols. 

I believe this can't be used in Xlib because of pthread functions called 
while threading is enabled -- on some systems, these functions are found 
in -lpthread, and Xlib isn't explicitly linked to pthread to avoid mapping 
that file in every application on the system.

> 2) This may be related to #1... but Xau is being directly linked when 
> X11 is linked.  Currently, Xau is built as static (but the question is, 
> does it have to be static, or does it not export undefined symbols?); on 
> Cygwin, shared libraries cannot be linked to static libraries, so X11 
> will be forced to be static only if linked to a static Xau.

The few Xau functions used in Xlib used to be compiled by linking the 
source files into the Xlib directory and building them there.  I changed 
this to build Xau as a shared library and just use that.  I don't know if 
this is the right way of doing stuff.  If you want to change this, I 
suggest using the same mechanism as used by xtrans -- have Xau install the 
necessary source files into an include directory and building them into 
Xlib by creating a .c file that references them.

If you just want to leave stuff alone, you should be able to build/install 
Xau and then X11 will use the shared version of the library that should 
get installed just fine.

I don't have a strong opinion here; sharing code is good, but there aren't 
a huge number of applications using other Xau code, and having another 
library mapped into ever X application is bad.

-keith