system: ubuntu 14.04 server x64 + php 5.5.9
這次是在編譯 php_cconv 這支程式時出現錯誤訊息
$ sudo make
.....
/usr/local/src/cconv-php-0.6.4/php_cconv.c:10:1: error: unknown type name 'function_entry'
static function_entry cconv_functions[] = {
^
.....
make: *** [php_cconv.lo] Error 1
之前在 ubuntu 12.04 + php 5.3.10 環境下編譯沒問題啊
於是就抓 php 原始碼來編看看,因為之前我有編過 pdo
這次也試試編 pdo
$ cd /tmp
$ wget http://tw1.php.net/distributions/php-5.5.14.tar.gz
$ cd /usr/local/src
$ sudo tar zxf /tmp/php-5.5.14.tar.gz
$ cd php-5.5.14/ext/pdo
$ sudo phpize
$ sudo ./configure --with-php-config=/usr/bin/php-config
$ sudo make
.....
Build complete.
Don't forget to run 'make test'.
$ ls -l modules
total 436
-rw-r--r-- 1 root root 926 7月 14 11:57 pdo.la
-rwxr-xr-x 1 root root 441062 7月 14 11:57 pdo.so
編譯成功,查看一下是否有使用 function_entry
$ grep "function_entry" *.c
pdo.c:const zend_function_entry pdo_functions[] = {
pdo_dbh.c:const zend_function_entry pdo_dbh_functions[] = {
pdo_dbh.c: const zend_function_entry *funcs;
pdo_stmt.c:const zend_function_entry pdo_dbstmt_functions[] = {
pdo_stmt.c:const zend_function_entry pdo_row_functions[] = {
嗯~ 要改用 zend_function_entry
---
$ sudo vim php_cconv.c
#include <php.h>
#include <cconv.h>
#include "php_cconv.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//加上這行
#define function_entry zend_function_entry
static function_entry cconv_functions[] = {
PHP_FE(cconv, NULL)
{NULL, NULL, NULL}
};
也可以直接改 function_entry 那行
不過如果有多個地方要改的話
還是用 define 比較省事
也不怕會漏掉沒改到
如果有其他程式要改
就另外建立 h 檔吧
存檔後再 make 一次
這樣就能順利編譯了
^_^