memcached on MacOS X

Evan Martin
12 Aug 2003 16:37:48 -0700

On Tue, 2003-08-12 at 15:46, Brion Vibber wrote:
> For an unrelated project I'm considering using memcached on a MacOS X box
> to spare me from the slowness that is FileMaker Pro.
> With a just-checked-out CVS I can configure and compile, but it fails to
> link if set to produce a static executable, which is the default:
> gcc -DNDEBUG -g -O2 -static   -o memcached  memcached.o slabs.o items.o
> assoc.o  -levent
> ld: can't locate file for: -lcrt0.o
> make[1]: *** [memcached] Error 1
> make: *** [all] Error 2

This is exactly the problem I had, and I couldn't figure it out.
If you have any hints, I'm all ears---

Ooh, wait, I found it!

Q: I'm trying to link my binary statically, but it's failing to link
because it can't find 'crt0.o.' Why?

A: Static linking of user binaries is not supported on Mac OS X. Tying
user binaries to the internal implementation of Mac OS X libraries and
interfaces would limit our ability to update and enhance Mac OS X.
Instead, dynamic linking is supported (linking against crt1.o
automatically instead of looking for crt0.o, for example).

Hah!  That's funny.  I wonder if it's a Darwin limitation, or...?

On the TODO for me, then:  have autoconf detect you're on Darwin and
force the static flag off.

Evan Martin