compile error on Mac OS X 10.3 (Panther) and the patch

js ebgssth at
Sun Oct 21 09:04:34 UTC 2007


Compiling memcached(svn trunk ver) failed with these errors.

$ make
make  all-recursive
Making all in doc
make[2]: Nothing to be done for `all'.
source='memcached.c' object='memcached.o' libtool=no \
depfile='.deps/memcached.Po' tmpdepfile='.deps/memcached.TPo' \
depmode=gcc3 /bin/sh ./depcomp \
gcc -DHAVE_CONFIG_H -I. -I. -I.   -I/opt/local/include   -g -O2 -c
`test -f 'memcached.c' || echo './'`memcached.c
memcached.c: In function `add_msghdr':
memcached.c:224: warning: assignment from incompatible pointer type
memcached.c: In function `add_iov':
memcached.c:584: error: `IOV_MAX' undeclared (first use in this function)
memcached.c:584: error: (Each undeclared identifier is reported only once
memcached.c:584: error: for each function it appears in.)
make[2]: *** [memcached.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

This is because OS X 10.3, unlike 10.4, doesn't have IOV_MAX in limits.h.
Below is my patch.

Index: memcached.c
--- memcached.c (revision 629)
+++ memcached.c (working copy)
@@ -52,9 +52,9 @@

-/* FreeBSD 4.x doesn't have IOV_MAX exposed. */
+/* FreeBSD 4.x and old OSX don't have IOV_MAX exposed. */
 #ifndef IOV_MAX
-#if defined(__FreeBSD__)
+#if defined(__FreeBSD__) || defined(__APPLE__)
 # define IOV_MAX 1024

__APPLE__is the flag for darwin.

I don't know whether this is right fix or not
so could someone please review this patch and accept this or write better patch?

Thank you in advance.

More information about the memcached mailing list