php-5.x.x 源码编译报指针错误
故障现象
node.c:1953:error dereferencing pointer to incomplete type
php5.2.17 make时报错:
/usr/local/src/php-5.2.17/ext/dom/node.c: In function ‘dom_canonicalization’:
/usr/local/src/php-5.2.17/ext/dom/node.c:1953:21: error: dereferencing pointer to incomplete type
ret = buf->buffer->use;
^
In file included from /usr/local/src/php-5.2.17/main/php.h:38:0,
from /usr/local/src/php-5.2.17/ext/dom/node.c:26:
/usr/local/src/php-5.2.17/ext/dom/node.c:1955:40: error: dereferencing pointer to incomplete type
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
^
/usr/local/src/php-5.2.17/Zend/zend_API.h:472:14: note: in definition of macro ‘ZVAL_STRINGL’
char *__s=(s); int __l=l; \
^
/usr/local/src/php-5.2.17/ext/dom/node.c:1955:5: note: in expansion of macro ‘RETVAL_STRINGL’
RETVAL_STRINGL((char *) buf->buffer->content, ret, 1);
^
make: *** [ext/dom/node.lo] Error 1
解决办法:
在国外的一个网站上找到了这个,其他版本的php也同样适用。
# curl -o php-5.x.x.patch https://mail.gnome.org/archives/xml/2012-August/txtbgxGXAvz4N.txt
# cd php-5.x.x
# patch -p0 -b < ./php-5.x.x.patch
patching file ext/dom/node.c
patching file
ext/dom/documenttype.c
patching file ext/simplexml/simplexml.c
再次编译即可。
后面遇到另外一个报错
以下的错误是:
/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_scanf'
/usr/bin/ld: note: 'ber_scanf' is defined in DSO /lib64/liblber-2.4.so.2 so try adding it to the linker command line
/lib64/liblber-2.4.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
libtool: unrecognized option `-export-dynamic'
Try `libtool --help' for more information.
make: *** [sapi/cli/php] Error 1
/usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_scanf'
/usr/bin/ld: note: 'ber_scanf' is defined in DSO /lib64/liblber-2.4.so.2 so try adding it to the linker command line
/lib64/liblber-2.4.so.2: could not read symbols: Invalid operation
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
解决办法
./configure后
编辑MakeFile
找到 开头是 ‘EXTRA_LIBS’ 这一行 在结尾加上 ‘-llber’ 然后执行 make && make install
原文地址:
http://blog.51cto.com/hhslinux/1951738
http://www.itkeyword.com/doc/0434952374652647031/error%20dereferencing%20pointer%20to%20incomplete%20type