libmemcached does not compile on Mac OS X Mavericks

Bug #1245562 reported by Camilo Sperberg on 2013-10-28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Brian Aker

Bug Description

I'm trying to compile libmemcached and it doesn't go beyond one specific point. I am no C expert so I really don't know where to go further. I've tried to manually adjust some values in the Makefile but I did just mess it up more.

./configure works fine, problem comes with make (output from make --debug):

  Must remake target `tests/memerror'.
  CXXLD tests/memcat
   File `tests/memslap' does not exist.
  Must remake target `tests/memslap'.
  CXXLD tests/memerror
   File `tests/memdump' does not exist.
  Must remake target `tests/memdump'.
  CXXLD tests/memslap
  CXXLD tests/memdump
 File `all-am' does not exist.
   File `tests/libmemcached-1.0/internals' does not exist.
 File `all-am' does not exist.
   File `tests/libmemcached-1.0/internals' does not exist.
 File `all-am' does not exist.
   File `tests/libmemcached-1.0/internals' does not exist.
 File `all-am' does not exist.
   File `tests/libmemcached-1.0/internals' does not exist.
^Cmake[1]: *** [libmemcachedinternal/] Interrupt: 2
make: *** [all] Interrupt: 2

At the point of the last:
 File `all-am' does not exist.
   File `tests/libmemcached-1.0/internals' does not exist.

It just waits and nothing happens. I've waited for over an hour and still nothing. I've downgraded all the way back to 1.0.14 and still the same error.

Maybe it is an version problem error?

Configure command gives the following information at the end, if you need any more information, please do ask for it.

Configuration summary for libmemcached version 1.0.14

   * Installation prefix: /usr/local
   * System type: apple-darwin13.0.0
   * Host CPU: x86_64
   * C Compiler: i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
   * C Flags: -g -O2 -Wno-pragmas -Wall -Wextra -Wunknown-pragmas -std=c99 --param=ssp-buffer-size=1 -Wno-attributes -Waddress -Wbad-function-cast -Wchar-subscripts -Wcomment -Wfloat-equal -Wformat-security -Wformat=2 -Wmissing-field-initializers -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wnormalized=id -Woverride-init -Wpointer-arith -Wpointer-sign -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wunused -Wunused-variable -Wwrite-strings -fwrapv -pipe
   * C++ Compiler: i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
   * C++ Flags: -g -O2 -Wno-pragmas -Wall -Wextra -Wunknown-pragmas --param=ssp-buffer-size=1 -Wno-attributes -Waddress -Wchar-subscripts -Wcomment -Wctor-dtor-privacy -Wfloat-equal -Wformat=2 -Wmissing-field-initializers -Wnon-virtual-dtor -Wnormalized=id -Woverloaded-virtual -Wpointer-arith -Wredundant-decls -Wshadow -Wshorten-64-to-32 -Wsign-compare -Wstrict-overflow=1 -Wswitch-enum -Wundef -Wunused -Wunused-variable -Wwrite-strings -Wformat-security -fwrapv
   * CPP Flags: -fvisibility=hidden
   * LIB Flags: -z -pie
   * Assertions enabled: no
   * Debug enabled: no
   * Warnings as failure: no
   * SASL support: yes
   * make -j: 5
   * VCS checkout: no


Brian Aker (brianaker) on 2013-12-02
Changed in libmemcached:
status: New → In Progress
assignee: nobody → Brian Aker (brianaker)
Alexandre Carmel-Veilleux (acv) wrote :

To compile the latest stable with the latest Xcode on OS X Mavericks I had to change the the file clients/ to add an explicit cast to avoid the errors:

clients/ error: comparison between pointer and integer ('char *' and 'int')
  if (opt_servers == false)
      ~~~~~~~~~~~ ^ ~~~~~
clients/ error: comparison between pointer and integer ('char *' and 'int')
    if (opt_servers == false)
        ~~~~~~~~~~~ ^ ~~~~~

I casted false to (char *). Obviously on this platform char * is 64 bit and int is 32.

Alexandre Carmel-Veilleux (acv) wrote :

The issue originally reported here might well be that this test:


Never terminates or gets beyond:

testapp.generate.generate_data 0:205257000 [ ok ]

chinalu (chinalu) wrote :

Just replace `false` with NULL

Camilo Sperberg (m0) wrote :

Replacing clients/ and clients/ with

if (opt_servers == NULL)

instead of

if (opt_servers == false)

 allowed me to compile without problems on the latest stable release (1.0.18).


Denis Denisov (denji0k) wrote :

New patch support OSX Yosemite 10.10 and make cross-platform compatibility OS

Maxime (max44410) wrote :

I'm using the stable version of libmemcached-1.0.18:

Extract the archive and try to patch it but it's failing for the last file:

$ tar xvf libmemcached-1.0.18.tar.gz
$ cd libmemcached-1.0.18
$ patch -p1 -i ~/Downloads/fix-osx.diff
patching file clients/
patching file example/
patching file libmemcached-1.0/memcached.h
patching file libmemcached/
Hunk #1 FAILED at 39.
1 out of 1 hunk FAILED -- saving rejects to file libmemcached/

Maxime (max44410) wrote :

Thanks Denis, I could compile it with many warning, but it compiled.
I've ended up using your homebrew recipe

$ brew install
$ brew link --overwrite libmemcached

And then I could install php-memcached

$ brew install php55-memcached

Sean Burke (sburke) wrote :

I am concerned about the patch at

The change to appears to dereference a pointer that is possibly null:

- if (opt_servers == false)
+ if (*opt_servers != NULL)

Denis Denisov (denji0k) wrote :

- if (opt_servers == false)
+ if (opt_servers != NULL)

Sean Burke (sburke) wrote :

Umm, not quite. I think we just want:

- if (opt_servers == false)
+ if (opt_servers == NULL)

Also, while I don't find fault with the patch to,
there is a more straightforward fix. The compilation error
arises because HAVE_HTONLL is defined, but sys/types.h
has not been included:

diff --git a/src/libmemcached/libmemcached/ b/src/libmemcached/libmemcached/
index 9f11aa8..cc5ff42 100644
--- a/src/libmemcached/libmemcached/
+++ b/src/libmemcached/libmemcached/
@@ -38,6 +38,10 @@
 #include "mem_config.h"
 #include "libmemcached/byteorder.h"

+# include <sys/types.h>

Denis Denisov (denji0k) wrote :

+# include <sys/types.h>

In file included from libmemcached/csl/
In file included from ./libmemcached/csl/common.h:50:
In file included from ./libmemcached/common.h:114:
./libmemcached-1.0/memcached.h:46:12: fatal error: 'cinttypes' file not found
# include <cinttypes>
1 error generated.
make[1]: *** [libmemcached/csl/libmemcached_libmemcached_la-context.lo] Error 1
make: *** [install] Error 2

Sean Burke (sburke) wrote :

Hi Denis,

I am not seeing that error in my build, but I am building on OSX 10.10.1 with Xcode 6.1.1,
so perhaps that is the reason. Still, I am surprised that you include <sys/types.h> in, and the result is a compilation failure in


Sean Burke (sburke) wrote :

OK, but the report that you link, builds the 1.0.18 release.
You led me to believe that the "fatal error: 'cinttypes' file not found"
was an effect of my proposed patch.

The homebrew failure seems more closely related to,
which fixes an issue with <cinttypes> Mavericks - I guess that Mountain Lion
requires a different fix?

Denis Denisov (denji0k) wrote :

I trust more code API platforms, rather than in broken header file.
Maybe next time will check your option.

Sean Burke (sburke) wrote :

OK, I see what the problem is with <cinttypes>.

The fix for bug 1216521 is to configure the location of <cinttypes>.
The autoconf rule is in m4/have_cinttypes.m4, and the homebrew build log
that Denis has linked, shows it being evaluated, finding it is actually in

    checking for location of cinttypes... <tr1/cinttypes>

This generates some autoconf macros in mem_config.h (and here I
show examples from my Yosemite build, so "tr1/" prefix is absent):

    /* the location of <cinttypes> */
    #define CINTTYPES_H <cinttypes>

    #if defined(__cplusplus)
    # include CINTTYPES_H
    # include <inttypes.h>

So, the real problem is in libmemcached-1.0/memcached.h,
which fails to use the autoconf macro CINTTYPES_H:

    #ifdef __cplusplus
    # include <cinttypes>

Changing the line above, should fix the Mountain Lion build problem.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers