RubixML / Tensor

A library and extension that provides objects for scientific computing in PHP.
https://rubixml.com
MIT License
232 stars 28 forks source link

make fails on Ubuntu 20, PHP 8.2 #34

Closed sneakyimp closed 8 months ago

sneakyimp commented 1 year ago

I have carefully followed the instructions for manually compiling the Tensor extension. make failed with output ending in the following errors:

/home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c: In function ‘zephir_function_exists’:
/home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c:285:101: warning: comparison between pointer and integer
  285 |  if (zend_hash_str_exists(CG(function_table), Z_STRVAL_P(function_name), Z_STRLEN_P(function_name)) != NULL) {
      |                                                                                                     ^~
/home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c: In function ‘zephir_function_exists_ex’:
/home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c:301:76: warning: comparison between pointer and integer
  301 |  if (zend_hash_str_exists(CG(function_table), function_name, function_len) != NULL) {
      |                                                                            ^~
/home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c: In function ‘zephir_get_arg’:
/home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c:571:9: error: too many arguments to function ‘zend_forbid_dynamic_call’
  571 |     if (zend_forbid_dynamic_call("func_get_arg()") == FAILURE) {
      |         ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/php/20220829/main/php.h:35,
                 from /home/sneakyimp/biz/machine-learning/tensor/Tensor/ext/kernel/main.c:16:
/usr/include/php/20220829/Zend/zend_API.h:782:39: note: declared here
  782 | static zend_always_inline zend_result zend_forbid_dynamic_call(void)
      |                                       ^~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:213: kernel/main.lo] Error 1

I have also attempted to build the commit described by myfluxi in issue #33 and the make/compile succeeds but the resulting shared library has very strange behavior, segfaulting when certain comments are in place, and producing incorrect dimensions for a matrix multiplication operation.

erfanmola commented 1 year ago

any support for php 8.2 ?

sneakyimp commented 1 year ago

any support for php 8.2 ?

It doesn't seem so. I've had no responses at all to my posts here in weeks.

andrewdalpino commented 1 year ago

Sorry fellas I haven't had alot of time lately. I'll take a look into this as soon as I can.

andrewdalpino commented 1 year ago

It looks as though Zephir does not support PHP 8.2 yet

https://github.com/zephir-lang/zephir/releases/tag/0.16.3

Having that said, if you have a fix @sneakyimp can you submit a PR?

Otherwise, you could try the latest code on master, I recompiled the extension with the latest (0.16.3) version of Zephir. Maybe it'll work. If not, we can wait until Zephir offers PHP 8.2 support.

andrewdalpino commented 1 year ago

Ok this should be fixed in version 3.0.3 on PECL and on the latest master branch

https://pecl.php.net/package/Tensor/3.0.3