Message ID | 20210805085353.3457-2-p.debruijn@unilogic.nl |
---|---|
State | Changes Requested |
Headers | show |
Series | [1/3] package/php: remove ineffective opcache patch | expand |
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, >
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,
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