Building on MacOS X Server 10.6.3

Vernon Schryver
Fri Jun 11 21:04:02 UTC 2010

I found the problem, but do not see a tolerable solution.  

The DCC source has two files that define the same symbols,
thrlib/clnt_threaded.c in libthr.a and clntlib/clnt_unthreaded.c in
libclnt.a.  thrlib/clnt_threaded.c fiddles with mutexs and so forth
in functions that protect various data structures.  clntlib/clnt_unthreaded.c
defines much the same symbols, but the functions that are stubbs and
do nothing.  The threaded DCC programs, dccm and dccifd, link with
libthr.a first and libclnt.a send.  Programs that are not threaded
including dccproc and cdcc link only with libclnt.a.

According to `ld -why-load` on the MacOS X system, thrlib/clnt_threaded.c
is loaded first.  Then clntlib/clnt_unthreaded.c is loaded to satisfy
references of any one of 4 symbols despite the fact that are defined
in both files and so in principle already defined by the preceding
loading of lib/clnt_threaded.c.  Other apparently similar symbols do
not have that bad effect.

I suspect the problem is a bug in the MacOS X ld and its distinctive
scheme for avoiding the occassional need on other systems to tell
`ld` about a library more than once.

The 4 symbols are variables that happen to have the same contents in
clnt_unthreaded.c and clnt_threaded.c.  In the old days, I'd say they
are in the BSS section.  I tried giving them explicit and differing
values without affecting the problem.  I also tried adding a gratuitous
reference.  I'm not enthused about the kludge of moving the 4 symbols
to some other file, because there's no reason to think that the problem
won't reappear with other symbols in clnt_threaded.c and clnt_unthreaded.c.
Previous versions of dccifd compiled (still compile?) on some versions
of MacOS X.

Is there something else I could do?

I noticed and added a fix for another MacOS X oddity to the 1.3.127
./configure.  It seems that MacOS X has 8 byte off_t's and long int's
but unlike other 64-bit systems, gcc whines about the use of %ld printf(3)
patterns with u_int64's, off_t's, and size_t's.

Vernon Schryver

More information about the DCC mailing list

Contact by mail or use the form.