secp256k1-php icon indicating copy to clipboard operation
secp256k1-php copied to clipboard

PHP8 Install Error

Open in3rsha opened this issue 3 years ago • 2 comments

Hello there,

Recently upgraded to PHP8.0 and want to install this extension. Everything works fine until I hit the make command when in the secp256k1-php/sec256k1 folder.

This is the error I'm seeing:

/secp256k1-php/secp256k1/secp256k1.c:1995:47: error: expected ‘)’ before ‘TSRMLS_CC’
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/rS|flz",
                                               ^~~~~~~~~
/secp256k1-php/secp256k1/secp256k1.c:1995:9: error: too few arguments to function ‘zend_parse_parameters’
     if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz/rS|flz",
         ^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php/20200930/main/php.h:36:0,
                 from /secp256k1-php/secp256k1/secp256k1.c:7:
/usr/include/php/20200930/Zend/zend_API.h:304:22: note: declared here
 ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...);

I don't know anything about C or PHP extensions so I don't know where to start to try and fix this. Can anyone help?

in3rsha avatar Mar 02 '21 01:03 in3rsha

Hmm, I haven't tried it out on PHP8 yet. FYI, if you're interested, that line is using macros which make the code look extra weird ;)

I'll try get to this a little later on. Normally there aren't significant differences, just a new function name or slightly different args. If anyone's looking at this sooner, there's probably some clues about this here: https://github.com/php/php-src/tree/master/ext/

afk11 avatar Mar 02 '21 15:03 afk11

Thanks Thomas, I'll see if I can figure out a fix.

Thanks for the great library by the way, it has been immensely useful over the years.

in3rsha avatar Mar 02 '21 15:03 in3rsha