* [Buildroot] [PATCH 1/1] package/php: depend on libucontext for musl builds
@ 2023-05-16 19:33 Bernd Kuhls
2023-08-06 16:03 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Bernd Kuhls @ 2023-05-16 19:33 UTC (permalink / raw)
To: buildroot
Depends on new libucontext package:
http://patchwork.ozlabs.org/project/buildroot/patch/20220811063502.1823571-1-james.hilliard1@gmail.com/
Musl does not implement functions operating on ucontext_t:
https://wiki.musl-libc.org/open-issues.html
Fixes:
http://autobuild.buildroot.net/results/778/77857026b7cb3b9eb5ef57c779f4737b094b6974/
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
package/php/Config.in | 6 +++++-
package/php/php.mk | 5 +++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/package/php/Config.in b/package/php/Config.in
index 69b4268c1d..18779ba1f9 100644
--- a/package/php/Config.in
+++ b/package/php/Config.in
@@ -8,7 +8,9 @@ config BR2_PACKAGE_PHP_ARCH_SUPPORTS
default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
default y if BR2_RISCV_64
default y if BR2_s390x
- default y if BR2_TOOLCHAIN_HAS_UCONTEXT
+ default y if \
+ BR2_TOOLCHAIN_HAS_UCONTEXT || \
+ BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
config BR2_PACKAGE_PHP
bool "php"
@@ -18,6 +20,8 @@ config BR2_PACKAGE_PHP
# section .text LMA [...,...]"
depends on !BR2_BINFMT_FLAT
depends on BR2_USE_WCHAR
+ select BR2_PACKAGE_LIBUCONTEXT if BR2_TOOLCHAIN_USES_MUSL && \
+ BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
select BR2_PACKAGE_PHP_SAPI_CGI if \
!BR2_PACKAGE_PHP_SAPI_APACHE && \
!BR2_PACKAGE_PHP_SAPI_CLI && \
diff --git a/package/php/php.mk b/package/php/php.mk
index 981da5b15d..0f6760afad 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -39,6 +39,11 @@ ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
PHP_EXTRA_LIBS += -latomic
endif
+ifeq ($(BR2_PACKAGE_LIBUCONTEXT),y)
+PHP_DEPENDENCIES += libucontext
+PHP_EXTRA_LIBS += -lucontext
+endif
+
ifeq ($(call qstrip,$(BR2_TARGET_LOCALTIME)),)
PHP_LOCALTIME = UTC
else
--
2.39.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] package/php: depend on libucontext for musl builds
2023-05-16 19:33 [Buildroot] [PATCH 1/1] package/php: depend on libucontext for musl builds Bernd Kuhls
@ 2023-08-06 16:03 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-06 16:03 UTC (permalink / raw)
To: Bernd Kuhls; +Cc: buildroot
Hello Bernd,
On Tue, 16 May 2023 21:33:07 +0200
Bernd Kuhls <bernd.kuhls@t-online.de> wrote:
> diff --git a/package/php/Config.in b/package/php/Config.in
> index 69b4268c1d..18779ba1f9 100644
> --- a/package/php/Config.in
> +++ b/package/php/Config.in
> @@ -8,7 +8,9 @@ config BR2_PACKAGE_PHP_ARCH_SUPPORTS
> default y if BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le
> default y if BR2_RISCV_64
> default y if BR2_s390x
> - default y if BR2_TOOLCHAIN_HAS_UCONTEXT
> + default y if \
> + BR2_TOOLCHAIN_HAS_UCONTEXT || \
> + BR2_PACKAGE_LIBUCONTEXT_ARCH_SUPPORTS
Thanks for looking into this.
I think this isn't the right solution, but it's not your fault: the
semantic of BR2_TOOLCHAIN_HAS_UCONTEXT today is fuzzy and vague, and
it's actually quite wrong how it's working.
If you look at your commit, you're basically saying that "some
toolchains define BR2_TOOLCHAIN_HAS_UCONTEXT, but in fact they don't
really provide ucontext support so we need to use an extra libucontext
library". Don't you see how weird that sounds?
libucontext should only be needed for toolchains that don't support
ucontext... and musl right now is declared as
BR2_TOOLCHAIN_HAS_UCONTEXT=y.
But that's wrong as you point out: musl only provides the ucontext_t
definition, but not the functions to manipulate it. So for example, the
existing capnproto package does this:
depends on BR2_TOOLCHAIN_HAS_UCONTEXT
but because musl doesn't really support ucontext, it also does:
# musl doesn't support getcontext/setcontext
ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
CAPNPROTO_CONF_ENV += CXXFLAGS="$(TARGET_CXXFLAGS) -DKJ_USE_FIBERS=0"
endif
For a similar reason, libopenssl has to do this:
ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
LIBOPENSSL_CFLAGS += -DOPENSSL_NO_ASYNC
endif
ifeq ($(BR2_TOOLCHAIN_HAS_UCONTEXT),)
LIBOPENSSL_CFLAGS += -DOPENSSL_NO_ASYNC
endif
Because libopenssl really uses ucontext, so
BR2_TOOLCHAIN_HAS_UCONTEXT=y isn't enough, it also needs to exclude the
musl case.
Apparently, the only packages for which BR2_TOOLCHAIN_HAS_UCONTEXT kind
of makes sense are libsigsegv libabseil-cpp, as it indeed only needs
ucontext_t, but not the getcontext/makecontext functions.
Still, I would argue that we should change BR2_TOOLCHAIN_HAS_UCONTEXT
to mean that the toolchain defines ucontext_t *and* implements
getcontext/makecontext/setcontext. This implies (1) adding a comment
above the option to explain its semantic and (2) drop the select
BR2_TOOLCHAIN_HAS_UCONTEXT from musl.
Then we can clean up libopenssl and capnproto. php would no longer
fail, because BR2_TOOLCHAIN_HAS_UCONTEXT would no longer be true for
musl.
And finally, we can re-enable php on musl by making use of libucontext.
Do you think you could work on this? It would be nice.
Thanks a lot,
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] 2+ messages in thread
end of thread, other threads:[~2023-08-06 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 19:33 [Buildroot] [PATCH 1/1] package/php: depend on libucontext for musl builds Bernd Kuhls
2023-08-06 16:03 ` 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