0

I'm trying to get the Trader PECL extension running on my Mac Sierra/PHP 7.1 but to no avail.

I used:

sudo pecl install trader

and got (tail end of my results):

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

I then added:

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

OK; so my error is tell me that I'm using the wrong architecture. How can I change the architecture so that the extension works?

UPDATE: As recommended, I tried to compile by source and now am getting the error:

/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
Eric
  • 1,209
  • 1
  • 17
  • 34
  • What does `file` show as the type? See also https://stackoverflow.com/q/1924452/2908724. – bishop Sep 29 '17 at 13:50
  • file shows: Mach-O 64-bit bundle x86_64 as the type – Eric Sep 29 '17 at 13:54
  • I don't know OS X well, but I'd expect that to say "shared object" instead of "bundle". Rather than using PECL, can you try building from source? – bishop Sep 29 '17 at 14:24

0 Answers0