* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-08-11 7:52 [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14 Alexis Lothoré via buildroot
@ 2025-08-24 15:36 ` Romain Naour via buildroot
2025-08-25 14:53 ` Alexis Lothoré via buildroot
2025-09-08 10:55 ` Thomas Perale via buildroot
2025-09-19 12:56 ` Thomas Perale via buildroot
2 siblings, 1 reply; 11+ messages in thread
From: Romain Naour via buildroot @ 2025-08-24 15:36 UTC (permalink / raw)
To: Alexis Lothoré, buildroot
Cc: Thomas Petazzoni, Hervé Codina, Nicolas Carrier
Hello Alexis, Thomas, All,
Le 11/08/2025 à 09:52, Alexis Lothoré via buildroot a écrit :
> On both Buildroot 2025.02.x and master branch, php-lua build fails on
> the following error:
>
> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> struct _zval_struct *, void **)'} from incompatible pointer type 'void
> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
> *, struct _zval_struct *, struct _zval_struct *, void **)'}
> [-Wincompatible-pointer-types]
> 862 | lua_object_handlers.write_property =
> php_lua_write_property;
> | ^
> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> int, void **, struct _zval_struct *)'} from incompatible pointer type
> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
> 863 | lua_object_handlers.read_property =
> php_lua_read_property;
> | ^
> make[2]: *** [Makefile:214: lua.lo] Error 1
>
> The error can be reproduced with the following minimal defconfig:
>
> BR2_arm=y
> BR2_cortex_a9=y
> BR2_ARM_ENABLE_NEON=y
> BR2_ARM_ENABLE_VFP=y
> BR2_ARM_FPU_NEON=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
> BR2_PACKAGE_LUA=y
> BR2_PACKAGE_PHP=y
> BR2_PACKAGE_PHP_LUA=y
>
> This build failure is the result of two events/conditions:
> - the update to PHP8 has changed the prototype for
> zend_object_read_property_t (see [1]). But at this time, php-lua just
> generated a new warning (-Wincompatible-pointer-types)
> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
> this warning into a systematic error (see [2])
>
> This issue is still present on the upstream repository, but it has been
> fixed on one of its forks. Bring the relevant patch from the fork to
> allow building php-lua.
>
> [1] https://github.com/php/php-src/commit/91ef4124e56
> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> ---
> Changes in v3:
> - Added empty Upstream tag
> - Link to v2: https://lore.kernel.org/r/20250806-php-lua-v2-1-a73faad939e9@bootlin.com
>
> Changes in v2:
> - update commit title
> - add more details about the conditions leading to the build failure
> - add minimal defconfig
> - Link to v1: https://lore.kernel.org/r/20250806-php-lua-v1-1-e1f524fed0a5@bootlin.com
> ---
> ...-write-properly-read-property-was-changed.patch | 79 ++++++++++++++++++++++
> 1 file changed, 79 insertions(+)
>
> diff --git a/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> new file mode 100644
> index 0000000000000000000000000000000000000000..c1357b591b5b794b1eecf7cb02609a21de615b4c
> --- /dev/null
> +++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> @@ -0,0 +1,79 @@
> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
> +Date: Tue, 24 Aug 2021 08:28:47 +0100
> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
> + in https://github.com/php/php-src/commit/91ef4124e56
> +
> +Taken from https://github.com/badoo/php-lua/pull/8
> +
> +Upstream: n/a
I updated the link following Thomas's reply [1]
[1] https://lore.kernel.org/buildroot/20250813124353.4015c466@windsurf/
Applied to master, thanks.
Best regards,
Romain
> +Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> +---
> + lua.c | 28 ++++++++++++++--------------
> + 1 file changed, 14 insertions(+), 14 deletions(-)
> +
> +diff --git a/lua.c b/lua.c
> +index edc2868..32c1471 100755
> +--- a/lua.c
> ++++ b/lua.c
> +@@ -229,46 +229,46 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
> +
> + /** {{{ static zval * php_lua_read_property(zval *object, zval *member, int type)
> + */
> +-zval *php_lua_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> +- zend_string *str_member;
> ++zval *php_lua_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv){
> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> +
> + if (type != BP_VAR_R) {
> + ZVAL_NULL(rv);
> + return rv;
> + }
> +
> +- str_member = zval_get_string(member);
> + #if (LUA_VERSION_NUM < 502)
> +- lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(str_member));
> ++ lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(member));
> + #else
> +- lua_getglobal(L, ZSTR_VAL(str_member));
> ++ lua_getglobal(L, ZSTR_VAL(member));
> + #endif
> +- zend_string_release(str_member);
> +
> +- php_lua_get_zval_from_lua(L, -1, object, rv);
> ++ zval lua_zval_object;
> ++ ZVAL_OBJ(&lua_zval_object, object);
> ++
> ++ php_lua_get_zval_from_lua(L, -1, &lua_zval_object, rv);
> + lua_pop(L, 1);
> ++
> + return rv;
> + }
> + /* }}} */
> +
> + /** {{{ static void php_lua_write_property(zval *object, zval *member, zval *value)
> + */
> +-static void php_lua_write_property(zval *object, zval *member, zval *value, void ** key) {
> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> +- zend_string *str_member = zval_get_string(member);
> ++static zval* php_lua_write_property(zend_object *object, zend_string *member, zval *value, void ** key) {
> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> +
> + #if (LUA_VERSION_NUM < 502)
> +- php_lua_send_zval_to_lua(L, member);
> ++ lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
> + php_lua_send_zval_to_lua(L, value);
> +
> + lua_settable(L, LUA_GLOBALSINDEX);
> + #else
> + php_lua_send_zval_to_lua(L, value);
> +- lua_setglobal(L, Z_STRVAL_P(member));
> ++ lua_setglobal(L, ZSTR_VAL(member));
> + #endif
> +
> +- zend_string_release(str_member);
> ++ return value;
> + }
> + /* }}} */
> +
>
> ---
> base-commit: 2fd520c8d52b9e0ed5e26343813fdd8dbcadb45f
> change-id: 20250806-php-lua-39895d4fe179
>
> Best regards,
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-08-24 15:36 ` Romain Naour via buildroot
@ 2025-08-25 14:53 ` Alexis Lothoré via buildroot
2025-09-06 22:17 ` Romain Naour via buildroot
0 siblings, 1 reply; 11+ messages in thread
From: Alexis Lothoré via buildroot @ 2025-08-25 14:53 UTC (permalink / raw)
To: Romain Naour, buildroot
Cc: Thomas Petazzoni, Hervé Codina, Nicolas Carrier
Hi Romain,
On Sun Aug 24, 2025 at 5:36 PM CEST, Romain Naour wrote:
> Hello Alexis, Thomas, All,
>
> Le 11/08/2025 à 09:52, Alexis Lothoré via buildroot a écrit :
[...]
>> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
>> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
>> +Date: Tue, 24 Aug 2021 08:28:47 +0100
>> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
>> + in https://github.com/php/php-src/commit/91ef4124e56
>> +
>> +Taken from https://github.com/badoo/php-lua/pull/8
>> +
>> +Upstream: n/a
>
> I updated the link following Thomas's reply [1]
>
> [1] https://lore.kernel.org/buildroot/20250813124353.4015c466@windsurf/
>
> Applied to master, thanks.
My bad for the absence of reaction on my side, I have been off for a few
days, and then travelling for conference. Thanks for handling this !
Alexis
> Best regards,
> Romain
>
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-08-25 14:53 ` Alexis Lothoré via buildroot
@ 2025-09-06 22:17 ` Romain Naour via buildroot
2025-09-08 6:40 ` Alexis Lothoré via buildroot
0 siblings, 1 reply; 11+ messages in thread
From: Romain Naour via buildroot @ 2025-09-06 22:17 UTC (permalink / raw)
To: Alexis Lothoré, buildroot
Cc: Thomas Petazzoni, Hervé Codina, Nicolas Carrier
Hello Alexis, All,
Le 25/08/2025 à 16:53, Alexis Lothoré a écrit :
> Hi Romain,
>
> On Sun Aug 24, 2025 at 5:36 PM CEST, Romain Naour wrote:
>> Hello Alexis, Thomas, All,
>>
>> Le 11/08/2025 à 09:52, Alexis Lothoré via buildroot a écrit :
>
> [...]
>
>>> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
>>> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
>>> +Date: Tue, 24 Aug 2021 08:28:47 +0100
>>> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
>>> + in https://github.com/php/php-src/commit/91ef4124e56
>>> +
>>> +Taken from https://github.com/badoo/php-lua/pull/8
>>> +
>>> +Upstream: n/a
>>
>> I updated the link following Thomas's reply [1]
>>
>> [1] https://lore.kernel.org/buildroot/20250813124353.4015c466@windsurf/
>>
>> Applied to master, thanks.
>
> My bad for the absence of reaction on my side, I have been off for a few
> days, and then travelling for conference. Thanks for handling this !
No problem, thanks for your contribution in the first place.
I noticed a new issue in Gitlab-CI that seems related to this patch [1]
Indeed, the backported commit [2] introduce a build issue with lua < 502
interpreters due to probably a copy past of this line (val is not defined):
lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
I guess, we have to replace "val" by "member" since ZSTR_VAL macro uses internal
"(zstr)->val" (#define ZSTR_VAL(zstr) (zstr)->val) that seems only available in
"member". But I may be wrong...
lua_pushlstring(L, ZSTR_VAL(member), ZSTR_LEN(member));
With that fixed, TestPhpLuaLuajit pass.
Can you have a look?
[1] https://gitlab.com/buildroot.org/buildroot/-/jobs/11176774941
[2] https://github.com/badoo/php-lua/commit/de1068d634519abf2461dac9427b5ff24b6603af
Best regards,
Romain
>
> Alexis
>
>> Best regards,
>> Romain
>>
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-09-06 22:17 ` Romain Naour via buildroot
@ 2025-09-08 6:40 ` Alexis Lothoré via buildroot
0 siblings, 0 replies; 11+ messages in thread
From: Alexis Lothoré via buildroot @ 2025-09-08 6:40 UTC (permalink / raw)
To: Romain Naour, buildroot
Cc: Thomas Petazzoni, Hervé Codina, Nicolas Carrier
Hi Romain,
On Sun Sep 7, 2025 at 12:17 AM CEST, Romain Naour wrote:
> Hello Alexis, All,
>
> Le 25/08/2025 à 16:53, Alexis Lothoré a écrit :
>> Hi Romain,
>>
>> On Sun Aug 24, 2025 at 5:36 PM CEST, Romain Naour wrote:
>>> Hello Alexis, Thomas, All,
>>>
>>> Le 11/08/2025 à 09:52, Alexis Lothoré via buildroot a écrit :
[...]
>> My bad for the absence of reaction on my side, I have been off for a few
>> days, and then travelling for conference. Thanks for handling this !
>
> No problem, thanks for your contribution in the first place.
>
> I noticed a new issue in Gitlab-CI that seems related to this patch [1]
> Indeed, the backported commit [2] introduce a build issue with lua < 502
> interpreters due to probably a copy past of this line (val is not defined):
>
> lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
>
> I guess, we have to replace "val" by "member" since ZSTR_VAL macro uses internal
> "(zstr)->val" (#define ZSTR_VAL(zstr) (zstr)->val) that seems only available in
> "member". But I may be wrong...
>
> lua_pushlstring(L, ZSTR_VAL(member), ZSTR_LEN(member));
>
> With that fixed, TestPhpLuaLuajit pass.
>
> Can you have a look?
>
> [1] https://gitlab.com/buildroot.org/buildroot/-/jobs/11176774941
> [2] https://github.com/badoo/php-lua/commit/de1068d634519abf2461dac9427b5ff24b6603af
Sure, I'll look at it and submit the relevant patch.
Alexis
>
> Best regards,
> Romain
>
>
>>
>> Alexis
>>
>>> Best regards,
>>> Romain
>>>
>>
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-08-11 7:52 [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14 Alexis Lothoré via buildroot
2025-08-24 15:36 ` Romain Naour via buildroot
@ 2025-09-08 10:55 ` Thomas Perale via buildroot
2025-09-08 11:20 ` Baruch Siach via buildroot
2025-09-19 12:56 ` Thomas Perale via buildroot
2 siblings, 1 reply; 11+ messages in thread
From: Thomas Perale via buildroot @ 2025-09-08 10:55 UTC (permalink / raw)
To: Alexis Lothoré; +Cc: Thomas Perale, buildroot
In reply of:
> On both Buildroot 2025.02.x and master branch, php-lua build fails on
> the following error:
>
> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> struct _zval_struct *, void **)'} from incompatible pointer type 'void
> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
> *, struct _zval_struct *, struct _zval_struct *, void **)'}
> [-Wincompatible-pointer-types]
> 862 | lua_object_handlers.write_property =
> php_lua_write_property;
> | ^
> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> int, void **, struct _zval_struct *)'} from incompatible pointer type
> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
> 863 | lua_object_handlers.read_property =
> php_lua_read_property;
> | ^
> make[2]: *** [Makefile:214: lua.lo] Error 1
>
> The error can be reproduced with the following minimal defconfig:
>
> BR2_arm=y
> BR2_cortex_a9=y
> BR2_ARM_ENABLE_NEON=y
> BR2_ARM_ENABLE_VFP=y
> BR2_ARM_FPU_NEON=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
> BR2_PACKAGE_LUA=y
> BR2_PACKAGE_PHP=y
> BR2_PACKAGE_PHP_LUA=y
>
> This build failure is the result of two events/conditions:
> - the update to PHP8 has changed the prototype for
> zend_object_read_property_t (see [1]). But at this time, php-lua just
> generated a new warning (-Wincompatible-pointer-types)
> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
> this warning into a systematic error (see [2])
>
> This issue is still present on the upstream repository, but it has been
> fixed on one of its forks. Bring the relevant patch from the fork to
> allow building php-lua.
>
> [1] https://github.com/php/php-src/commit/91ef4124e56
> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Applied to 2025.02.x & 2025.05.x. Thanks
> ---
> Changes in v3:
> - Added empty Upstream tag
> - Link to v2: https://lore.kernel.org/r/20250806-php-lua-v2-1-a73faad939e9@bootlin.com
>
> Changes in v2:
> - update commit title
> - add more details about the conditions leading to the build failure
> - add minimal defconfig
> - Link to v1: https://lore.kernel.org/r/20250806-php-lua-v1-1-e1f524fed0a5@bootlin.com
> ---
> ...-write-properly-read-property-was-changed.patch | 79 ++++++++++++++++++++++
> 1 file changed, 79 insertions(+)
>
> diff --git a/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> new file mode 100644
> index 0000000000000000000000000000000000000000..c1357b591b5b794b1eecf7cb02609a21de615b4c
> --- /dev/null
> +++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> @@ -0,0 +1,79 @@
> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
> +Date: Tue, 24 Aug 2021 08:28:47 +0100
> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
> + in https://github.com/php/php-src/commit/91ef4124e56
> +
> +Taken from https://github.com/badoo/php-lua/pull/8
> +
> +Upstream: n/a
> +Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> +---
> + lua.c | 28 ++++++++++++++--------------
> + 1 file changed, 14 insertions(+), 14 deletions(-)
> +
> +diff --git a/lua.c b/lua.c
> +index edc2868..32c1471 100755
> +--- a/lua.c
> ++++ b/lua.c
> +@@ -229,46 +229,46 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
> +
> + /** {{{ static zval * php_lua_read_property(zval *object, zval *member, int type)
> + */
> +-zval *php_lua_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> +- zend_string *str_member;
> ++zval *php_lua_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv){
> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> +
> + if (type != BP_VAR_R) {
> + ZVAL_NULL(rv);
> + return rv;
> + }
> +
> +- str_member = zval_get_string(member);
> + #if (LUA_VERSION_NUM < 502)
> +- lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(str_member));
> ++ lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(member));
> + #else
> +- lua_getglobal(L, ZSTR_VAL(str_member));
> ++ lua_getglobal(L, ZSTR_VAL(member));
> + #endif
> +- zend_string_release(str_member);
> +
> +- php_lua_get_zval_from_lua(L, -1, object, rv);
> ++ zval lua_zval_object;
> ++ ZVAL_OBJ(&lua_zval_object, object);
> ++
> ++ php_lua_get_zval_from_lua(L, -1, &lua_zval_object, rv);
> + lua_pop(L, 1);
> ++
> + return rv;
> + }
> + /* }}} */
> +
> + /** {{{ static void php_lua_write_property(zval *object, zval *member, zval *value)
> + */
> +-static void php_lua_write_property(zval *object, zval *member, zval *value, void ** key) {
> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> +- zend_string *str_member = zval_get_string(member);
> ++static zval* php_lua_write_property(zend_object *object, zend_string *member, zval *value, void ** key) {
> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> +
> + #if (LUA_VERSION_NUM < 502)
> +- php_lua_send_zval_to_lua(L, member);
> ++ lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
> + php_lua_send_zval_to_lua(L, value);
> +
> + lua_settable(L, LUA_GLOBALSINDEX);
> + #else
> + php_lua_send_zval_to_lua(L, value);
> +- lua_setglobal(L, Z_STRVAL_P(member));
> ++ lua_setglobal(L, ZSTR_VAL(member));
> + #endif
> +
> +- zend_string_release(str_member);
> ++ return value;
> + }
> + /* }}} */
> +
>
> ---
> base-commit: 2fd520c8d52b9e0ed5e26343813fdd8dbcadb45f
> change-id: 20250806-php-lua-39895d4fe179
>
> Best regards,
> --
> Alexis Lothoré, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-09-08 10:55 ` Thomas Perale via buildroot
@ 2025-09-08 11:20 ` Baruch Siach via buildroot
2025-09-08 13:13 ` Thomas Perale via buildroot
0 siblings, 1 reply; 11+ messages in thread
From: Baruch Siach via buildroot @ 2025-09-08 11:20 UTC (permalink / raw)
To: Thomas Perale via buildroot; +Cc: Alexis Lothoré, Thomas Perale
Hi Thomas,
On Mon, Sep 08 2025, Thomas Perale via buildroot wrote:
> In reply of:
>> On both Buildroot 2025.02.x and master branch, php-lua build fails on
>> the following error:
>>
>> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
>> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
>> struct _zval_struct *, void **)'} from incompatible pointer type 'void
>> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
>> *, struct _zval_struct *, struct _zval_struct *, void **)'}
>> [-Wincompatible-pointer-types]
>> 862 | lua_object_handlers.write_property =
>> php_lua_write_property;
>> | ^
>> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
>> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
>> int, void **, struct _zval_struct *)'} from incompatible pointer type
>> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
>> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
>> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
>> 863 | lua_object_handlers.read_property =
>> php_lua_read_property;
>> | ^
>> make[2]: *** [Makefile:214: lua.lo] Error 1
>>
>> The error can be reproduced with the following minimal defconfig:
>>
>> BR2_arm=y
>> BR2_cortex_a9=y
>> BR2_ARM_ENABLE_NEON=y
>> BR2_ARM_ENABLE_VFP=y
>> BR2_ARM_FPU_NEON=y
>> BR2_TOOLCHAIN_EXTERNAL=y
>> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
>> BR2_PACKAGE_LUA=y
>> BR2_PACKAGE_PHP=y
>> BR2_PACKAGE_PHP_LUA=y
>>
>> This build failure is the result of two events/conditions:
>> - the update to PHP8 has changed the prototype for
>> zend_object_read_property_t (see [1]). But at this time, php-lua just
>> generated a new warning (-Wincompatible-pointer-types)
>> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
>> this warning into a systematic error (see [2])
>>
>> This issue is still present on the upstream repository, but it has been
>> fixed on one of its forks. Bring the relevant patch from the fork to
>> allow building php-lua.
>>
>> [1] https://github.com/php/php-src/commit/91ef4124e56
>> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
>>
>> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
>
> Applied to 2025.02.x & 2025.05.x. Thanks
Not in 2025.02.x as of commit 2d5c298d5a35 ("package/iperf3: add patch
to fix CVE-2025-54350").
Also not in 2025.05.x as of commit 6f191b4dcc80 ("package/cpp-httplib:
add patch for CVE-2025-46728").
baruch
>> ---
>> Changes in v3:
>> - Added empty Upstream tag
>> - Link to v2: https://lore.kernel.org/r/20250806-php-lua-v2-1-a73faad939e9@bootlin.com
>>
>> Changes in v2:
>> - update commit title
>> - add more details about the conditions leading to the build failure
>> - add minimal defconfig
>> - Link to v1: https://lore.kernel.org/r/20250806-php-lua-v1-1-e1f524fed0a5@bootlin.com
>> ---
>> ...-write-properly-read-property-was-changed.patch | 79 ++++++++++++++++++++++
>> 1 file changed, 79 insertions(+)
>>
>> diff --git
>> a/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
>> b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
>> new file mode 100644
>> index 0000000000000000000000000000000000000000..c1357b591b5b794b1eecf7cb02609a21de615b4c
>> --- /dev/null
>> +++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
>> @@ -0,0 +1,79 @@
>> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
>> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
>> +Date: Tue, 24 Aug 2021 08:28:47 +0100
>> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
>> + in https://github.com/php/php-src/commit/91ef4124e56
>> +
>> +Taken from https://github.com/badoo/php-lua/pull/8
>> +
>> +Upstream: n/a
>> +Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
>> +---
>> + lua.c | 28 ++++++++++++++--------------
>> + 1 file changed, 14 insertions(+), 14 deletions(-)
>> +
>> +diff --git a/lua.c b/lua.c
>> +index edc2868..32c1471 100755
>> +--- a/lua.c
>> ++++ b/lua.c
>> +@@ -229,46 +229,46 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
>> +
>> + /** {{{ static zval * php_lua_read_property(zval *object, zval *member, int type)
>> + */
>> +-zval *php_lua_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
>> +- lua_State *L = (Z_LUAVAL_P(object))->L;
>> +- zend_string *str_member;
>> ++zval *php_lua_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv){
>> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
>> +
>> + if (type != BP_VAR_R) {
>> + ZVAL_NULL(rv);
>> + return rv;
>> + }
>> +
>> +- str_member = zval_get_string(member);
>> + #if (LUA_VERSION_NUM < 502)
>> +- lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(str_member));
>> ++ lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(member));
>> + #else
>> +- lua_getglobal(L, ZSTR_VAL(str_member));
>> ++ lua_getglobal(L, ZSTR_VAL(member));
>> + #endif
>> +- zend_string_release(str_member);
>> +
>> +- php_lua_get_zval_from_lua(L, -1, object, rv);
>> ++ zval lua_zval_object;
>> ++ ZVAL_OBJ(&lua_zval_object, object);
>> ++
>> ++ php_lua_get_zval_from_lua(L, -1, &lua_zval_object, rv);
>> + lua_pop(L, 1);
>> ++
>> + return rv;
>> + }
>> + /* }}} */
>> +
>> + /** {{{ static void php_lua_write_property(zval *object, zval *member, zval *value)
>> + */
>> +-static void php_lua_write_property(zval *object, zval *member, zval *value, void ** key) {
>> +- lua_State *L = (Z_LUAVAL_P(object))->L;
>> +- zend_string *str_member = zval_get_string(member);
>> ++static zval* php_lua_write_property(zend_object *object, zend_string *member, zval *value, void ** key) {
>> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
>> +
>> + #if (LUA_VERSION_NUM < 502)
>> +- php_lua_send_zval_to_lua(L, member);
>> ++ lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
>> + php_lua_send_zval_to_lua(L, value);
>> +
>> + lua_settable(L, LUA_GLOBALSINDEX);
>> + #else
>> + php_lua_send_zval_to_lua(L, value);
>> +- lua_setglobal(L, Z_STRVAL_P(member));
>> ++ lua_setglobal(L, ZSTR_VAL(member));
>> + #endif
>> +
>> +- zend_string_release(str_member);
>> ++ return value;
>> + }
>> + /* }}} */
>> +
>>
>> ---
>> base-commit: 2fd520c8d52b9e0ed5e26343813fdd8dbcadb45f
>> change-id: 20250806-php-lua-39895d4fe179
>>
>> Best regards,
>> --
>> Alexis Lothoré, Bootlin
>> Embedded Linux and Kernel engineering
>> https://bootlin.com
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-09-08 11:20 ` Baruch Siach via buildroot
@ 2025-09-08 13:13 ` Thomas Perale via buildroot
2025-09-08 13:32 ` Baruch Siach via buildroot
2025-09-10 8:36 ` Romain Naour via buildroot
0 siblings, 2 replies; 11+ messages in thread
From: Thomas Perale via buildroot @ 2025-09-08 13:13 UTC (permalink / raw)
To: Baruch Siach
Cc: Thomas Perale, Thomas Perale via buildroot, Alexis Lothoré
Hi Baruch,
In reply of:
> Hi Thomas,
>
> On Mon, Sep 08 2025, Thomas Perale via buildroot wrote:
> > In reply of:
> >> On both Buildroot 2025.02.x and master branch, php-lua build fails on
> >> the following error:
> >>
> >> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
> >> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> >> struct _zval_struct *, void **)'} from incompatible pointer type 'void
> >> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
> >> *, struct _zval_struct *, struct _zval_struct *, void **)'}
> >> [-Wincompatible-pointer-types]
> >> 862 | lua_object_handlers.write_property =
> >> php_lua_write_property;
> >> | ^
> >> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
> >> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> >> int, void **, struct _zval_struct *)'} from incompatible pointer type
> >> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
> >> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
> >> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
> >> 863 | lua_object_handlers.read_property =
> >> php_lua_read_property;
> >> | ^
> >> make[2]: *** [Makefile:214: lua.lo] Error 1
> >>
> >> The error can be reproduced with the following minimal defconfig:
> >>
> >> BR2_arm=y
> >> BR2_cortex_a9=y
> >> BR2_ARM_ENABLE_NEON=y
> >> BR2_ARM_ENABLE_VFP=y
> >> BR2_ARM_FPU_NEON=y
> >> BR2_TOOLCHAIN_EXTERNAL=y
> >> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
> >> BR2_PACKAGE_LUA=y
> >> BR2_PACKAGE_PHP=y
> >> BR2_PACKAGE_PHP_LUA=y
> >>
> >> This build failure is the result of two events/conditions:
> >> - the update to PHP8 has changed the prototype for
> >> zend_object_read_property_t (see [1]). But at this time, php-lua just
> >> generated a new warning (-Wincompatible-pointer-types)
> >> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
> >> this warning into a systematic error (see [2])
> >>
> >> This issue is still present on the upstream repository, but it has been
> >> fixed on one of its forks. Bring the relevant patch from the fork to
> >> allow building php-lua.
> >>
> >> [1] https://github.com/php/php-src/commit/91ef4124e56
> >> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
> >>
> >> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> >
> > Applied to 2025.02.x & 2025.05.x. Thanks
>
> Not in 2025.02.x as of commit 2d5c298d5a35 ("package/iperf3: add patch
> to fix CVE-2025-54350").
>
> Also not in 2025.05.x as of commit 6f191b4dcc80 ("package/cpp-httplib:
> add patch for CVE-2025-46728").
>
> baruch
Indeed, thanks for the message. It was decided to not include this patch in the
end because it was suspected to be the reason of the following build error
https://gitlab.com/buildroot.org/buildroot/-/jobs/11176774941
I already had my email reply prepared and forgot to remove this entry before
sending them to the list when we synced.
PERALE Thomas
> >> ---
> >> Changes in v3:
> >> - Added empty Upstream tag
> >> - Link to v2: https://lore.kernel.org/r/20250806-php-lua-v2-1-a73faad939e9@bootlin.com
> >>
> >> Changes in v2:
> >> - update commit title
> >> - add more details about the conditions leading to the build failure
> >> - add minimal defconfig
> >> - Link to v1: https://lore.kernel.org/r/20250806-php-lua-v1-1-e1f524fed0a5@bootlin.com
> >> ---
> >> ...-write-properly-read-property-was-changed.patch | 79 ++++++++++++++++++++++
> >> 1 file changed, 79 insertions(+)
> >>
> >> diff --git
> >> a/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> >> b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> >> new file mode 100644
> >> index 0000000000000000000000000000000000000000..c1357b591b5b794b1eecf7cb02609a21de615b4c
> >> --- /dev/null
> >> +++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> >> @@ -0,0 +1,79 @@
> >> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
> >> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
> >> +Date: Tue, 24 Aug 2021 08:28:47 +0100
> >> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
> >> + in https://github.com/php/php-src/commit/91ef4124e56
> >> +
> >> +Taken from https://github.com/badoo/php-lua/pull/8
> >> +
> >> +Upstream: n/a
> >> +Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> >> +---
> >> + lua.c | 28 ++++++++++++++--------------
> >> + 1 file changed, 14 insertions(+), 14 deletions(-)
> >> +
> >> +diff --git a/lua.c b/lua.c
> >> +index edc2868..32c1471 100755
> >> +--- a/lua.c
> >> ++++ b/lua.c
> >> +@@ -229,46 +229,46 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
> >> +
> >> + /** {{{ static zval * php_lua_read_property(zval *object, zval *member, int type)
> >> + */
> >> +-zval *php_lua_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
> >> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> >> +- zend_string *str_member;
> >> ++zval *php_lua_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv){
> >> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> >> +
> >> + if (type != BP_VAR_R) {
> >> + ZVAL_NULL(rv);
> >> + return rv;
> >> + }
> >> +
> >> +- str_member = zval_get_string(member);
> >> + #if (LUA_VERSION_NUM < 502)
> >> +- lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(str_member));
> >> ++ lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(member));
> >> + #else
> >> +- lua_getglobal(L, ZSTR_VAL(str_member));
> >> ++ lua_getglobal(L, ZSTR_VAL(member));
> >> + #endif
> >> +- zend_string_release(str_member);
> >> +
> >> +- php_lua_get_zval_from_lua(L, -1, object, rv);
> >> ++ zval lua_zval_object;
> >> ++ ZVAL_OBJ(&lua_zval_object, object);
> >> ++
> >> ++ php_lua_get_zval_from_lua(L, -1, &lua_zval_object, rv);
> >> + lua_pop(L, 1);
> >> ++
> >> + return rv;
> >> + }
> >> + /* }}} */
> >> +
> >> + /** {{{ static void php_lua_write_property(zval *object, zval *member, zval *value)
> >> + */
> >> +-static void php_lua_write_property(zval *object, zval *member, zval *value, void ** key) {
> >> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> >> +- zend_string *str_member = zval_get_string(member);
> >> ++static zval* php_lua_write_property(zend_object *object, zend_string *member, zval *value, void ** key) {
> >> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> >> +
> >> + #if (LUA_VERSION_NUM < 502)
> >> +- php_lua_send_zval_to_lua(L, member);
> >> ++ lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
> >> + php_lua_send_zval_to_lua(L, value);
> >> +
> >> + lua_settable(L, LUA_GLOBALSINDEX);
> >> + #else
> >> + php_lua_send_zval_to_lua(L, value);
> >> +- lua_setglobal(L, Z_STRVAL_P(member));
> >> ++ lua_setglobal(L, ZSTR_VAL(member));
> >> + #endif
> >> +
> >> +- zend_string_release(str_member);
> >> ++ return value;
> >> + }
> >> + /* }}} */
> >> +
> >>
> >> ---
> >> base-commit: 2fd520c8d52b9e0ed5e26343813fdd8dbcadb45f
> >> change-id: 20250806-php-lua-39895d4fe179
> >>
> >> Best regards,
> >> --
> >> Alexis Lothoré, Bootlin
> >> Embedded Linux and Kernel engineering
> >> https://bootlin.com
> >>
> >> _______________________________________________
> >> buildroot mailing list
> >> buildroot@buildroot.org
> >> https://lists.buildroot.org/mailman/listinfo/buildroot
> > _______________________________________________
> > buildroot mailing list
> > buildroot@buildroot.org
> > https://lists.buildroot.org/mailman/listinfo/buildroot
>
> --
> ~. .~ Tk Open Systems
> =}------------------------------------------------ooO--U--Ooo------------{=
> - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-09-08 13:13 ` Thomas Perale via buildroot
@ 2025-09-08 13:32 ` Baruch Siach via buildroot
2025-09-10 8:36 ` Romain Naour via buildroot
1 sibling, 0 replies; 11+ messages in thread
From: Baruch Siach via buildroot @ 2025-09-08 13:32 UTC (permalink / raw)
To: Thomas Perale; +Cc: Thomas Perale via buildroot, Alexis Lothoré
Hi Thomas,
On Mon, Sep 08 2025, Thomas Perale wrote:
> In reply of:
>> On Mon, Sep 08 2025, Thomas Perale via buildroot wrote:
>> > In reply of:
>> >> On both Buildroot 2025.02.x and master branch, php-lua build fails on
>> >> the following error:
>> >>
>> >> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
>> >> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
>> >> struct _zval_struct *, void **)'} from incompatible pointer type 'void
>> >> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
>> >> *, struct _zval_struct *, struct _zval_struct *, void **)'}
>> >> [-Wincompatible-pointer-types]
>> >> 862 | lua_object_handlers.write_property =
>> >> php_lua_write_property;
>> >> | ^
>> >> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
>> >> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
>> >> int, void **, struct _zval_struct *)'} from incompatible pointer type
>> >> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
>> >> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
>> >> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
>> >> 863 | lua_object_handlers.read_property =
>> >> php_lua_read_property;
>> >> | ^
>> >> make[2]: *** [Makefile:214: lua.lo] Error 1
>> >>
>> >> The error can be reproduced with the following minimal defconfig:
>> >>
>> >> BR2_arm=y
>> >> BR2_cortex_a9=y
>> >> BR2_ARM_ENABLE_NEON=y
>> >> BR2_ARM_ENABLE_VFP=y
>> >> BR2_ARM_FPU_NEON=y
>> >> BR2_TOOLCHAIN_EXTERNAL=y
>> >> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
>> >> BR2_PACKAGE_LUA=y
>> >> BR2_PACKAGE_PHP=y
>> >> BR2_PACKAGE_PHP_LUA=y
>> >>
>> >> This build failure is the result of two events/conditions:
>> >> - the update to PHP8 has changed the prototype for
>> >> zend_object_read_property_t (see [1]). But at this time, php-lua just
>> >> generated a new warning (-Wincompatible-pointer-types)
>> >> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
>> >> this warning into a systematic error (see [2])
>> >>
>> >> This issue is still present on the upstream repository, but it has been
>> >> fixed on one of its forks. Bring the relevant patch from the fork to
>> >> allow building php-lua.
>> >>
>> >> [1] https://github.com/php/php-src/commit/91ef4124e56
>> >> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
>> >>
>> >> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
>> >
>> > Applied to 2025.02.x & 2025.05.x. Thanks
>>
>> Not in 2025.02.x as of commit 2d5c298d5a35 ("package/iperf3: add patch
>> to fix CVE-2025-54350").
>>
>> Also not in 2025.05.x as of commit 6f191b4dcc80 ("package/cpp-httplib:
>> add patch for CVE-2025-46728").
>
> Indeed, thanks for the message. It was decided to not include this patch in the
> end because it was suspected to be the reason of the following build error
> https://gitlab.com/buildroot.org/buildroot/-/jobs/11176774941
>
> I already had my email reply prepared and forgot to remove this entry before
> sending them to the list when we synced.
Thanks for the clarification.
What about the TestXvisor patch:
https://lore.kernel.org/all/20250908105600.682136-1-thomas.perale@mind.be/
It's not in 2025.02.x/2025.05.x either.
baruch
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-09-08 13:13 ` Thomas Perale via buildroot
2025-09-08 13:32 ` Baruch Siach via buildroot
@ 2025-09-10 8:36 ` Romain Naour via buildroot
1 sibling, 0 replies; 11+ messages in thread
From: Romain Naour via buildroot @ 2025-09-10 8:36 UTC (permalink / raw)
To: Thomas Perale, Baruch Siach
Cc: Thomas Perale via buildroot, Alexis Lothoré
Hello Thomas, All,
Le 08/09/2025 à 15:13, Thomas Perale via buildroot a écrit :
> Hi Baruch,
>
> In reply of:
>> Hi Thomas,
>>
>> On Mon, Sep 08 2025, Thomas Perale via buildroot wrote:
>>> In reply of:
>>>> On both Buildroot 2025.02.x and master branch, php-lua build fails on
>>>> the following error:
>>>>
>>>> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
>>>> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
>>>> struct _zval_struct *, void **)'} from incompatible pointer type 'void
>>>> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
>>>> *, struct _zval_struct *, struct _zval_struct *, void **)'}
>>>> [-Wincompatible-pointer-types]
>>>> 862 | lua_object_handlers.write_property =
>>>> php_lua_write_property;
>>>> | ^
>>>> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
>>>> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
>>>> int, void **, struct _zval_struct *)'} from incompatible pointer type
>>>> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
>>>> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
>>>> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
>>>> 863 | lua_object_handlers.read_property =
>>>> php_lua_read_property;
>>>> | ^
>>>> make[2]: *** [Makefile:214: lua.lo] Error 1
>>>>
>>>> The error can be reproduced with the following minimal defconfig:
>>>>
>>>> BR2_arm=y
>>>> BR2_cortex_a9=y
>>>> BR2_ARM_ENABLE_NEON=y
>>>> BR2_ARM_ENABLE_VFP=y
>>>> BR2_ARM_FPU_NEON=y
>>>> BR2_TOOLCHAIN_EXTERNAL=y
>>>> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
>>>> BR2_PACKAGE_LUA=y
>>>> BR2_PACKAGE_PHP=y
>>>> BR2_PACKAGE_PHP_LUA=y
>>>>
>>>> This build failure is the result of two events/conditions:
>>>> - the update to PHP8 has changed the prototype for
>>>> zend_object_read_property_t (see [1]). But at this time, php-lua just
>>>> generated a new warning (-Wincompatible-pointer-types)
>>>> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
>>>> this warning into a systematic error (see [2])
>>>>
>>>> This issue is still present on the upstream repository, but it has been
>>>> fixed on one of its forks. Bring the relevant patch from the fork to
>>>> allow building php-lua.
>>>>
>>>> [1] https://github.com/php/php-src/commit/91ef4124e56
>>>> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
>>>>
>>>> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
>>>
>>> Applied to 2025.02.x & 2025.05.x. Thanks
>>
>> Not in 2025.02.x as of commit 2d5c298d5a35 ("package/iperf3: add patch
>> to fix CVE-2025-54350").
>>
>> Also not in 2025.05.x as of commit 6f191b4dcc80 ("package/cpp-httplib:
>> add patch for CVE-2025-46728").
>>
>> baruch
>
> Indeed, thanks for the message. It was decided to not include this patch in the
> end because it was suspected to be the reason of the following build error
> https://gitlab.com/buildroot.org/buildroot/-/jobs/11176774941
I agree with your decision to not backport this patch yet.
Best regards,
Romain
>
> I already had my email reply prepared and forgot to remove this entry before
> sending them to the list when we synced.
>
> PERALE Thomas
>
>>>> ---
>>>> Changes in v3:
>>>> - Added empty Upstream tag
>>>> - Link to v2: https://lore.kernel.org/r/20250806-php-lua-v2-1-a73faad939e9@bootlin.com
>>>>
>>>> Changes in v2:
>>>> - update commit title
>>>> - add more details about the conditions leading to the build failure
>>>> - add minimal defconfig
>>>> - Link to v1: https://lore.kernel.org/r/20250806-php-lua-v1-1-e1f524fed0a5@bootlin.com
>>>> ---
>>>> ...-write-properly-read-property-was-changed.patch | 79 ++++++++++++++++++++++
>>>> 1 file changed, 79 insertions(+)
>>>>
>>>> diff --git
>>>> a/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
>>>> b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
>>>> new file mode 100644
>>>> index 0000000000000000000000000000000000000000..c1357b591b5b794b1eecf7cb02609a21de615b4c
>>>> --- /dev/null
>>>> +++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
>>>> @@ -0,0 +1,79 @@
>>>> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
>>>> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
>>>> +Date: Tue, 24 Aug 2021 08:28:47 +0100
>>>> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
>>>> + in https://github.com/php/php-src/commit/91ef4124e56
>>>> +
>>>> +Taken from https://github.com/badoo/php-lua/pull/8
>>>> +
>>>> +Upstream: n/a
>>>> +Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
>>>> +---
>>>> + lua.c | 28 ++++++++++++++--------------
>>>> + 1 file changed, 14 insertions(+), 14 deletions(-)
>>>> +
>>>> +diff --git a/lua.c b/lua.c
>>>> +index edc2868..32c1471 100755
>>>> +--- a/lua.c
>>>> ++++ b/lua.c
>>>> +@@ -229,46 +229,46 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
>>>> +
>>>> + /** {{{ static zval * php_lua_read_property(zval *object, zval *member, int type)
>>>> + */
>>>> +-zval *php_lua_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
>>>> +- lua_State *L = (Z_LUAVAL_P(object))->L;
>>>> +- zend_string *str_member;
>>>> ++zval *php_lua_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv){
>>>> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
>>>> +
>>>> + if (type != BP_VAR_R) {
>>>> + ZVAL_NULL(rv);
>>>> + return rv;
>>>> + }
>>>> +
>>>> +- str_member = zval_get_string(member);
>>>> + #if (LUA_VERSION_NUM < 502)
>>>> +- lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(str_member));
>>>> ++ lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(member));
>>>> + #else
>>>> +- lua_getglobal(L, ZSTR_VAL(str_member));
>>>> ++ lua_getglobal(L, ZSTR_VAL(member));
>>>> + #endif
>>>> +- zend_string_release(str_member);
>>>> +
>>>> +- php_lua_get_zval_from_lua(L, -1, object, rv);
>>>> ++ zval lua_zval_object;
>>>> ++ ZVAL_OBJ(&lua_zval_object, object);
>>>> ++
>>>> ++ php_lua_get_zval_from_lua(L, -1, &lua_zval_object, rv);
>>>> + lua_pop(L, 1);
>>>> ++
>>>> + return rv;
>>>> + }
>>>> + /* }}} */
>>>> +
>>>> + /** {{{ static void php_lua_write_property(zval *object, zval *member, zval *value)
>>>> + */
>>>> +-static void php_lua_write_property(zval *object, zval *member, zval *value, void ** key) {
>>>> +- lua_State *L = (Z_LUAVAL_P(object))->L;
>>>> +- zend_string *str_member = zval_get_string(member);
>>>> ++static zval* php_lua_write_property(zend_object *object, zend_string *member, zval *value, void ** key) {
>>>> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
>>>> +
>>>> + #if (LUA_VERSION_NUM < 502)
>>>> +- php_lua_send_zval_to_lua(L, member);
>>>> ++ lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
>>>> + php_lua_send_zval_to_lua(L, value);
>>>> +
>>>> + lua_settable(L, LUA_GLOBALSINDEX);
>>>> + #else
>>>> + php_lua_send_zval_to_lua(L, value);
>>>> +- lua_setglobal(L, Z_STRVAL_P(member));
>>>> ++ lua_setglobal(L, ZSTR_VAL(member));
>>>> + #endif
>>>> +
>>>> +- zend_string_release(str_member);
>>>> ++ return value;
>>>> + }
>>>> + /* }}} */
>>>> +
>>>>
>>>> ---
>>>> base-commit: 2fd520c8d52b9e0ed5e26343813fdd8dbcadb45f
>>>> change-id: 20250806-php-lua-39895d4fe179
>>>>
>>>> Best regards,
>>>> --
>>>> Alexis Lothoré, Bootlin
>>>> Embedded Linux and Kernel engineering
>>>> https://bootlin.com
>>>>
>>>> _______________________________________________
>>>> buildroot mailing list
>>>> buildroot@buildroot.org
>>>> https://lists.buildroot.org/mailman/listinfo/buildroot
>>> _______________________________________________
>>> buildroot mailing list
>>> buildroot@buildroot.org
>>> https://lists.buildroot.org/mailman/listinfo/buildroot
>>
>> --
>> ~. .~ Tk Open Systems
>> =}------------------------------------------------ooO--U--Ooo------------{=
>> - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
>> _______________________________________________
>> buildroot mailing list
>> buildroot@buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
>
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14
2025-08-11 7:52 [Buildroot] [PATCH v3] package/php-lua: fix build with PHP8/GCC14 Alexis Lothoré via buildroot
2025-08-24 15:36 ` Romain Naour via buildroot
2025-09-08 10:55 ` Thomas Perale via buildroot
@ 2025-09-19 12:56 ` Thomas Perale via buildroot
2 siblings, 0 replies; 11+ messages in thread
From: Thomas Perale via buildroot @ 2025-09-19 12:56 UTC (permalink / raw)
To: Alexis Lothoré; +Cc: Thomas Perale, buildroot
In reply of:
> On both Buildroot 2025.02.x and master branch, php-lua build fails on
> the following error:
>
> lua.c:862:44: error: assignment to 'zend_object_write_property_t' {aka
> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> struct _zval_struct *, void **)'} from incompatible pointer type 'void
> (*)(zval *, zval *, zval *, void **)' {aka 'void (*)(struct _zval_struct
> *, struct _zval_struct *, struct _zval_struct *, void **)'}
> [-Wincompatible-pointer-types]
> 862 | lua_object_handlers.write_property =
> php_lua_write_property;
> | ^
> lua.c:863:44: error: assignment to 'zend_object_read_property_t' {aka
> 'struct _zval_struct * (*)(struct _zend_object *, struct _zend_string *,
> int, void **, struct _zval_struct *)'} from incompatible pointer type
> 'zval * (*)(zval *, zval *, int, void **, zval *)' {aka 'struct
> _zval_struct * (*)(struct _zval_struct *, struct _zval_struct *, int,
> void **, struct _zval_struct *)'} [-Wincompatible-pointer-types]
> 863 | lua_object_handlers.read_property =
> php_lua_read_property;
> | ^
> make[2]: *** [Makefile:214: lua.lo] Error 1
>
> The error can be reproduced with the following minimal defconfig:
>
> BR2_arm=y
> BR2_cortex_a9=y
> BR2_ARM_ENABLE_NEON=y
> BR2_ARM_ENABLE_VFP=y
> BR2_ARM_FPU_NEON=y
> BR2_TOOLCHAIN_EXTERNAL=y
> BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
> BR2_PACKAGE_LUA=y
> BR2_PACKAGE_PHP=y
> BR2_PACKAGE_PHP_LUA=y
>
> This build failure is the result of two events/conditions:
> - the update to PHP8 has changed the prototype for
> zend_object_read_property_t (see [1]). But at this time, php-lua just
> generated a new warning (-Wincompatible-pointer-types)
> - using bootlin bleeding-edge toolchain brings in GCC14, which now turns
> this warning into a systematic error (see [2])
>
> This issue is still present on the upstream repository, but it has been
> fixed on one of its forks. Bring the relevant patch from the fork to
> allow building php-lua.
>
> [1] https://github.com/php/php-src/commit/91ef4124e56
> [2] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
>
> Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Applied to 2025.02.x, 2025.05.x & 2025.08.x. Thanks
> ---
> Changes in v3:
> - Added empty Upstream tag
> - Link to v2: https://lore.kernel.org/r/20250806-php-lua-v2-1-a73faad939e9@bootlin.com
>
> Changes in v2:
> - update commit title
> - add more details about the conditions leading to the build failure
> - add minimal defconfig
> - Link to v1: https://lore.kernel.org/r/20250806-php-lua-v1-1-e1f524fed0a5@bootlin.com
> ---
> ...-write-properly-read-property-was-changed.patch | 79 ++++++++++++++++++++++
> 1 file changed, 79 insertions(+)
>
> diff --git a/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> new file mode 100644
> index 0000000000000000000000000000000000000000..c1357b591b5b794b1eecf7cb02609a21de615b4c
> --- /dev/null
> +++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
> @@ -0,0 +1,79 @@
> +From de1068d634519abf2461dac9427b5ff24b6603af Mon Sep 17 00:00:00 2001
> +From: Mikhail Galanin <mikhail.galanin@team.bumble.com>
> +Date: Tue, 24 Aug 2021 08:28:47 +0100
> +Subject: [PATCH] php8: Signature of write_property/read_property was changed
> + in https://github.com/php/php-src/commit/91ef4124e56
> +
> +Taken from https://github.com/badoo/php-lua/pull/8
> +
> +Upstream: n/a
> +Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
> +---
> + lua.c | 28 ++++++++++++++--------------
> + 1 file changed, 14 insertions(+), 14 deletions(-)
> +
> +diff --git a/lua.c b/lua.c
> +index edc2868..32c1471 100755
> +--- a/lua.c
> ++++ b/lua.c
> +@@ -229,46 +229,46 @@ zend_object *php_lua_create_object(zend_class_entry *ce)
> +
> + /** {{{ static zval * php_lua_read_property(zval *object, zval *member, int type)
> + */
> +-zval *php_lua_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv){
> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> +- zend_string *str_member;
> ++zval *php_lua_read_property(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv){
> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> +
> + if (type != BP_VAR_R) {
> + ZVAL_NULL(rv);
> + return rv;
> + }
> +
> +- str_member = zval_get_string(member);
> + #if (LUA_VERSION_NUM < 502)
> +- lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(str_member));
> ++ lua_getfield(L, LUA_GLOBALSINDEX, ZSTR_VAL(member));
> + #else
> +- lua_getglobal(L, ZSTR_VAL(str_member));
> ++ lua_getglobal(L, ZSTR_VAL(member));
> + #endif
> +- zend_string_release(str_member);
> +
> +- php_lua_get_zval_from_lua(L, -1, object, rv);
> ++ zval lua_zval_object;
> ++ ZVAL_OBJ(&lua_zval_object, object);
> ++
> ++ php_lua_get_zval_from_lua(L, -1, &lua_zval_object, rv);
> + lua_pop(L, 1);
> ++
> + return rv;
> + }
> + /* }}} */
> +
> + /** {{{ static void php_lua_write_property(zval *object, zval *member, zval *value)
> + */
> +-static void php_lua_write_property(zval *object, zval *member, zval *value, void ** key) {
> +- lua_State *L = (Z_LUAVAL_P(object))->L;
> +- zend_string *str_member = zval_get_string(member);
> ++static zval* php_lua_write_property(zend_object *object, zend_string *member, zval *value, void ** key) {
> ++ lua_State *L = php_lua_obj_from_obj(object)->L;
> +
> + #if (LUA_VERSION_NUM < 502)
> +- php_lua_send_zval_to_lua(L, member);
> ++ lua_pushlstring(L, ZSTR_VAL(val), ZSTR_LEN(val));
> + php_lua_send_zval_to_lua(L, value);
> +
> + lua_settable(L, LUA_GLOBALSINDEX);
> + #else
> + php_lua_send_zval_to_lua(L, value);
> +- lua_setglobal(L, Z_STRVAL_P(member));
> ++ lua_setglobal(L, ZSTR_VAL(member));
> + #endif
> +
> +- zend_string_release(str_member);
> ++ return value;
> + }
> + /* }}} */
> +
>
> ---
> base-commit: 2fd520c8d52b9e0ed5e26343813fdd8dbcadb45f
> change-id: 20250806-php-lua-39895d4fe179
>
> Best regards,
> --
> Alexis Lothoré, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 11+ messages in thread