[Xlibs] Shared library support on Cygwin

Jim Gettys Jim.Gettys@hp.com
Wed, 14 Jan 2004 00:03:41 -0500

On Tue, 2004-01-13 at 13:14, Harold L Hunt II wrote:
> Currently there are two issues with building shared libraries from the 
> xlibs repository on Cygwin:
> 1) We need to set "LDFLAGS = -no-undefined" for all libraries that do 
> not export undefined symbols.  There are ways of doing this such that 
> this flag is only added when compiling on Cygwin.  However, I do not 
> believe that there is an adverse affect to having the flag present when 
> not compiling on Cygwin (it should be ignored if shared libs are allowed 
> to have undefined symbols on the current platform).  Are there any 
> objections to adding this flag to all libs in the xlibs repository that 
> do not export undefined symbols?  Also, is there a volunteer that would 
> like to do this for me?

What's the existence of this flag on non-gcc compilers?  People
will certainly want to be able to use them. We certainly need to get
a wider variety of systems building this stuff to uncover such issues
more easily.  I'll look into seeing if we have any old Alpha's kicking
around we could use, as my contribution here, but in general, in
the long term, I think we need to get a tinderbox set up to make such
changes much safer/faster/less overhead to make than the endless dialogs
we'll have on build issues if we have no routine testing.

If it isn't universal (which I suspect), then provision has to be made
so that this flag wouldn't get passed to a compiler that doesn't
understand it.

So in practice, it will be pragmatism like this that governs any
objections, as far as I can see.

For those not familiar with it, tinderbox is a continuous build/test
environment that a number of projects (most notably Mozilla, who
developed tinderbox) that allows test machines to be anywhere,
and lets them know quickly if any checkin "breaks the build".

> 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.  I checked 
> my build logs for the xc-style tree and I do *not* see Xau being linked 
> to X11.  Is there a reason why Xau is being linked to X11 in the xlibs 
> tree?  If not, can we remove the -lXau from the X11 link line?

Possibly/probably we could remove it; it wouldn't be the first time that
X libraries were linked against libraries unnecessarily.

                               - Jim

Jim Gettys <Jim.Gettys@hp.com>
HP Labs, Cambridge Research Laboratory