问答中心分类: PHPphp7.1安装pthread不成功
Milktea 提问 4年 前

根据问答中心https://oneinstack.com/question/974/的方案进行编译,然后报错。

/bin/bash /home/pi/pthreads-3.1.6/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/pi/pthreads-3.1.6 -DPHP_ATOM_INC -I/home/pi/pthreads-3.1.6/include -I/home/pi/pthreads-3.1.6/main -I/home/pi/pthreads-3.1.6 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/home/pi/pthreads-3.1.6/. -DHAVE_CONFIG_H -g -O2 -c /home/pi/pthreads-3.1.6/php_pthreads.c -o php_pthreads.lo
mkdir .libs
cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/pi/pthreads-3.1.6 -DPHP_ATOM_INC -I/home/pi/pthreads-3.1.6/include -I/home/pi/pthreads-3.1.6/main -I/home/pi/pthreads-3.1.6 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -I/home/pi/pthreads-3.1.6/. -DHAVE_CONFIG_H -g -O2 -c /home/pi/pthreads-3.1.6/php_pthreads.c -fPIC -DPIC -o .libs/php_pthreads.o
In file included from /usr/local/php/include/php/Zend/zend_modules.h:26:0,
from /usr/local/php/include/php/Zend/zend_API.h:27,
from /usr/local/php/include/php/main/php.h:39,
from ./src/pthreads.h:37,
from /home/pi/pthreads-3.1.6/php_pthreads.c:22:
./classes/threaded.h: In function ‘zim_Threaded_extend’:
/usr/local/php/include/php/Zend/zend_compile.h:516:39: error: ‘zend_execute_data’ has no member named ‘called_scope’
#define EX(element) ((execute_data)->element)
^
./classes/threaded.h:322:29: note: in expansion of macro ‘EX’
zend_do_inheritance(ce, EX(called_scope));
^
In file included from /usr/local/php/include/php/Zend/zend.h:31:0,
from /usr/local/php/include/php/main/php.h:35,
from ./src/pthreads.h:37,
from /home/pi/pthreads-3.1.6/php_pthreads.c:22:
/usr/local/php/include/php/Zend/zend_compile.h:516:39: error: ‘zend_execute_data’ has no member named ‘called_scope’
#define EX(element) ((execute_data)->element)
^
/usr/local/php/include/php/Zend/zend_types.h:612:5: note: in definition of macro ‘ZVAL_BOOL’
(b) ? IS_TRUE : IS_FALSE; \
^
/usr/local/php/include/php/Zend/zend_API.h:640:31: note: in expansion of macro ‘RETVAL_BOOL’
#define RETURN_BOOL(b) { RETVAL_BOOL(b); return; }
^
./classes/threaded.h:327:5: note: in expansion of macro ‘RETURN_BOOL’
RETURN_BOOL(instanceof_function(ce, EX(called_scope)));
^
./classes/threaded.h:327:41: note: in expansion of macro ‘EX’
RETURN_BOOL(instanceof_function(ce, EX(called_scope)));
^
In file included from ./php_pthreads.h:43:0,
from /home/pi/pthreads-3.1.6/php_pthreads.c:26:
./classes/worker.h: In function ‘zim_Worker_collect’:
./classes/worker.h:53:10: error: ‘zend_fcall_info’ has no member named ‘function_table’
call.fci.function_table = &(w)->ce->function_table; \
^
./classes/worker.h:227:3: note: in expansion of macro ‘PTHREADS_WORKER_COLLECTOR_INIT’
PTHREADS_WORKER_COLLECTOR_INIT(call, Z_OBJ_P(getThis()));
^
./classes/worker.h:55:57: error: ‘zend_fcall_info’ has no member named ‘function_table’
call.fcc.function_handler = zend_hash_find_ptr(call.fci.function_table, Z_STR(call.fci.function_name)); \
^
./classes/worker.h:227:3: note: in expansion of macro ‘PTHREADS_WORKER_COLLECTOR_INIT’
PTHREADS_WORKER_COLLECTOR_INIT(call, Z_OBJ_P(getThis()));
^
In file included from /usr/local/php/include/php/Zend/zend_portability.h:52:0,
from /usr/local/php/include/php/Zend/zend_types.h:27,
from /usr/local/php/include/php/Zend/zend.h:31,
from /usr/local/php/include/php/main/php.h:35,
from ./src/pthreads.h:37,
from /home/pi/pthreads-3.1.6/php_pthreads.c:22:
./classes/pool.h: In function ‘zim_Pool_submit’:
/usr/local/php/include/php/Zend/../TSRM/TSRM.h:171:69: error: ‘zend_executor_globals’ has no member named ‘scope’
#define TSRMG_STATIC(id, type, element) (TSRMG_BULK_STATIC(id, type)->element)
^
/usr/local/php/include/php/Zend/zend.h:57:20: note: in expansion of macro ‘TSRMG_STATIC’
#define ZEND_TSRMG TSRMG_STATIC
^
/usr/local/php/include/php/Zend/zend_globals_macros.h:44:16: note: in expansion of macro ‘ZEND_TSRMG’
# define EG(v) ZEND_TSRMG(executor_globals_id, zend_executor_globals *, v)
^
./classes/pool.h:189:30: note: in expansion of macro ‘EG’
zend_class_entry *scope = EG(scope);
^
/usr/local/php/include/php/Zend/../TSRM/TSRM.h:171:69: error: ‘zend_executor_globals’ has no member named ‘scope’
#define TSRMG_STATIC(id, type, element) (TSRMG_BULK_STATIC(id, type)->element)
^
/usr/local/php/include/php/Zend/zend.h:57:20: note: in expansion of macro ‘TSRMG_STATIC’
#define ZEND_TSRMG TSRMG_STATIC
^
/usr/local/php/include/php/Zend/zend_globals_macros.h:44:16: note: in expansion of macro ‘ZEND_TSRMG’
# define EG(v) ZEND_TSRMG(executor_globals_id, zend_executor_globals *, v)
^
./classes/pool.h:195:4: note: in expansion of macro ‘EG’
EG(scope) = ce;
^
/usr/local/php/include/php/Zend/../TSRM/TSRM.h:171:69: error: ‘zend_executor_globals’ has no member named ‘scope’
#define TSRMG_STATIC(id, type, element) (TSRMG_BULK_STATIC(id, type)->element)
^
/usr/local/php/include/php/Zend/zend.h:57:20: note: in expansion of macro ‘TSRMG_STATIC’
#define ZEND_TSRMG TSRMG_STATIC
^
/usr/local/php/include/php/Zend/zend_globals_macros.h:44:16: note: in expansion of macro ‘ZEND_TSRMG’
# define EG(v) ZEND_TSRMG(executor_globals_id, zend_executor_globals *, v)
^
./classes/pool.h:197:4: note: in expansion of macro ‘EG’
EG(scope) = scope;
^
In file included from /home/pi/pthreads-3.1.6/php_pthreads.c:442:0:
./classes/pool.h:204:8: error: ‘zend_fcall_info’ has no member named ‘function_table’
fci.function_table = EG(function_table);
^
In file included from /usr/local/php/include/php/Zend/zend_portability.h:52:0,
from /usr/local/php/include/php/Zend/zend_types.h:27,
from /usr/local/php/include/php/Zend/zend.h:31,
from /usr/local/php/include/php/main/php.h:35,
from ./src/pthreads.h:37,
from /home/pi/pthreads-3.1.6/php_pthreads.c:22:
/usr/local/php/include/php/Zend/../TSRM/TSRM.h:171:69: error: ‘zend_executor_globals’ has no member named ‘scope’
#define TSRMG_STATIC(id, type, element) (TSRMG_BULK_STATIC(id, type)->element)
^
/usr/local/php/include/php/Zend/zend.h:57:20: note: in expansion of macro ‘TSRMG_STATIC’
#define ZEND_TSRMG TSRMG_STATIC
^
/usr/local/php/include/php/Zend/zend_globals_macros.h:44:16: note: in expansion of macro ‘ZEND_TSRMG’
# define EG(v) ZEND_TSRMG(executor_globals_id, zend_executor_globals *, v)
^
./classes/pool.h:211:25: note: in expansion of macro ‘EG’
fcc.calling_scope = EG(scope);
^
In file included from ./php_pthreads.h:43:0,
from /home/pi/pthreads-3.1.6/php_pthreads.c:26:
./classes/pool.h: In function ‘zim_Pool_collect’:
./classes/worker.h:53:10: error: ‘zend_fcall_info’ has no member named ‘function_table’
call.fci.function_table = &(w)->ce->function_table; \
^
./classes/pool.h:293:4: note: in expansion of macro ‘PTHREADS_WORKER_COLLECTOR_INIT’
PTHREADS_WORKER_COLLECTOR_INIT(call, Z_OBJ_P(worker));
^
./classes/worker.h:55:57: error: ‘zend_fcall_info’ has no member named ‘function_table’
call.fcc.function_handler = zend_hash_find_ptr(call.fci.function_table, Z_STR(call.fci.function_name)); \
^
./classes/pool.h:293:4: note: in expansion of macro ‘PTHREADS_WORKER_COLLECTOR_INIT’
PTHREADS_WORKER_COLLECTOR_INIT(call, Z_OBJ_P(worker));
^
Makefile:196: recipe for target 'php_pthreads.lo' failed
make: *** [php_pthreads.lo] Error 1

注:已经重新编译了php,并开启了线程安全
 
顺便一问,为什么不把pthread加入默认的编译参数里面呢?

1 问题
oneinstack 回答 4年 前

 在https://github.com/php/php-src提交问题试试。
很少用到这个参数,其它模块支持它比较少