php-5.x.x 源码编译报指针错误

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值