* [Buildroot] [PATCH] package/php-lua: fix build with GCC14
@ 2025-08-06 8:12 Alexis Lothoré via buildroot
2025-08-06 8:57 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Alexis Lothoré via buildroot @ 2025-08-06 8:12 UTC (permalink / raw)
To: buildroot
Cc: Thomas Petazzoni, Hervé Codina, Nicolas Carrier,
Alexis Lothoré
On Buildroot 2025.02.x, 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
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.
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
I've taken a look at the official upstream to make the fix integrated in
here as well, but it really looks like a dead end: there has been no
activity for 5 years, and the maintainer does not seem to answer PRs or
issues. The PR containing the two patches introduced with the BR package
has not even been merged. I have been tempted to replace the upstream
source with the fork from which I took the patch
(https://github.com/badoo/php-lua), which looks slightly less "dead"
(last activity 2 years ago, and some work done to update the module
compatibility with current PHP major version). I eventually chose to
keep the current upstream and bring this single patch, but please let me
know if changing the upstream source would be better.
---
...-write-properly-read-property-was-changed.patch | 77 ++++++++++++++++++++++
1 file changed, 77 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..0c68a7062451d40a2d630c24244ab003bdfb9396
--- /dev/null
+++ b/package/php-lua/0003-php8-Signature-of-write-properly-read-property-was-changed.patch
@@ -0,0 +1,77 @@
+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
+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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/php-lua: fix build with GCC14
2025-08-06 8:12 [Buildroot] [PATCH] package/php-lua: fix build with GCC14 Alexis Lothoré via buildroot
@ 2025-08-06 8:57 ` Thomas Petazzoni via buildroot
2025-08-06 9:57 ` Alexis Lothoré via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-08-06 8:57 UTC (permalink / raw)
To: Alexis Lothoré; +Cc: buildroot, Hervé Codina, Nicolas Carrier
Hello Alexis,
On Wed, 06 Aug 2025 10:12:49 +0200
Alexis Lothoré <alexis.lothore@bootlin.com> wrote:
> On Buildroot 2025.02.x, php-lua build fails on the following error:
Buildroot 2025.02.x is one thing, but do you also see the same build
issue on master?
Since there's no build failure in our autobuilder (which is kind of
surprising), could you include in the commit log a snippet of a
reasonably minimal defconfig that exhibits the issue?
Also, do you know what caused the failure? I would suspect an update of
PHP.
> I've taken a look at the official upstream to make the fix integrated in
> here as well, but it really looks like a dead end: there has been no
> activity for 5 years, and the maintainer does not seem to answer PRs or
> issues. The PR containing the two patches introduced with the BR package
> has not even been merged. I have been tempted to replace the upstream
> source with the fork from which I took the patch
> (https://github.com/badoo/php-lua), which looks slightly less "dead"
> (last activity 2 years ago, and some work done to update the module
> compatibility with current PHP major version). I eventually chose to
> keep the current upstream and bring this single patch, but please let me
> know if changing the upstream source would be better.
It's of course annoying to have unmaintained things packaged in
Buildroot. I guess Nicolas is still using this software component?
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/php-lua: fix build with GCC14
2025-08-06 8:57 ` Thomas Petazzoni via buildroot
@ 2025-08-06 9:57 ` Alexis Lothoré via buildroot
2025-08-06 10:35 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 4+ messages in thread
From: Alexis Lothoré via buildroot @ 2025-08-06 9:57 UTC (permalink / raw)
To: Thomas Petazzoni; +Cc: buildroot, Hervé Codina, Nicolas Carrier
Hi Thomas,
On Wed Aug 6, 2025 at 10:57 AM CEST, Thomas Petazzoni wrote:
> Hello Alexis,
>
> On Wed, 06 Aug 2025 10:12:49 +0200
> Alexis Lothoré <alexis.lothore@bootlin.com> wrote:
>
>> On Buildroot 2025.02.x, php-lua build fails on the following error:
>
> Buildroot 2025.02.x is one thing, but do you also see the same build
> issue on master?
Yes, I have the build failure on top of master as well (on top of
2fd520c8d52b ("package/glm: bump version to 1.0.1"), to be precise)
>
> Since there's no build failure in our autobuilder (which is kind of
> surprising), could you include in the commit log a snippet of a
> reasonably minimal defconfig that exhibits the issue?
Sure, I'll include it in the next revision. It looks like this:
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
BR2_PACKAGE_PHP_PECL_DBUS=y
> Also, do you know what caused the failure? I would suspect an update of
> PHP.
If I trust the upstream pending PR, the failure is due to commit
91ef4124e56a ("Refactor zend_object_handlers API to pass zend_object* and
zend_string* insted of zval(s).") in upstream PHP project. I fail to find
the corresponding entry in any PHP changelog, but following the git
history, this has been introduced with PHP 8.0.0. I tried to quickly revert
to PHP 7.4.20, but this version does not even build anymore on
current BR (unrelated build failures)
However I observe that if I switch from Bootlin 'bleeding edge' toolchain
to 'stable' toolchain, php-lua build succeeds on master. So I guess this
issue is a mix of API change and compiler update. When using the stable
toolchain, I see the warning that matches the error I see when using the
bleeding-edge toolchain (-Wincompatible-pointer-types)
>> I've taken a look at the official upstream to make the fix integrated in
>> here as well, but it really looks like a dead end: there has been no
>> activity for 5 years, and the maintainer does not seem to answer PRs or
>> issues. The PR containing the two patches introduced with the BR package
>> has not even been merged. I have been tempted to replace the upstream
>> source with the fork from which I took the patch
>> (https://github.com/badoo/php-lua), which looks slightly less "dead"
>> (last activity 2 years ago, and some work done to update the module
>> compatibility with current PHP major version). I eventually chose to
>> keep the current upstream and bring this single patch, but please let me
>> know if changing the upstream source would be better.
>
> It's of course annoying to have unmaintained things packaged in
> Buildroot. I guess Nicolas is still using this software component?
>
> Thomas
--
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] 4+ messages in thread
* Re: [Buildroot] [PATCH] package/php-lua: fix build with GCC14
2025-08-06 9:57 ` Alexis Lothoré via buildroot
@ 2025-08-06 10:35 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-08-06 10:35 UTC (permalink / raw)
To: Alexis Lothoré; +Cc: buildroot, Hervé Codina, Nicolas Carrier
Hello Alexis,
On Wed, 06 Aug 2025 11:57:45 +0200
Alexis Lothoré <alexis.lothore@bootlin.com> wrote:
> > Also, do you know what caused the failure? I would suspect an update of
> > PHP.
>
> If I trust the upstream pending PR, the failure is due to commit
> 91ef4124e56a ("Refactor zend_object_handlers API to pass zend_object* and
> zend_string* insted of zval(s).") in upstream PHP project. I fail to find
> the corresponding entry in any PHP changelog, but following the git
> history, this has been introduced with PHP 8.0.0. I tried to quickly revert
> to PHP 7.4.20, but this version does not even build anymore on
> current BR (unrelated build failures)
>
> However I observe that if I switch from Bootlin 'bleeding edge' toolchain
> to 'stable' toolchain, php-lua build succeeds on master. So I guess this
> issue is a mix of API change and compiler update. When using the stable
> toolchain, I see the warning that matches the error I see when using the
> bleeding-edge toolchain (-Wincompatible-pointer-types)
As pointed out in my other e-mail replying to your other patch, this
definitely sounds like a GCC 15.x related issue, where GCC 15.x enabled
more checks, causing a hard build failure where "simple" warnings were
emitted earlier.
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-08-06 10:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 8:12 [Buildroot] [PATCH] package/php-lua: fix build with GCC14 Alexis Lothoré via buildroot
2025-08-06 8:57 ` Thomas Petazzoni via buildroot
2025-08-06 9:57 ` Alexis Lothoré via buildroot
2025-08-06 10:35 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox