buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch
@ 2021-08-05  8:53 Pascal de Bruijn
  2021-08-05  8:53 ` [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink Pascal de Bruijn
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Pascal de Bruijn @ 2021-08-05  8:53 UTC (permalink / raw)
  To: buildroot; +Cc: aduskett, Pascal de Bruijn

Current opcache builds compile, but fail at runtime due to shm_unlink not
being resolvable.

Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
---
 .../0005-allow-opcache-cross-compiling.patch  | 37 -------------------
 1 file changed, 37 deletions(-)
 delete mode 100644 package/php/0005-allow-opcache-cross-compiling.patch

diff --git a/package/php/0005-allow-opcache-cross-compiling.patch b/package/php/0005-allow-opcache-cross-compiling.patch
deleted file mode 100644
index d168f71892..0000000000
--- a/package/php/0005-allow-opcache-cross-compiling.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 9bb316c41a69935ee2072626467241889594bed4 Mon Sep 17 00:00:00 2001
-From: Adam Duskett <aduskett@gmail.com>
-Date: Mon, 28 Jun 2021 11:12:36 -0700
-Subject: [PATCH] allow opcache cross-compiling
-
-Remove the check at the end of ext/opcache/config.m4 that prevents opcache from
-being enabled in a cross-compiled environment. We pass the following as a
-CFLAGS when opcache is enabled:
-  -DHAVE_SHM_IPC
-  -DHAVE_SHM_MMAP_ANON
-  -DHAVE_SHM_MMAP_ZERO
-  -DHAVE_SHM_MMAP_POSIX
-  -DHAVE_SHM_MMAP_FILE
-
-Signed-off-by: Adam Duskett <aduskett@gmail.com>
----
- ext/opcache/config.m4 | 4 ----
- 1 file changed, 4 deletions(-)
-
-diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
-index 5492fd92..10c150ff 100644
---- a/ext/opcache/config.m4
-+++ b/ext/opcache/config.m4
-@@ -339,10 +339,6 @@ int main() {
-   PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
-   PHP_ADD_EXTENSION_DEP(opcache, pcre)
- 
--  if test "$have_shm_ipc" != "yes" && test "$have_shm_mmap_posix" != "yes" && test "$have_shm_mmap_anon" != "yes"; then
--    AC_MSG_ERROR([No supported shared memory caching support was found when configuring opcache. Check config.log for any errors or missing dependencies.])
--  fi
--
-   if test "$PHP_OPCACHE_JIT" = "yes"; then
-     PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1)
-     PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag)
--- 
-2.31.1
-
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink
  2021-08-05  8:53 [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Pascal de Bruijn
@ 2021-08-05  8:53 ` Pascal de Bruijn
  2021-08-05 16:39   ` Arnout Vandecappelle
  2021-08-05  8:53 ` [Buildroot] [PATCH 3/3] package/php: enable opcache jit Pascal de Bruijn
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Pascal de Bruijn @ 2021-08-05  8:53 UTC (permalink / raw)
  To: buildroot; +Cc: aduskett, Pascal de Bruijn

shm_unlink is resolved at runtime, therefore verification needs
to be done at runtime as well:

php -dopcache.enable_cli=1 -r 'print "test\n";'

Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
---
 ...he-link-against-librt-for-shm_unlink.patch | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 package/php/0005-opcache-link-against-librt-for-shm_unlink.patch

diff --git a/package/php/0005-opcache-link-against-librt-for-shm_unlink.patch b/package/php/0005-opcache-link-against-librt-for-shm_unlink.patch
new file mode 100644
index 0000000000..177a7a2b0f
--- /dev/null
+++ b/package/php/0005-opcache-link-against-librt-for-shm_unlink.patch
@@ -0,0 +1,26 @@
+From: Pascal de Bruijn <p.debruijn@unilogic.nl>
+Date: Wed, 04 Aug 2021 10:01:00 +0200
+Subject: [PATCH] opcache link against librt for shm_unlink
+
+We do this by modifying the fourth parameter of the relevant
+AC_RUN_IFELSE statement, which is the result if a cross compile
+is detected.
+
+Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
+---
+
+diff -Nurpd a/ext/opcache/config.m4 b/ext/opcache/config.m4
+--- a/ext/opcache/config.m4	2021-07-29 14:53:58.000000000 +0200
++++ b/ext/opcache/config.m4	2021-08-04 09:20:16.950350469 +0200
+@@ -295,7 +295,10 @@ int main() {
+   ],[
+     AC_MSG_RESULT([no])
+   ],[
+-    AC_MSG_RESULT([no])
++    AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
++    AC_MSG_RESULT([yes])
++    have_shm_mmap_posix=yes
++    PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
+   ])
+ 
+   PHP_NEW_EXTENSION(opcache,
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05  8:53 [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Pascal de Bruijn
  2021-08-05  8:53 ` [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink Pascal de Bruijn
@ 2021-08-05  8:53 ` Pascal de Bruijn
  2021-08-05 13:31   ` Thomas Petazzoni
  2021-08-05 16:44 ` [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Arnout Vandecappelle
  2021-08-10 19:01 ` Yann E. MORIN
  3 siblings, 1 reply; 14+ messages in thread
From: Pascal de Bruijn @ 2021-08-05  8:53 UTC (permalink / raw)
  To: buildroot; +Cc: aduskett, Pascal de Bruijn

Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
---
 package/php/php.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/php/php.mk b/package/php/php.mk
index 6780b6a962..3cb7090502 100644
--- a/package/php/php.mk
+++ b/package/php/php.mk
@@ -62,7 +62,7 @@ PHP_CXXFLAGS = $(TARGET_CXXFLAGS)
 # The OPcache extension isn't cross-compile friendly
 # Throw some defines here to avoid patching heavily
 ifeq ($(BR2_PACKAGE_PHP_EXT_OPCACHE),y)
-PHP_CONF_OPTS += --enable-opcache --disable-opcache-jit
+PHP_CONF_OPTS += --enable-opcache --enable-opcache-jit
 PHP_CONF_ENV += ac_cv_func_mprotect=yes
 PHP_CFLAGS += \
 	-DHAVE_SHM_IPC \
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05  8:53 ` [Buildroot] [PATCH 3/3] package/php: enable opcache jit Pascal de Bruijn
@ 2021-08-05 13:31   ` Thomas Petazzoni
  2021-08-05 13:53     ` Pascal de Bruijn
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2021-08-05 13:31 UTC (permalink / raw)
  To: Pascal de Bruijn; +Cc: aduskett, buildroot

Hello Pascal,

On Thu,  5 Aug 2021 10:53:53 +0200
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> ---
>  package/php/php.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/package/php/php.mk b/package/php/php.mk
> index 6780b6a962..3cb7090502 100644
> --- a/package/php/php.mk
> +++ b/package/php/php.mk
> @@ -62,7 +62,7 @@ PHP_CXXFLAGS = $(TARGET_CXXFLAGS)
>  # The OPcache extension isn't cross-compile friendly
>  # Throw some defines here to avoid patching heavily
>  ifeq ($(BR2_PACKAGE_PHP_EXT_OPCACHE),y)
> -PHP_CONF_OPTS += --enable-opcache --disable-opcache-jit
> +PHP_CONF_OPTS += --enable-opcache --enable-opcache-jit

Do you have a justification as to why things have changed since commit
469c11c516959375f6caddde178adbdcdc5d9887, which disabled Opcache JIT
support ?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 13:31   ` Thomas Petazzoni
@ 2021-08-05 13:53     ` Pascal de Bruijn
  2021-08-05 14:01       ` Thomas Petazzoni
  0 siblings, 1 reply; 14+ messages in thread
From: Pascal de Bruijn @ 2021-08-05 13:53 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: aduskett, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 1144 bytes --]

Hey,
Do you have a justification as to why things have changed since commit
469c11c516959375f6caddde178adbdcdc5d9887, which disabled Opcache JIT
support ?
No not really... I've not found a case where JIT does not work (when properly enabled in php.ini), maybe @aduskett could elaborate...

Opcache (with or without JIT) was completely broken both in buildroot for both 7.4.x and 8.0.x due to the shm_unlink issue with librt. The main issue is that this fails at runtime, so you can have opcache compile just fine, but non-functional when enabled in php.ini...

I've tested the following with all three my patches:

    php 7.4.20 (2021.02.x branch without JIT) on amd64
    php 8.0.9 (master branch with JIT) on amd64
    php 8.0.9 (master branch without JIT) on arm

on non-x86 JIT is automatically disabled (even if built with --enable-opcache-jit), as it seems to be supported on x86 exclusively for now, but that may change in future versions of PHP. PHP versions before 8, don't have the JIT at all.

Therefore I would recommend cherrypicking ed355dec (PATCH 2/3), to the 2021.02.x branch.

Regards,
Pascal de Bruijn


[-- Attachment #1.2: Type: text/html, Size: 2588 bytes --]

[-- Attachment #2: Type: text/plain, Size: 145 bytes --]

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 13:53     ` Pascal de Bruijn
@ 2021-08-05 14:01       ` Thomas Petazzoni
  2021-08-05 14:04         ` Pascal de Bruijn
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2021-08-05 14:01 UTC (permalink / raw)
  To: Pascal de Bruijn; +Cc: aduskett, buildroot

Hello Pascal,

On Thu, 5 Aug 2021 13:53:21 +0000
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> No not really... I've not found a case where JIT does not work (when
> properly enabled in php.ini), maybe @aduskett could elaborate...

Yes, it would be good to have some details from Adam.

> Opcache (with or without JIT) was completely broken both in buildroot
> for both 7.4.x and 8.0.x due to the shm_unlink issue with librt. The
> main issue is that this fails at runtime, so you can have opcache
> compile just fine, but non-functional when enabled in php.ini...

I'm confused about the librt thing, because librt never existed in
musl, and it was dropped a long time ago in uClibc/glibc. Buildroot no
longer supports glibc versions where librt was a separate library from
libc.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 14:01       ` Thomas Petazzoni
@ 2021-08-05 14:04         ` Pascal de Bruijn
  2021-08-05 14:10           ` Thomas Petazzoni
  0 siblings, 1 reply; 14+ messages in thread
From: Pascal de Bruijn @ 2021-08-05 14:04 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: aduskett, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 1687 bytes --]

Hey,
I'm confused about the librt thing, because librt never existed in
musl, and it was dropped a long time ago in uClibc/glibc. Buildroot no
longer supports glibc versions where librt was a separate library from
libc.
In ed355dec (PATCH 2/3) the following line is what makes opcache actually work:

PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])

Regards,
Pascal de Bruijn
________________________________
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Sent: Thursday, August 5, 2021 16:01
To: Pascal de Bruijn <p.debruijn@unilogic.nl>
Cc: buildroot@buildroot.org <buildroot@buildroot.org>; aduskett@gmail.com <aduskett@gmail.com>
Subject: Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit

Hello Pascal,

On Thu, 5 Aug 2021 13:53:21 +0000
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> No not really... I've not found a case where JIT does not work (when
> properly enabled in php.ini), maybe @aduskett could elaborate...

Yes, it would be good to have some details from Adam.

> Opcache (with or without JIT) was completely broken both in buildroot
> for both 7.4.x and 8.0.x due to the shm_unlink issue with librt. The
> main issue is that this fails at runtime, so you can have opcache
> compile just fine, but non-functional when enabled in php.ini...

I'm confused about the librt thing, because librt never existed in
musl, and it was dropped a long time ago in uClibc/glibc. Buildroot no
longer supports glibc versions where librt was a separate library from
libc.

Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #1.2: Type: text/html, Size: 3307 bytes --]

[-- Attachment #2: Type: text/plain, Size: 145 bytes --]

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 14:04         ` Pascal de Bruijn
@ 2021-08-05 14:10           ` Thomas Petazzoni
  2021-08-05 14:47             ` Pascal de Bruijn
  0 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2021-08-05 14:10 UTC (permalink / raw)
  To: Pascal de Bruijn; +Cc: aduskett, buildroot

Hello,

On Thu, 5 Aug 2021 14:04:49 +0000
Pascal de Bruijn <p.debruijn@unilogic.nl> wrote:

> In ed355dec (PATCH 2/3) the following line is what makes opcache actually work:

What is ed355dec ? I don't have any commit with that reference in
Buildroot. If it's the reference of the commit of PATCH 2/3 in your
Buildroot Git repository, then it doesn't make sense to reference it,
as this commit won't have the same hash when we'll apply your patch,
i.e ed355dec means nothing expect just to you locally.

> PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])

And what is this doing ? Again shm_unlink() is no longer in librt, it's
in libc since glibc 2.17 (if I remember correctly).

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 14:10           ` Thomas Petazzoni
@ 2021-08-05 14:47             ` Pascal de Bruijn
  2021-08-05 16:27               ` Arnout Vandecappelle
  0 siblings, 1 reply; 14+ messages in thread
From: Pascal de Bruijn @ 2021-08-05 14:47 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: aduskett, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 1123 bytes --]

Hey,
> In ed355dec (PATCH 2/3) the following line is what makes opcache actually work:

What is ed355dec ? I don't have any commit with that reference in
Buildroot. If it's the reference of the commit of PATCH 2/3 in your
Buildroot Git repository, then it doesn't make sense to reference it,
as this commit won't have the same hash when we'll apply your patch,
i.e ed355dec means nothing expect just to you locally.
I know, which is why I referenced both. So I'm referencing the second of three patches in my recently submitted series regarding package/php.
> PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])

And what is this doing ? Again shm_unlink() is no longer in librt, it's
in libc since glibc 2.17 (if I remember correctly).
PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) is executed for non-cross-compiles, and with my patch also executes for cross-compiles.

Though I haven't looked deeply into the PHP specific autotools macros...
https://github.com/php/php-src/blob/PHP-8.0.9/build/php.m4#L1507

Regards,
Pascal de Bruijn


[-- Attachment #1.2: Type: text/html, Size: 2560 bytes --]

[-- Attachment #2: Type: text/plain, Size: 145 bytes --]

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 14:47             ` Pascal de Bruijn
@ 2021-08-05 16:27               ` Arnout Vandecappelle
  2021-08-05 16:41                 ` Arnout Vandecappelle
  0 siblings, 1 reply; 14+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 16:27 UTC (permalink / raw)
  To: Pascal de Bruijn, Thomas Petazzoni; +Cc: aduskett, buildroot



On 05/08/2021 16:47, Pascal de Bruijn wrote:
> Hey,
> 
>>     > In ed355dec (PATCH 2/3) the following line is what makes opcache actually
>>     work:
>> 
>>     What is ed355dec ? I don't have any commit with that reference in
>>     Buildroot. If it's the reference of the commit of PATCH 2/3 in your
>>     Buildroot Git repository, then it doesn't make sense to reference it,
>>     as this commit won't have the same hash when we'll apply your patch,
>>     i.e ed355dec means nothing expect just to you locally.
> 
> I know, which is why I referenced both. So I'm referencing the second of three
> patches in my recently submitted series regarding package/php.
> 
>>     > PHP_CHECK_LIBRARY(rt, shm_unlink,
>>     [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
>> 
>>     And what is this doing ? Again shm_unlink() is no longer in librt, it's
>>     in libc since glibc 2.17 (if I remember correctly).
> 
> PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
> is executed for non-cross-compiles, and with my patch also executes for
> cross-compiles.
> 
> Though I haven't looked deeply into the PHP specific autotools macros...
> https://github.com/php/php-src/blob/PHP-8.0.9/build/php.m4#L1507

 This bit is indeed useless with modern glibc, but all libc still install an
(empty?) librt for backward compatibility, so it doesn't hurt either.

 Regards,
 Arnout

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink
  2021-08-05  8:53 ` [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink Pascal de Bruijn
@ 2021-08-05 16:39   ` Arnout Vandecappelle
  0 siblings, 0 replies; 14+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 16:39 UTC (permalink / raw)
  To: Pascal de Bruijn, buildroot; +Cc: aduskett



On 05/08/2021 10:53, Pascal de Bruijn wrote:
> shm_unlink is resolved at runtime, therefore verification needs
> to be done at runtime as well:
> 
> php -dopcache.enable_cli=1 -r 'print "test\n";'
> 
> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> ---
>  ...he-link-against-librt-for-shm_unlink.patch | 26 +++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 package/php/0005-opcache-link-against-librt-for-shm_unlink.patch
> 
> diff --git a/package/php/0005-opcache-link-against-librt-for-shm_unlink.patch b/package/php/0005-opcache-link-against-librt-for-shm_unlink.patch
> new file mode 100644
> index 0000000000..177a7a2b0f
> --- /dev/null
> +++ b/package/php/0005-opcache-link-against-librt-for-shm_unlink.patch
> @@ -0,0 +1,26 @@
> +From: Pascal de Bruijn <p.debruijn@unilogic.nl>
> +Date: Wed, 04 Aug 2021 10:01:00 +0200
> +Subject: [PATCH] opcache link against librt for shm_unlink
> +
> +We do this by modifying the fourth parameter of the relevant
> +AC_RUN_IFELSE statement, which is the result if a cross compile
> +is detected.
> +
> +Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> +---
> +
> +diff -Nurpd a/ext/opcache/config.m4 b/ext/opcache/config.m4
> +--- a/ext/opcache/config.m4	2021-07-29 14:53:58.000000000 +0200
> ++++ b/ext/opcache/config.m4	2021-08-04 09:20:16.950350469 +0200
> +@@ -295,7 +295,10 @@ int main() {
> +   ],[
> +     AC_MSG_RESULT([no])
> +   ],[
> +-    AC_MSG_RESULT([no])
> ++    AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
> ++    AC_MSG_RESULT([yes])
> ++    have_shm_mmap_posix=yes
> ++    PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])

 What's the upstream status of this patch? It looks pretty wrong... Basically,
when cross-compiling, you will assume that shm_mmap is available
unconditionally. At the very least, things should be moved down into the
PHP_CHECK_LIBRARY part (with an action-if-not-found branch that keeps the
original 'no' result). So something like:

PHP_CHECK_LIBRARY(rt, shm_unlink, [
  AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
  AC_MSG_RESULT([yes])
  have_shm_mmap_posix=yes
  PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)
],[
  AC_MSG_RESULT([no])
])

Alternatively (probably better), use AC_CHECK_FUNC and keep the original
PHP_CHECK_LIBRARY in the action-if-found branch.

 Also, better check for shm_open instead of shm_unlink - shm_open is the
function mentioned in the AC_MSG_CHECKING() call.



 Regards,
 Arnout


> +   ])
> + 
> +   PHP_NEW_EXTENSION(opcache,
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 3/3] package/php: enable opcache jit
  2021-08-05 16:27               ` Arnout Vandecappelle
@ 2021-08-05 16:41                 ` Arnout Vandecappelle
  0 siblings, 0 replies; 14+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 16:41 UTC (permalink / raw)
  To: Pascal de Bruijn, Thomas Petazzoni; +Cc: aduskett, buildroot



On 05/08/2021 18:27, Arnout Vandecappelle wrote:
> 
> 
> On 05/08/2021 16:47, Pascal de Bruijn wrote:
>> Hey,
>>
>>>     > In ed355dec (PATCH 2/3) the following line is what makes opcache actually
>>>     work:
>>>
>>>     What is ed355dec ? I don't have any commit with that reference in
>>>     Buildroot. If it's the reference of the commit of PATCH 2/3 in your
>>>     Buildroot Git repository, then it doesn't make sense to reference it,
>>>     as this commit won't have the same hash when we'll apply your patch,
>>>     i.e ed355dec means nothing expect just to you locally.
>>
>> I know, which is why I referenced both. So I'm referencing the second of three
>> patches in my recently submitted series regarding package/php.
>>
>>>     > PHP_CHECK_LIBRARY(rt, shm_unlink,
>>>     [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
>>>
>>>     And what is this doing ? Again shm_unlink() is no longer in librt, it's
>>>     in libc since glibc 2.17 (if I remember correctly).
>>
>> PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
>> is executed for non-cross-compiles, and with my patch also executes for
>> cross-compiles.
>>
>> Though I haven't looked deeply into the PHP specific autotools macros...
>> https://github.com/php/php-src/blob/PHP-8.0.9/build/php.m4#L1507
> 
>  This bit is indeed useless with modern glibc, but all libc still install an
> (empty?) librt for backward compatibility, so it doesn't hurt either.

 But now I think more about it: how does this patch make it succeed at runtime?
Unless you are indeed using an ancient glibc, it should do exactly nothing. Or
is it the define of HAVE_SHM_MMAP_POSIX (also added by patch 2/3) that makes the
difference?

 Regards,
 Arnout

_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch
  2021-08-05  8:53 [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Pascal de Bruijn
  2021-08-05  8:53 ` [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink Pascal de Bruijn
  2021-08-05  8:53 ` [Buildroot] [PATCH 3/3] package/php: enable opcache jit Pascal de Bruijn
@ 2021-08-05 16:44 ` Arnout Vandecappelle
  2021-08-10 19:01 ` Yann E. MORIN
  3 siblings, 0 replies; 14+ messages in thread
From: Arnout Vandecappelle @ 2021-08-05 16:44 UTC (permalink / raw)
  To: Pascal de Bruijn, buildroot; +Cc: aduskett



On 05/08/2021 10:53, Pascal de Bruijn wrote:
> Current opcache builds compile, but fail at runtime due to shm_unlink not
> being resolvable.
> 
> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> ---
>  .../0005-allow-opcache-cross-compiling.patch  | 37 -------------------
>  1 file changed, 37 deletions(-)
>  delete mode 100644 package/php/0005-allow-opcache-cross-compiling.patch
> 
> diff --git a/package/php/0005-allow-opcache-cross-compiling.patch b/package/php/0005-allow-opcache-cross-compiling.patch
> deleted file mode 100644
> index d168f71892..0000000000
> --- a/package/php/0005-allow-opcache-cross-compiling.patch
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -From 9bb316c41a69935ee2072626467241889594bed4 Mon Sep 17 00:00:00 2001
> -From: Adam Duskett <aduskett@gmail.com>
> -Date: Mon, 28 Jun 2021 11:12:36 -0700
> -Subject: [PATCH] allow opcache cross-compiling
> -
> -Remove the check at the end of ext/opcache/config.m4 that prevents opcache from
> -being enabled in a cross-compiled environment. We pass the following as a
> -CFLAGS when opcache is enabled:
> -  -DHAVE_SHM_IPC
> -  -DHAVE_SHM_MMAP_ANON
> -  -DHAVE_SHM_MMAP_ZERO
> -  -DHAVE_SHM_MMAP_POSIX
> -  -DHAVE_SHM_MMAP_FILE
> -
> -Signed-off-by: Adam Duskett <aduskett@gmail.com>
> ----
> - ext/opcache/config.m4 | 4 ----
> - 1 file changed, 4 deletions(-)
> -
> -diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
> -index 5492fd92..10c150ff 100644
> ---- a/ext/opcache/config.m4
> -+++ b/ext/opcache/config.m4
> -@@ -339,10 +339,6 @@ int main() {
> -   PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
> -   PHP_ADD_EXTENSION_DEP(opcache, pcre)
> - 
> --  if test "$have_shm_ipc" != "yes" && test "$have_shm_mmap_posix" != "yes" && test "$have_shm_mmap_anon" != "yes"; then

 I don't understand how opcache can work at all if you remove this patch.
have_shm_mmap_anon is still no after patch 2/3, so opcache won't work, right?

 Regards,
 Arnout

> --    AC_MSG_ERROR([No supported shared memory caching support was found when configuring opcache. Check config.log for any errors or missing dependencies.])
> --  fi
> --
> -   if test "$PHP_OPCACHE_JIT" = "yes"; then
> -     PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1)
> -     PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag)
> --- 
> -2.31.1
> -
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch
  2021-08-05  8:53 [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Pascal de Bruijn
                   ` (2 preceding siblings ...)
  2021-08-05 16:44 ` [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Arnout Vandecappelle
@ 2021-08-10 19:01 ` Yann E. MORIN
  3 siblings, 0 replies; 14+ messages in thread
From: Yann E. MORIN @ 2021-08-10 19:01 UTC (permalink / raw)
  To: Pascal de Bruijn; +Cc: aduskett, buildroot

Pascal, All,

Given the questions raised by this series, I think more testing and more
detailed commit messages that explain the changes will be needed.

As a consequence, I've marked this series as changes-requested.

Thanks!

Regards,
Yann E. MORIN.

On 2021-08-05 10:53 +0200, Pascal de Bruijn spake thusly:
> Current opcache builds compile, but fail at runtime due to shm_unlink not
> being resolvable.
> 
> Signed-off-by: Pascal de Bruijn <p.debruijn@unilogic.nl>
> ---
>  .../0005-allow-opcache-cross-compiling.patch  | 37 -------------------
>  1 file changed, 37 deletions(-)
>  delete mode 100644 package/php/0005-allow-opcache-cross-compiling.patch
> 
> diff --git a/package/php/0005-allow-opcache-cross-compiling.patch b/package/php/0005-allow-opcache-cross-compiling.patch
> deleted file mode 100644
> index d168f71892..0000000000
> --- a/package/php/0005-allow-opcache-cross-compiling.patch
> +++ /dev/null
> @@ -1,37 +0,0 @@
> -From 9bb316c41a69935ee2072626467241889594bed4 Mon Sep 17 00:00:00 2001
> -From: Adam Duskett <aduskett@gmail.com>
> -Date: Mon, 28 Jun 2021 11:12:36 -0700
> -Subject: [PATCH] allow opcache cross-compiling
> -
> -Remove the check at the end of ext/opcache/config.m4 that prevents opcache from
> -being enabled in a cross-compiled environment. We pass the following as a
> -CFLAGS when opcache is enabled:
> -  -DHAVE_SHM_IPC
> -  -DHAVE_SHM_MMAP_ANON
> -  -DHAVE_SHM_MMAP_ZERO
> -  -DHAVE_SHM_MMAP_POSIX
> -  -DHAVE_SHM_MMAP_FILE
> -
> -Signed-off-by: Adam Duskett <aduskett@gmail.com>
> ----
> - ext/opcache/config.m4 | 4 ----
> - 1 file changed, 4 deletions(-)
> -
> -diff --git a/ext/opcache/config.m4 b/ext/opcache/config.m4
> -index 5492fd92..10c150ff 100644
> ---- a/ext/opcache/config.m4
> -+++ b/ext/opcache/config.m4
> -@@ -339,10 +339,6 @@ int main() {
> -   PHP_ADD_BUILD_DIR([$ext_builddir/Optimizer], 1)
> -   PHP_ADD_EXTENSION_DEP(opcache, pcre)
> - 
> --  if test "$have_shm_ipc" != "yes" && test "$have_shm_mmap_posix" != "yes" && test "$have_shm_mmap_anon" != "yes"; then
> --    AC_MSG_ERROR([No supported shared memory caching support was found when configuring opcache. Check config.log for any errors or missing dependencies.])
> --  fi
> --
> -   if test "$PHP_OPCACHE_JIT" = "yes"; then
> -     PHP_ADD_BUILD_DIR([$ext_builddir/jit], 1)
> -     PHP_ADD_MAKEFILE_FRAGMENT($ext_srcdir/jit/Makefile.frag)
> --- 
> -2.31.1
> -
> -- 
> 2.25.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-08-10 19:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  8:53 [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Pascal de Bruijn
2021-08-05  8:53 ` [Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink Pascal de Bruijn
2021-08-05 16:39   ` Arnout Vandecappelle
2021-08-05  8:53 ` [Buildroot] [PATCH 3/3] package/php: enable opcache jit Pascal de Bruijn
2021-08-05 13:31   ` Thomas Petazzoni
2021-08-05 13:53     ` Pascal de Bruijn
2021-08-05 14:01       ` Thomas Petazzoni
2021-08-05 14:04         ` Pascal de Bruijn
2021-08-05 14:10           ` Thomas Petazzoni
2021-08-05 14:47             ` Pascal de Bruijn
2021-08-05 16:27               ` Arnout Vandecappelle
2021-08-05 16:41                 ` Arnout Vandecappelle
2021-08-05 16:44 ` [Buildroot] [PATCH 1/3] package/php: remove ineffective opcache patch Arnout Vandecappelle
2021-08-10 19:01 ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).