在更新OS X之后,我发现很多我以前构建的扩展已经消失;(
现在我正在尝试编译memcached.so,结果我有很多错误;(
我安装了XCode命令行工具并运行如下编译:
sudo pecl install memcached
结果:
downloading memcached-2.1.0.tgz ...
Starting to download memcached-2.1.0.tgz (39,095 bytes)
..
........done: 39,095 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version: 20100412
Zend Module Api No: 20100525
Zend Extension Api No: 220100525
building in /private/tmp/pear/temp/pear-build-rootTquTDl/memcached-2.1.0
running: /private/tmp/pear/temp/memcached/configure
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i386-apple-darwin13.0.0
checking host system type... i386-apple-darwin13.0.0
checking target system type... i386-apple-darwin13.0.0
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20100525
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking whether to enable memcached support... yes, shared
checking for libmemcached... yes, shared
checking whether to enable memcached session handler support... yes
checking whether to enable memcached igbinary serializer support... no
checking whether to enable memcached json serializer support... no
checking whether to disable memcached sasl support... no
checking for ZLIB... yes, shared
checking for zlib location... /usr
checking for session includes... /usr/include/php
checking for memcached session support... enabled
checking for memcached igbinary support... disabled
checking for libmemcached location... /usr/local
checking for ld used by cc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... yes
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin13.0.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootTquTDl/memcached-2.1.0/libtool --mode=compile cc -I/usr/include/php -I. -I/private/tmp/pear/temp/memcached -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootTquTDl/memcached-2.1.0/include -I/private/tmp/pear/temp/pear-build-rootTquTDl/memcached-2.1.0/main -I/private/tmp/pear/temp/memcached -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/memcached/php_memcached.c -o php_memcached.lo
mkdir .libs
cc -I/usr/include/php -I. -I/private/tmp/pear/temp/memcached -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-rootTquTDl/memcached-2.1.0/include -I/private/tmp/pear/temp/pear-build-rootTquTDl/memcached-2.1.0/main -I/private/tmp/pear/temp/memcached -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/memcached/php_memcached.c -fno-common -DPIC -o .libs/php_memcached.o
/private/tmp/pear/temp/memcached/php_memcached.c:318:82: error: unknown type name 'memcached_server_instance_st'; did you mean 'memcached_server_list_st'?
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
memcached_server_list_st
/usr/local/include/libmemcached-1.0/types.h:75:37: note: 'memcached_server_list_st' declared here
typedef struct memcached_server_st *memcached_server_list_st;
^
/private/tmp/pear/temp/memcached/php_memcached.c:319:77: error: unknown type name 'memcached_server_instance_st'; did you mean 'memcached_server_list_st'?
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
memcached_server_list_st
/usr/local/include/libmemcached-1.0/types.h:75:37: note: 'memcached_server_list_st' declared here
typedef struct memcached_server_st *memcached_server_list_st;
^
/private/tmp/pear/temp/memcached/php_memcached.c:320:79: error: unknown type name 'memcached_server_instance_st'; did you mean 'memcached_server_list_st'?
static memcached_return php_memc_do_version_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
memcached_server_list_st
/usr/local/include/libmemcached-1.0/types.h:75:37: note: 'memcached_server_list_st' declared here
typedef struct memcached_server_st *memcached_server_list_st;
^
/private/tmp/pear/temp/memcached/php_memcached.c:599:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
payload = memcached_result_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:797:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
payload = memcached_result_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:800:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
res_key = memcached_result_key_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:1014:14: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
payload = memcached_result_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:1017:14: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
res_key = memcached_result_key_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:1068:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
payload = memcached_result_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:1071:15: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
res_key = memcached_result_key_value(&result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:1948:15: warning: incompatible pointer types assigning to 'memcached_server_function' (aka 'memcached_return_t (*)(const memcached_st *, const memcached_instance_st *, void *)') from 'memcached_return (const memcached_st *, memcached_server_list_st, void *)' [-Wincompatible-pointer-types]
callbacks[0] = php_memc_do_serverlist_callback;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:1977:9: warning: incompatible pointer types assigning to 'memcached_server_st *' (aka 'struct memcached_server_st *') from 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
server = memcached_server_by_key(m_obj->memc, server_key, server_key_len, &error);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:2056:15: warning: incompatible pointer types assigning to 'memcached_server_function' (aka 'memcached_return_t (*)(const memcached_st *, const memcached_instance_st *, void *)') from 'memcached_return (const memcached_st *, memcached_server_list_st, void *)' [-Wincompatible-pointer-types]
callbacks[0] = php_memc_do_stats_callback;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:2089:15: warning: incompatible pointer types assigning to 'memcached_server_function' (aka 'memcached_return_t (*)(const memcached_st *, const memcached_instance_st *, void *)') from 'memcached_return (const memcached_st *, memcached_server_list_st, void *)' [-Wincompatible-pointer-types]
callbacks[0] = php_memc_do_version_callback;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:2319:13: warning: comparison of unsigned enum expression < 0 is always false [-Wtautological-compare]
if (flag < 0 ||
~~~~ ^ ~
/private/tmp/pear/temp/memcached/php_memcached.c:2576:82: error: unknown type name 'memcached_server_instance_st'; did you mean 'memcached_server_list_st'?
static memcached_return php_memc_do_serverlist_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
memcached_server_list_st
/usr/local/include/libmemcached-1.0/types.h:75:37: note: 'memcached_server_list_st' declared here
typedef struct memcached_server_st *memcached_server_list_st;
^
/private/tmp/pear/temp/memcached/php_memcached.c:2583:56: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
add_assoc_string(array, "host", memcached_server_name(instance), 1);
^~~~~~~~
/usr/include/php/Zend/zend_API.h:388:111: note: expanded from macro 'add_assoc_string'
#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
^
/usr/local/include/libmemcached-1.0/server.h:101:65: note: passing argument to parameter 'self' here
const char *memcached_server_name(const memcached_instance_st * self);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2583:34: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
add_assoc_string(array, "host", memcached_server_name(instance), 1);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_API.h:388:111: note: expanded from macro 'add_assoc_string'
#define add_assoc_string(__arg, __key, __str, __duplicate) add_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __duplicate)
^
/usr/include/php/Zend/zend_API.h:379:82: note: passing argument to parameter 'str' here
ZEND_API int add_assoc_string_ex(zval *arg, const char *key, uint key_len, char *str, int duplicate);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2584:54: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
add_assoc_long(array, "port", memcached_server_port(instance));
^~~~~~~~
/usr/include/php/Zend/zend_API.h:383:92: note: expanded from macro 'add_assoc_long'
#define add_assoc_long(__arg, __key, __n) add_assoc_long_ex(__arg, __key, strlen(__key)+1, __n)
^
/usr/local/include/libmemcached-1.0/server.h:104:63: note: passing argument to parameter 'self' here
in_port_t memcached_server_port(const memcached_instance_st * self);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2593:77: error: unknown type name 'memcached_server_instance_st'; did you mean 'memcached_server_list_st'?
static memcached_return php_memc_do_stats_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
memcached_server_list_st
/usr/local/include/libmemcached-1.0/types.h:75:37: note: 'memcached_server_list_st' declared here
typedef struct memcached_server_st *memcached_server_list_st;
^
/private/tmp/pear/temp/memcached/php_memcached.c:2599:71: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:101:65: note: passing argument to parameter 'self' here
const char *memcached_server_name(const memcached_instance_st * self);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2599:104: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:104:63: note: passing argument to parameter 'self' here
in_port_t memcached_server_port(const memcached_instance_st * self);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2637:79: error: unknown type name 'memcached_server_instance_st'; did you mean 'memcached_server_list_st'?
static memcached_return php_memc_do_version_callback(const memcached_st *ptr, memcached_server_instance_st instance, void *in_context)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
memcached_server_list_st
/usr/local/include/libmemcached-1.0/types.h:75:37: note: 'memcached_server_list_st' declared here
typedef struct memcached_server_st *memcached_server_list_st;
^
/private/tmp/pear/temp/memcached/php_memcached.c:2644:71: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:101:65: note: passing argument to parameter 'self' here
const char *memcached_server_name(const memcached_instance_st * self);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2644:104: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
hostport_len = spprintf(&hostport, 0, "%s:%d", memcached_server_name(instance), memcached_server_port(instance));
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:104:63: note: passing argument to parameter 'self' here
in_port_t memcached_server_port(const memcached_instance_st * self);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2646:36: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
memcached_server_major_version(instance),
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:113:70: note: passing argument to parameter 'ptr' here
uint8_t memcached_server_major_version(const memcached_instance_st * ptr);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2647:36: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
memcached_server_minor_version(instance),
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:116:70: note: passing argument to parameter 'ptr' here
uint8_t memcached_server_minor_version(const memcached_instance_st * ptr);
^
/private/tmp/pear/temp/memcached/php_memcached.c:2648:36: warning: incompatible pointer types passing 'memcached_server_list_st' (aka 'struct memcached_server_st *') to parameter of type 'const memcached_instance_st *' (aka 'const struct memcached_instance_st *') [-Wincompatible-pointer-types]
memcached_server_micro_version(instance));
^~~~~~~~
/usr/local/include/libmemcached-1.0/server.h:119:70: note: passing argument to parameter 'ptr' here
uint8_t memcached_server_micro_version(const memcached_instance_st * ptr);
^
/private/tmp/pear/temp/memcached/php_memcached.c:3191:14: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
payload = memcached_result_value(result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/private/tmp/pear/temp/memcached/php_memcached.c:3194:14: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
res_key = memcached_result_key_value(result);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 warnings and 6 errors generated.
make: *** [php_memcached.lo] Error 1
ERROR: `make' failed
有什么办法吗?谢谢.
解决方法:
在2.1.0版中,修补了文件php_libmemcached_compat.h
cd / private / tmp / pear / temp / memcached
在php_libmemcached_compat.h中添加一行:
typedef const struct memcached_server_st * memcached_server_instance_st;
sudo ./configure
sudo make
sudo make install
而已.