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

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


Hi,

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 @@
 #endif
 #endif

-/* 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
 #endif
 #endif

__APPLE__is the flag for darwin.
http://www.google.com/codesearch?hl=en&q=+lang:c+darwin-c.c+__APPLE__+show:jXyBUL4_D4k:I24eDuyXrWQ:BPY6ixvGT5I&sa=N&cd=1&ct=rc&cs_p=http://gcc.fyxm.net/prerelease-4.1.2-20070128/gcc-core-4.1.2-20070128.tar.bz2&cs_f=gcc-4.1.2-20070128/gcc/config/darwin-c.c#first

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