我正试图在我的Mac Sierra / PHP 7.1上运行Trader PECL extension,但无济于事。
我用过:
sudo pecl install trader
并得到了(结果的尾声):
Build process completed successfully
Installing '/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so'
Warning: Invalid argument supplied for foreach() in Validator.php on line 870
Warning: Invalid argument supplied for foreach() in /usr/local/pear/share/pear/PEAR/PackageFile/v2/Validator.php on line 870
Warning: Invalid argument supplied for foreach() in v2.php on line 1664
Warning: Invalid argument supplied for foreach() in /usr/local/pear/share/pear/PEAR/PackageFile/v2.php on line 1664
Warning: Invalid argument supplied for foreach() in v2.php on line 1664
Warning: Invalid argument supplied for foreach() in /usr/local/pear/share/pear/PEAR/PackageFile/v2.php on line 1664
install ok: channel://pecl.php.net/trader-0.4.0
configuration option "php_ini" is not set to php.ini location
You should add "extension=trader.so" to php.ini
然后我补充道:
extension=/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303
/trader.so
and restarted Apache. After typing php -m, I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so' - dlopen(/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so, 9): no suitable image found. Did find:
/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so: mach-o, but wrong architecture
/Applications/AMPPS/php-7.1/lib/extensions/no-debug-non-zts-20160303/trader.so: mach-o, but wrong architecture in Unknown on line 0
行;所以我的错误告诉我,我使用的是错误的架构。如何更改架构以使扩展有效?
更新:按照建议,我尝试按源编译,现在收到错误:
/Users/me/downloads/trader-0.2.2/trader-0.2.2/functions/trader_acos.c:61:2: error: too many arguments provided to
function-like macro invocation
TRADER_DBL_ZARR_TO_ARR(zinReal, inReal)
^
./php_trader.h:243:37: note: expanded from macro 'TRADER_DBL_ZARR_TO_ARR'
zend_hash_get_current_data(ht, (void **)&data) == SUCCESS; \
^
/Applications/AMPPS/php-7.1/include/php/Zend/zend_hash.h:214:9: note: macro 'zend_hash_get_current_data' defined here
#define zend_hash_get_current_data(ht) \
^
/Users/me/downloads/trader-0.2.2/trader-0.2.2/functions/trader_acos.c:61:2: error: use of undeclared identifier
'zend_hash_get_current_data'; did you mean 'zend_hash_get_current_data_ex'?
TRADER_DBL_ZARR_TO_ARR(zinReal, inReal)
^
./php_trader.h:243:6: note: expanded from macro 'TRADER_DBL_ZARR_TO_ARR'
zend_hash_get_current_data(ht, (void **)&data) == SUCCESS; \
^
/Applications/AMPPS/php-7.1/include/php/Zend/zend_hash.h:198:30: note: 'zend_hash_get_current_data_ex' declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
^
/Users/me/downloads/trader-0.2.2/trader-0.2.2/functions/trader_acos.c:61:2: warning: implicit declaration of function
'Z_DVAL_PP' is invalid in C99 [-Wimplicit-function-declaration]
TRADER_DBL_ZARR_TO_ARR(zinReal, inReal)
^
./php_trader.h:246:14: note: expanded from macro 'TRADER_DBL_ZARR_TO_ARR'
arr[i] = Z_DVAL_PP(data); \
^
1 warning and 2 errors generated.
make: *** [functions/trader_acos.lo] Error 1