简体   繁体   English

如何在Mac OS X Yosemite 10.10上安装libmemcached以便在Mamp 3上安装memcached.so PHP扩展?

[英]How can I install libmemcached for Mac OS X Yosemite 10.10 in order to install the memcached.so PHP extension on Mamp 3?

I need to install libmemcached on my MacBook Pro running Mac OS X Yosemite. 我需要在运行Mac OS X Yosemite的MacBook Pro上安装libmemcached。

I have already installed the memcached daemon, but in order to make the PHP memcached.so PECL extension to work, I need to install libmemcached. 我已经安装了memcached守护进程,但是为了使PHP memcached.so PECL扩展能够工作,我需要安装libmemcached。

I have downloaded the tar.gz from https://launchpad.net/libmemcached/+download , looked at the file README.FIRST: 我从https://launchpad.net/libmemcached/+download下载了tar.gz,查看了文件README.FIRST:

Hi!

If you are getting this code from http://launchpad.net/libmemcached then
continue reading. Otherwise these directions are not for you (well maybe...).

To obtain code from http://bazaar.launchpad.net/libmemcached you will need to
issue the following command:

bzr branch lp:libmemcached

Once the tree is cloned you will need to build the "configure" script. You
can do this by running the script:

./bootstrap.sh autoreconf

It will set up all of the files you need to build libmemcached. At that
point it is just the typical "./configure; make; make test; make install"

For a tarball release do a "make dist" and for an RPM type "make rpm".

For patches, we prefer you push a branch to launchpad and then submit that 
branch to be merged. For more information, see:

https://help.launchpad.net/Code/UploadingABranch
https://help.launchpad.net/Code/Review

Thanks and keep hacking!

Cheers,
  -Brian
  Seattle, WA.

So I have installed Bazaar and then typed the following command: 所以我安装了Bazaar,然后输入以下命令:

bzr branch lp:libmemcached

But what I get is: 但我得到的是:

    bzr: warning: unsupported locale setting
  bzr could not set the application locale.
  Although this should be no problem for bzr itself, it might
  cause problems with some plugins. To investigate the issue,
  look at the output of the locale(1p) tool.
Not checking SSL certificate for xmlrpc.launchpad.net.
You have not informed bzr of your Launchpad ID, and you must do this to
write to Launchpad or access private data.  See "bzr help launchpad-login".
bzr: ERROR: Target directory "libmemcached" already exists.  

And if I try to run ./configure and then make , I get a lot of warnings like: 如果我尝试运行./configure然后make ,我会收到很多警告:

./libmemcached/server.hpp:82:62: warning: implicit conversion loses integer precision: 'uint64_t'
  (aka 'unsigned long long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]

libmemcached/csl/scanner.cc:2070:2: warning: 'register' storage class specifier is deprecated
      [-Wdeprecated-register]

libmemcached/byteorder.cc:75:10: error: use of undeclared identifier 'htonll'

And 2 errors: 还有2个错误:

2 errors generated.
make[1]: *** [libmemcached/libmemcached_libmemcached_la-byteorder.lo] Error 1
make: *** [all] Error 2

So actually I can't install libmemcached. 所以实际上我无法安装libmemcached。 Is there any option I can try, how can I resolve this issue? 有什么选择我可以尝试,我该如何解决这个问题? Why all those errors? 为什么所有这些错误?

Thanks for the attention! 感谢您的关注!

Hope for some help. 希望得到一些帮助。

I've managed to get libmemcached to compile and install on OSX 10.10.3 by changing the configure script and one of the source files. 我已经设法通过更改配置脚本和其中一个源文件来获取libmemcached以在OSX 10.10.3上编译和安装。

In configure I changed the lines: configure我更改了行:

if ac_fn_cxx_try_compile "$LINENO"; then :
    ac_cv_have_htonll=yes
else
    ac_cv_have_htonll=no
fi

to: 至:

ac_cv_have_htonll=no

Then in clients/memflush.cc I changed the 2 instances of: 然后在clients/memflush.cc我更改了2个实例:

if (opt_servers == false)

to: 至:

if (opt_servers == NULL)

After that the usual configure , make , sudo make install worked ok (albeit with lots of warnings). 之后通常的configuremakesudo make install工作正常(尽管有很多警告)。 The library then seems to work fine, with pylibmc in my case. 然后该库似乎工作正常,在我的情况下使用pylibmc。

I know the question was asked ages ago but the problem is in my opinion somewhere else, namely in a missing include. 我知道很久以前就问过这个问题,但问题出在我看来的其他地方,即缺少的问题。

This is how I fixed the issue on (macOS High Sierra 10.13): 这就是我在(macOS High Sierra 10.13)上修复问题的方法:

In bytesorder.cc I added these 3 lines after the byteorder.h include: 在bytesorder.cc中,我在byteorder.h之后添加了这三行:

#if defined HAVE_HTONLL && defined HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM