cphalcon icon indicating copy to clipboard operation
cphalcon copied to clipboard

[BUG]: PECL and manual compile fails

Open berighton opened this issue 5 months ago • 1 comments

Description Getting errors installing phalcon 5.9.3 via PECL as well as compiling manually. Installing locally, not via docker. PHP version: 8.4.7 OS: Nobara 42 (Fedora) - 6.15.2-200.nobara.fc42.x86_64

/usr/include/php/Zend/zend_API.h:1673:60: error: passing argument 2 of 'zend_parse_arg_array' from incompatible pointer type [-Wincompatible-pointer-types]
 1673 |                 if (UNEXPECTED(!zend_parse_arg_array(_arg, &dest, check_null, 0))) { \
/usr/include/php/Zend/zend_portability.h:387:52: note: in definition of macro 'UNEXPECTED'
  387 | # define UNEXPECTED(condition) __builtin_expect(!!(condition), 0)
      |                                                    ^~~~~~~~~
/usr/include/php/Zend/zend_API.h:1680:9: note: in expansion of macro 'Z_PARAM_ARRAY_EX2'
 1680 |         Z_PARAM_ARRAY_EX2(dest, check_null, separate, separate)
      |         ^~~~~~~~~~~~~~~~~
/usr/include/php/Zend/zend_API.h:1683:9: note: in expansion of macro 'Z_PARAM_ARRAY_EX'
 1683 |         Z_PARAM_ARRAY_EX(dest, 0, 0)
      |         ^~~~~~~~~~~~~~~~
/var/tmp/phalcon/phalcon.zep.c:206975:17: note: in expansion of macro 'Z_PARAM_ARRAY'
206975 |                 Z_PARAM_ARRAY(options)
       |                 ^~~~~~~~~~~~~
/usr/include/php/Zend/zend_API.h:2363:71: note: expected 'zval **' {aka 'struct _zval_struct **'} but argument is of type 'zval *' {aka 'struct _zval_struct *'}
 2363 | static zend_always_inline bool zend_parse_arg_array(zval *arg, zval **dest, bool check_null, bool or_object)
      |                                                                ~~~~~~~^~~~
/var/tmp/phalcon/phalcon.zep.c: In function 'php_zephir_init_globals':
/var/tmp/phalcon/phalcon.zep.c:208335:57: error: assignment to 'zend_string *' {aka 'struct _zend_string *'} from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
208335 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
       |                                                         ^
make: *** [Makefile:208: phalcon.lo] Error 1
ERROR: `make' failed

Tried both of the solutions: https://github.com/phalcon/cphalcon/issues/16680 and https://github.com/phalcon/cphalcon/issues/16722. The second showed promise, compiling starts after a few warnings but exists abruptly without any additional logs:

 Warning: Function "apcu_dec" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 255 [nonexistent-function]

                return apcu_dec(key, step);

        ----------------------------------^
 Warning: Function "apcu_delete" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 260 [nonexistent-function]

                return apcu_delete(key);

        -------------------------------^
 Warning: Function "apcu_exists" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 265 [nonexistent-function]

                return apcu_exists(key);

        -------------------------------^
 Warning: Function "apcu_inc" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 270 [nonexistent-function]

                return apcu_inc(key, step);

        ----------------------------------^
 Warning: Function "apcu_fetch" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 275 [nonexistent-function]

                return apcu_fetch(key);

        ------------------------------^
 Warning: Class "APCUIterator" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 280 [nonexistent-class]

                return new APCUIterator(pattern);

        ----------------------------------------^
 Warning: Function "apcu_store" does not exist at compile time in /home/bob/cphalcon/phalcon/Storage/Adapter/Apcu.zep on line 285 [nonexistent-function]

                return apcu_store(key, payload, ttl);

        --------------------------------------------^
 Warning: Function "apcu_fetch" does not exist at compile time in /home/bob/cphalcon/phalcon/Annotations/Adapter/Apcu.zep on line 66 [nonexistent-function]

                );

        ---------^
 Warning: Function "apcu_store" does not exist at compile time in /home/bob/cphalcon/phalcon/Annotations/Adapter/Apcu.zep on line 80 [nonexistent-function]

                );

        ---------^
 Preparing for PHP compilation...
configure.ac:150: warning: The macro 'AC_PROG_LIBTOOL' is obsolete.
configure.ac:150: You should run autoupdate.
build/libtool.m4:100: AC_PROG_LIBTOOL is expanded from...
configure.ac:150: the top level
 Preparing configuration file...
 Compiling...

Doing a recommended zephir build throws the same errors as PECL export CFLAGS="-Wno-error=incompatible-pointer-types" sudo zephir fullclean sudo zephir build

/home/bob/cphalcon/ext/kernel/main.c: In function 'zephir_function_exists_ex':
/home/bob/cphalcon/ext/kernel/main.c:275:83: warning: comparison between pointer and integer
  275 |         if (zend_hash_str_exists(CG(function_table), function_name, function_len) != NULL) {
      |                                                                                   ^~
/home/bob/cphalcon/ext/phalcon.c: In function 'php_zephir_init_globals':
/home/bob/cphalcon/ext/phalcon.c:1347:57: error: assignment to 'zend_string *' {aka 'struct _zend_string *'} from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
 1347 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
      |                                                         ^
make: *** [Makefile:208: phalcon.lo] Error 1
make: *** Waiting for unfinished jobs....
/home/bob/cphalcon/ext/phalcon.c: In function 'php_zephir_init_globals':
/home/bob/cphalcon/ext/phalcon.c:1347:57: error: assignment to 'zend_string *' {aka 'struct _zend_string *'} from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
 1347 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
      |                                                         ^
make: *** [Makefile:208: phalcon.lo] Error 1

berighton avatar Jun 16 '25 21:06 berighton

P.S. it would be immensely helpful if the releases included a fedora compiled file in addition to ubuntu and windows 💙

berighton avatar Jun 20 '25 01:06 berighton

bump

berighton avatar Jun 30 '25 02:06 berighton

bump

berighton avatar Jul 14 '25 15:07 berighton

I see warnings related to APCU. Is it installed? sudo dnf install php-pecl-apcu Or git clone https://github.com/krakjoe/apcu.git cd apcu phpize ./configure make sudo make install

And then enable it?

elcreator avatar Jul 25 '25 16:07 elcreator

And is it only happens with PHP 8.4 or with 8.3 too?

elcreator avatar Jul 25 '25 16:07 elcreator

I have only tried php8. Installed APCU package, still the same problem

Image Image

When I run sudo pecl install phalcon I get the following logs:

pecl.log

And when I download the source and run cd cphalcon-5.9.3 && zephir fullclean && zephir build I get the following:

/cphalcon-5.9.3/ext/kernel/main.c: In function 'zephir_function_exists_ex':
/cphalcon-5.9.3/ext/kernel/main.c:275:83: warning: comparison between pointer and integer
  275 |         if (zend_hash_str_exists(CG(function_table), function_name, function_len) != NULL) {
      |                                                                                   ^~
/cphalcon-5.9.3/ext/phalcon.c: In function 'php_zephir_init_globals':
/cphalcon-5.9.3/ext/phalcon.c:1347:57: error: assignment to 'zend_string *' {aka 'struct _zend_string *'} from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
 1347 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
      |                                                         ^
make: *** [Makefile:208: phalcon.lo] Error 1
make: *** Waiting for unfinished jobs....
/cphalcon-5.9.3/ext/phalcon.c: In function 'php_zephir_init_globals':
/cphalcon-5.9.3/ext/phalcon.c:1347:57: error: assignment to 'zend_string *' {aka 'struct _zend_string *'} from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
 1347 |         phalcon_globals->orm.resultset_prefetch_records = ZSTR_VAL(zend_string_init(ZEND_STRL("0"), 0));
      |                                                         ^
make: *** [Makefile:208: phalcon.lo] Error 1

berighton avatar Jul 29 '25 21:07 berighton

Had the same issue after upgrading Debian from 12 to 13 (phalcon stopped working). Php version 8.4.11. Solved with:

export CFLAGS="-Wno-incompatible-pointer-types" sudo -E pecl install phalcon

a-adamoli avatar Aug 16 '25 19:08 a-adamoli

YAS! It worked! Thank you greatly @a-adamoli

berighton avatar Aug 18 '25 14:08 berighton

If you ware coming here because this fails in your dockerfile you need:

ARG CFLAGS="-Wno-incompatible-pointer-types"
RUN pecl install phalcon

stanstrup avatar Oct 08 '25 12:10 stanstrup