使用pecl编译OCI8时出错

时间:2012-03-01 15:21:52

标签: php c pecl oci8

当我想用pecl安装ico8时,我收到以下错误。

我正在使用Mac OS X Lion运行MAMP(PHP5.3.6)。梨子& pecl似乎安装正确。

我一直在寻找几个小时,似乎无法解决它,似乎无法找到任何信息。有人有想法吗?

$ sudo pecl install oci8
downloading oci8-1.4.7.tgz ...
Starting to download oci8-1.4.7.tgz (168,584 bytes)
.....................................done: 168,584 bytes
10 source files, building
WARNING: php_bin /Applications/MAMP/bin/php/php5.3.6/bin/php appears to have a suffix /php5.3.6/bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/usr/local/instantclient
building in /private/tmp/pear/install/pear-build-rootKYpQWs/oci8-1.4.7
running: /private/tmp/pear/install/oci8/configure --with-oci8=instantclient,/usr/local/instantclient
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 for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
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-darwin11.3.0
checking host system type... i386-apple-darwin11.3.0
checking target system type... i386-apple-darwin11.3.0
checking for PHP prefix... /Applications/MAMP/bin/php/php5.3.6
checking for PHP includes... -I/Applications/MAMP/bin/php/php5.3.6/include/php -I/Applications/MAMP/bin/php/php5.3.6/include/php/main -I/Applications/MAMP/bin/php/php5.3.6/include/php/TSRM -I/Applications/MAMP/bin/php/php5.3.6/include/php/Zend -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext/date/lib
checking for PHP extension directory... /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626
checking for PHP installed headers prefix... /Applications/MAMP/bin/php/php5.3.6/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 for Oracle Database OCI8 support... yes, shared
checking PHP version... 5.3.6, ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of long int... 8
checking checking if we're on a 64-bit platform... yes
checking Oracle Instant Client directory... /usr/local/instantclient
checking Oracle Instant Client SDK header directory... /usr/local/instantclient/sdk/include
checking Oracle Instant Client library version compatibility... 10.1
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... no
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /Applications/Xcode.app/Contents/Developer/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 /Applications/Xcode.app/Contents/Developer/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 (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.3.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/install/pear-build-rootKYpQWs/oci8-1.4.7/libtool --mode=compile cc  -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-rootKYpQWs/oci8-1.4.7/include -I/private/tmp/pear/install/pear-build-rootKYpQWs/oci8-1.4.7/main -I/private/tmp/pear/install/oci8 -I/Applications/MAMP/bin/php/php5.3.6/include/php -I/Applications/MAMP/bin/php/php5.3.6/include/php/main -I/Applications/MAMP/bin/php/php5.3.6/include/php/TSRM -I/Applications/MAMP/bin/php/php5.3.6/include/php/Zend -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext/date/lib -I/usr/local/instantclient/sdk/include  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/install/oci8/oci8.c -o oci8.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/install/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/install/pear-build-rootKYpQWs/oci8-1.4.7/include -I/private/tmp/pear/install/pear-build-rootKYpQWs/oci8-1.4.7/main -I/private/tmp/pear/install/oci8 -I/Applications/MAMP/bin/php/php5.3.6/include/php -I/Applications/MAMP/bin/php/php5.3.6/include/php/main -I/Applications/MAMP/bin/php/php5.3.6/include/php/TSRM -I/Applications/MAMP/bin/php/php5.3.6/include/php/Zend -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext -I/Applications/MAMP/bin/php/php5.3.6/include/php/ext/date/lib -I/usr/local/instantclient/sdk/include -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/install/oci8/oci8.c  -fno-common -DPIC -o .libs/oci8.o
In file included from /private/tmp/pear/install/oci8/oci8.c:35:
In file included from /Applications/MAMP/bin/php/php5.3.6/include/php/main/php.h:34:
In file included from /Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend.h:237:
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:55:1: error: unknown type name 'ZEND_API'
ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:55:10: error: expected identifier or '('
ZEND_API char *zend_strndup(const char *s, unsigned int length) ZEND_ATTRIBUTE_MALLOC;
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:57:1: error: unknown type name 'ZEND_API'
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:57:10: error: expected identifier or '('
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:58:1: error: unknown type name 'ZEND_API'
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:58:10: error: expected identifier or '('
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:59:1: error: unknown type name 'ZEND_API'
ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC;
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:59:10: error: expected identifier or '('
ZEND_API void *_safe_malloc(size_t nmemb, size_t size, size_t offset) ZEND_ATTRIBUTE_MALLOC;
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:60:1: error: unknown type name 'ZEND_API'
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:60:10: error: expected identifier or '('
ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:61:1: error: unknown type name 'ZEND_API'
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:61:10: error: expected identifier or '('
ZEND_API void *_ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:62:1: error: unknown type name 'ZEND_API'
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:62:10: error: expected identifier or '('
ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:63:1: error: unknown type name 'ZEND_API'
ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:63:10: error: expected identifier or '('
ZEND_API void *_safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC);
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:64:1: error: unknown type name 'ZEND_API'
ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:64:10: error: expected identifier or '('
ZEND_API void *_safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset);
         ^
/Applications/MAMP/bin/php/php5.3.6/include/php/Zend/zend_alloc.h:65:1: error: unknown type name 'ZEND_API'
ZEND_API char *_estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [oci8.lo] Error 1
ERROR: `make' failed

1 个答案:

答案 0 :(得分:1)

刚遇到这个问题。 PECL正在使用正则表达式,它使用文件夹名称,就好像它本身就是php一样。这就是为什么你得到奇怪的“php似乎有一个后缀/php5.3.6/bin/php。”

据推测这就是事情失败的原因 - PECL不知道php在哪里。要摆弄pear.conf,看看我是不是能看到我的系统的php而不是。

在第245行的Builder.php中:

    if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php(.+)?$/',
                   $this->config->get('php_bin'), $matches)) {
        if (isset($matches[2]) && strlen($matches[2]) &&
            trim($matches[2]) != trim($this->config->get('php_prefix'))) {
            $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') .
                       ' appears to have a prefix ' . $matches[2] . ', but' .
                       ' config variable php_prefix does not match');
        }

        if (isset($matches[3]) && strlen($matches[3]) &&
            trim($matches[3]) != trim($this->config->get('php_suffix'))) {
            $this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') .
                       ' appears to have a suffix ' . $matches[3] . ', but' .
                       ' config variable php_suffix does not match');
        }
    }