V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lampxiongdi
V2EX  ›  PHP

编译 PHP 扩展出错,哪位大神帮忙看看

  •  
  •   lampxiongdi · 2018-05-05 23:05:21 +08:00 · 5047 次点击
    这是一个创建于 2427 天前的主题,其中的信息可能已经有所发展或是发生改变。

    /bin/sh /home/vagrant/rocketmqphpclient/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/vagrant/rocketmqphpclient -DPHP_ATOM_INC -I/home/vagrant/rocketmqphpclient/include -I/home/vagrant/rocketmqphpclient/main -I/home/vagrant/rocketmqphpclient -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c++11 -g -O2 -c /home/vagrant/rocketmqphpclient/rocketmqclient.cpp -o rocketmqclient.lo libtool: compile: g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/home/vagrant/rocketmqphpclient -DPHP_ATOM_INC -I/home/vagrant/rocketmqphpclient/include -I/home/vagrant/rocketmqphpclient/main -I/home/vagrant/rocketmqphpclient -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -std=c++11 -g -O2 -c /home/vagrant/rocketmqphpclient/rocketmqclient.cpp -fPIC -DPIC -o .libs/rocketmqclient.o In file included from /usr/include/php/Zend/zend_types.h:27:0, from /usr/include/php/Zend/zend.h:29, from /usr/include/php/main/php.h:35, from /home/vagrant/rocketmqphpclient/rocketmqclient.cpp:26: /usr/include/php/Zend/zend_operators.h: In function 'void fast_long_increment_function(zval*)': /usr/include/php/Zend/zend_operators.h:446:68: error: '__builtin_saddl_overflow' was not declared in this scope if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), 1, &lresult))) { ^ /usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

    define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                    ^
    

    /usr/include/php/Zend/zend_operators.h: In function 'void fast_long_decrement_function(zval*)': /usr/include/php/Zend/zend_operators.h:500:68: error: '__builtin_ssubl_overflow' was not declared in this scope if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), 1, &lresult))) { ^ /usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

    define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                    ^
    

    /usr/include/php/Zend/zend_operators.h: In function 'void fast_long_add_function(zval*, zval*, zval*)': /usr/include/php/Zend/zend_operators.h:554:80: error: '__builtin_saddl_overflow' was not declared in this scope if (UNEXPECTED(__builtin_saddl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) { ^ /usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

    define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                    ^
    

    /usr/include/php/Zend/zend_operators.h: In function 'void fast_long_sub_function(zval*, zval*, zval*)': /usr/include/php/Zend/zend_operators.h:657:80: error: '__builtin_ssubl_overflow' was not declared in this scope if (UNEXPECTED(__builtin_ssubl_overflow(Z_LVAL_P(op1), Z_LVAL_P(op2), &lresult))) { ^ /usr/include/php/Zend/zend_portability.h:312:52: note: in definition of macro 'UNEXPECTED'

    define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)

                                                    ^
    

    In file included from /usr/include/php/main/php.h:39:0, from /home/vagrant/rocketmqphpclient/rocketmqclient.cpp:26: /home/vagrant/rocketmqphpclient/rocketmqclient.cpp: At global scope: /usr/include/php/Zend/zend_API.h:178:2: error: 'zend_rocketmqclient_globals' does not name a type zend_##module_name##_globals module_name##_globals; ^

    4 条回复    2018-05-06 19:46:57 +08:00
    dilu
        1
    dilu  
       2018-05-06 10:58:39 +08:00
    没看出什么错误,建议你用 pecl
    wdlth
        2
    wdlth  
       2018-05-06 11:49:28 +08:00   ❤️ 1
    https://bugs.php.net/bug.php?id=75852
    https://forum.phalconphp.com/discussion/17595/problem-with-compiled-phalcon-with-php-721

    因为__builtin_xxx_overflow 是 GCC 高版本才有的,你有几种选择,装一个 GCC 5.x 来编译,或者用编译好的,或者尝试编译旧版本。
    lampxiongdi
        3
    lampxiongdi  
    OP
       2018-05-06 19:35:25 +08:00
    @wdlth 我升级了 gcc 版本 解决了 非常感谢
    lampxiongdi
        4
    lampxiongdi  
    OP
       2018-05-06 19:46:57 +08:00
    @wdlth 兄弟 我是想编译个 rocketmq 的 c 扩展给 php 用 能提供些思路吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3005 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 11:04 · PVG 19:04 · LAX 03:04 · JFK 06:04
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.