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

 小菜一蝶2502902341 发布于 2022-12-10 17:49

我需要在运行Mac OS X Yosemite的MacBook Pro上安装libmemcached.

我已经安装了memcached守护进程,但是为了使PHP memcached.so PECL扩展能够工作,我需要安装libmemcached.

我从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.

所以我安装了Bazaar,然后输入以下命令:

bzr branch lp:libmemcached

但我得到的是:

    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.  

如果我尝试运行./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'

还有2个错误:

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

所以实际上我无法安装libmemcached.有什么选择我可以尝试,我该如何解决这个问题?为什么所有这些错误?

感谢您的关注!

希望得到一些帮助.

1 个回答
  • 我已经设法通过更改配置脚本和其中一个源文件来获取libmemcached以在OSX 10.10.3上编译和安装.

    configure我改变了行:

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

    至:

    ac_cv_have_htonll=no
    

    然后在clients/memflush.cc我改变了2个实例:

    if (opt_servers == false)
    

    至:

    if (opt_servers == NULL)
    

    通常configure之后make,sudo make install工作正常(尽管有很多警告).然后该库似乎工作正常,在我的情况下使用pylibmc.

    2022-12-11 02:14 回答
撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有