alexeyrybak/blitz

Make error, latest php8 branch

Closed this issue · 6 comments

Debian 12
php -v
PHP 8.2.8 (cli) (built: Jul 16 2023 11:00:43) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.8, Copyright (c) Zend Technologies
with Zend OPcache v8.2.8, Copyright (c), by Zend Technologies
with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans

#git clone https://github.com/alexeyrybak/blitz -b php8
#cd ./blitz
#phpize
Configuring for:
PHP Api Version:         20220829
Zend Module Api No:      20220829
Zend Extension Api No:   420220829
**configure.ac:165: warning: The macro `AC_PROG_LIBTOOL' is obsolete.
configure.ac:165: You should run autoupdate.
build/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:165: the top level**

#./configure
#make 

got some errors

/usr/src/blitz/blitz_debug.c: In function 'blitz_dump_ht':
/usr/src/blitz/blitz_debug.c:8:40: warning: passing argument 2 of 'zend_hash_apply_with_arguments' from incompatible pointer type [-Wincompatible-pointer-types]
    8 |     zend_hash_apply_with_arguments(ht, dump_array_values, 1, depth + 1);
      |                                        ^~~~~~~~~~~~~~~~~
      |                                        |
      |                                        int (*)(void *, int,  __va_list_tag *, zend_hash_key *) {aka int (*)(void *, int,  __va_list_tag *, struct _zend_hash_key *)}
In file included from /usr/include/php/20220829/Zend/zend.h:33,
                 from /usr/include/php/20220829/main/php.h:31,
                 from /usr/src/blitz/blitz_debug.c:1:
/usr/include/php/20220829/Zend/zend_hash.h:156:79: note: expected 'apply_func_args_t' {aka 'int (*)(struct _zval_struct *, int,  __va_list_tag *, struct _zend_hash_key *)'} but argument is of type 'int (*)(void *, int,  __va_list_tag *, zend_hash_key *)' {aka 'int (*)(void *, int,  __va_list_tag *, struct _zend_hash_key *)'}
  156 | ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...);
      |                                                             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/src/blitz/blitz_debug.c: In function 'dump_value':
/usr/src/blitz/blitz_debug.c:15:56: warning: passing argument 2 of 'zend_hash_apply_with_arguments' from incompatible pointer type [-Wincompatible-pointer-types]
   15 |         zend_hash_apply_with_arguments(Z_ARRVAL_P(zv), dump_array_values, 1, depth + 1);
      |                                                        ^~~~~~~~~~~~~~~~~
      |                                                        |
      |                                                        int (*)(void *, int,  __va_list_tag *, zend_hash_key *) {aka int (*)(void *, int,  __va_list_tag *, struct _zend_hash_key *)}
/usr/include/php/20220829/Zend/zend_hash.h:156:79: note: expected 'apply_func_args_t' {aka 'int (*)(struct _zval_struct *, int,  __va_list_tag *, struct _zend_hash_key *)'} but argument is of type 'int (*)(void *, int,  __va_list_tag *, zend_hash_key *)' {aka 'int (*)(void *, int,  __va_list_tag *, struct _zend_hash_key *)'}
  156 | ZEND_API void zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t apply_func, int, ...);
      |                                                             ~~~~~~~~~~~~~~~~~~^~~~~~~~~~

blitz.so is created, but make package with checkinstall is fail too

Installing shared extensions:     /usr/lib/php/20220829/
chmod: cannot access '/usr/lib/php/20220829/#INST@5199#': No such file or directory
make: *** [Makefile:89: install-modules] Error 1

****  Installation failed. Aborting package creation.

try this please

fisher@fisher blitz % git diff blitz_debug.c
diff --git a/blitz_debug.c b/blitz_debug.c
index 190d6c8..efccf8e 100644
--- a/blitz_debug.c
+++ b/blitz_debug.c`
@@ -5,14 +5,14 @@ static int dump_array_values(void *pDest, int num_args, va_list args, zend_hash_

 void blitz_dump_ht(HashTable *ht, int depth) {
     php_printf("%*carray(%d) {\n", depth * 2, ' ', zend_hash_num_elements(ht));
-    zend_hash_apply_with_arguments(ht, dump_array_values, 1, depth + 1);
+    zend_hash_apply_with_arguments(ht, (apply_func_args_t) dump_array_values, 1, depth + 1);
     php_printf("%*c}\n", depth * 2, ' ');
 }

 static void dump_value(zval *zv, int depth) {
     if (Z_TYPE_P(zv) == IS_ARRAY) {
         php_printf("%*carray(%d) {\n", depth * 2, ' ', zend_hash_num_elements(Z_ARRVAL_P(zv)));
-        zend_hash_apply_with_arguments(Z_ARRVAL_P(zv), dump_array_values, 1, depth + 1);
+        zend_hash_apply_with_arguments(Z_ARRVAL_P(zv), (apply_func_args_t) dump_array_values, 1, depth + 1);
         php_printf("%*c}\n", depth * 2, ' ');
     } else {
         php_printf("%*c%Z\n", depth * 2, ' ', zv);

blitz.so is created, but make package with checkinstall is fail too

Installing shared extensions:     /usr/lib/php/20220829/
chmod: cannot access '/usr/lib/php/20220829/#INST@5199#': No such file or directory
make: *** [Makefile:89: install-modules] Error 1

****  Installation failed. Aborting package creation.

Please check permissions, this is a separate issue, which doesn't relate to the warning you initially mentioned. The conversion which I provided should work, and it was just a warning, everything should be built. If it wasn't then the reason was not the warning but the permission issue (try sudo make install for example). Please try the whole procedure step by step one again: from phpize thru configure to make and sudo make install.

try this please

fisher@fisher blitz % git diff blitz_debug.c
diff --git a/blitz_debug.c b/blitz_debug.c
index 190d6c8..efccf8e 100644
--- a/blitz_debug.c
+++ b/blitz_debug.c`
@@ -5,14 +5,14 @@ static int dump_array_values(void *pDest, int num_args, va_list args, zend_hash_

 void blitz_dump_ht(HashTable *ht, int depth) {
     php_printf("%*carray(%d) {\n", depth * 2, ' ', zend_hash_num_elements(ht));
-    zend_hash_apply_with_arguments(ht, dump_array_values, 1, depth + 1);
+    zend_hash_apply_with_arguments(ht, (apply_func_args_t) dump_array_values, 1, depth + 1);
     php_printf("%*c}\n", depth * 2, ' ');
 }

 static void dump_value(zval *zv, int depth) {
     if (Z_TYPE_P(zv) == IS_ARRAY) {
         php_printf("%*carray(%d) {\n", depth * 2, ' ', zend_hash_num_elements(Z_ARRVAL_P(zv)));
-        zend_hash_apply_with_arguments(Z_ARRVAL_P(zv), dump_array_values, 1, depth + 1);
+        zend_hash_apply_with_arguments(Z_ARRVAL_P(zv), (apply_func_args_t) dump_array_values, 1, depth + 1);
         php_printf("%*c}\n", depth * 2, ' ');
     } else {
         php_printf("%*c%Z\n", depth * 2, ' ', zv);

make is OK,
make install is OK
make test


=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
double Blitz object initialization [tests/double_init.phpt]
errors and warnings: execution [tests/errors2.phpt]
$_ as current iterations [tests/magic_current_iterations.phpt]
user-defined methods [tests/method.phpt]
method call from inner include [tests/mfi.phpt]
returning non-strings from user methods [tests/return_non_string_php8.phpt]
set and get [tests/set_and_get.phpt]
{{ $hash.sub.key }} syntax [tests/var_path.phpt]
=====================================================================


=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   17
---------------------------------------------------------------------

Number of tests :  106               105
Tests skipped   :    1 (  0.9%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    8 (  7.5%) (  7.6%)
Tests passed    :   97 ( 91.5%) ( 92.4%)
---------------------------------------------------------------------
Time taken      :    1 seconds
=====================================================================

blitz.so is created, but make package with checkinstall is fail too

Installing shared extensions:     /usr/lib/php/20220829/
chmod: cannot access '/usr/lib/php/20220829/#INST@5199#': No such file or directory
make: *** [Makefile:89: install-modules] Error 1

****  Installation failed. Aborting package creation.

Please check permissions, this is a separate issue, which doesn't relate to the warning you initially mentioned. The conversion which I provided should work, and it was just a warning, everything should be built. If it wasn't then the reason was not the warning but the permission issue (try sudo make install for example). Please try the whole procedure step by step one again: from phpize thru configure to make and sudo make install.

This probably bug in checkinstall in Debian 12 under WSL, i try tomorrow on real Debian 12 machine

tests are not relevant, so closing this. will open another ticket related to broken tests.