Building on MacOS X Server 10.6.3

Vernon Schryver vjs@calcite.rhyolite.com
Sat Jun 12 19:09:22 UTC 2010


More time found more about the problem.  I suspect but can't prove it
is a new bug in the MacOS X `ranlib -c`.  For years I've used `ranlib -c`
on MacOS X to get `ld` link forward references to variables, using this
feature from the MacOS X ranlib man page:

   -c     Include  common symbols as definitions with respect to the table
	  of contents.  This is seldom the intended behavior  for  linking
	  from  a  library,  as  it forces the linking of a library member
	  just because it uses an uninitialized global that  is  undefined
	  at  that  point  in  the  linking.  This option is included only
	  because this was the original behavior of ranlib.   This  option
	  is not the default.

The current and I think new problem is that Apple has an odd notion of
"undefined at that point in the linking" as demonstrated with this test:

  #! /bin/sh -x

  echo 'int v; extern int f(void); main(){ f(); }' >m.c 
  cc -c -o m.o m.c
  echo 'extern int v; int f(void) { return v;}' >l1.c
  cc -c -o l1.o l1.c
  echo 'int v; extern int ndef(void); int nused(void) {return ndef();}' >l2.c
  cc -c -o l2.o l2.c
  rm -f libt.a
  ar qcs libt.a l1.o l2.o
  ranlib -c libt.a
  cc m.o libt.a -o m -whyload

The link-load fails after `ranlib -c` by ignoring the definition of "v"
in m.o before the reference in l1.o.  It works without `ranlib -c`.

None of the other supported DCC  platforms an that need `ranlib`
als needed `ranlib -c`.  They use the old BSD library re-ordering
mechanism or something else to avoid caring about the order of
binary files in libraries.
`man ar` on MacOS X 10 says that `ar qcs` invokes `ranlib`,
so for DCC 2.3.127 I've shuffled variables among files and removed
the need for and use of `ranlib -c` on MacOS X.


It would be interesting to check dccm builds on the test system, but
dccm needs the sendmail milter library and header files.  I tried
building sendmail 8.14.4 to get the library, but that fails completely.
I guess no one cares about sendmail on MacOS X.

Realsoonnow I'll release DCC version 1.3.127


Vernon Schryver    vjs@rhyolite.com



More information about the DCC mailing list

Contact vjs@rhyolite.com by mail or use the form.