[Buildroot] [PATCH 2/3] package/php: opcache link against librt for shm_unlink

Pascal de Bruijn p.debruijn at unilogic.nl
Thu Aug 5 08:53:52 UTC 2021


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 at 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 at 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 at 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




More information about the buildroot mailing list