php: fix opcache link error in 7.4
PATCH 1/1 php: fix opcache link error in 7.4
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
--- meta-oe/recipes-devtools/php/php_7.4.4.bb | 11 +++++++++++ 1 file changed, 11 insertions(+)
meta-oe/recipes-devtools/php/php_7.4.4.bb +11 -0
@@ -111,6 +111,17 @@ export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" export PHP_PEAR_PHP_BIN = "${STAGING_BINDIR_NATIVE}/php" CFLAGS += " -D_GNU_SOURCE -g -DPTYS_ARE_GETPT -DPTYS_ARE_SEARCHED -I${STAGING_INCDIR}/apache2" +# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }" + +# Adding these flags enables dynamic library support, which is disabled by +# default when cross compiling +# See https://bugs.php.net/bug.php?id=60109 +CFLAGS += " -DHAVE_LIBDL " +LDFLAGS += " -ldl " + EXTRA_OEMAKE = "INSTALL_ROOT=${D}" acpaths = ""
Signature · 1 line
2.17.1
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 117
Quoted 9 lines · Claude Bing
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
...meta-oe/recipes-devtools/php/php_7.4.4.bb +4
-0+# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }"
Is this actually a bug in 0001-opcache-config.m4-enable-opcache.patch and should instead be fixed there?
- AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) - AC_MSG_RESULT([yes]) - PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)])
+ AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])
I would guess re-adding the PHP_CHECK_LIBRARY fixes your problem?
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 124
Quoted 7 lines
meta-oe/recipes-devtools/php/php_7.4.4.bb +6
-0+# Adding these flags enables dynamic library support, which is disabled by +# default when cross compiling +# See https://bugs.php.net/bug.php?id=60109 +CFLAGS += " -DHAVE_LIBDL " +LDFLAGS += " -ldl " +
The linked PHP bug was closed in 2018 due to lack of feedback.
cu
Adrian
Quoted 13 lines · Adrian Bunk
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 117
Quoted 9 lines · Claude Bing
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
...meta-oe/recipes-devtools/php/php_7.4.4.bb +4
-0+# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }"Is this actually a bug in 0001-opcache-config.m4-enable-opcache.patch and should instead be fixed there?
Yes, that does indeed fix the problem. Would you like me to reply to this thread with a new patch, or create a different thread?
Quoted 8 lines
(quoted diff) +1
-3- AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support]) - AC_MSG_RESULT([yes]) - PHP_CHECK_LIBRARY(rt, shm_unlink, [PHP_ADD_LIBRARY(rt,1,OPCACHE_SHARED_LIBADD)]) + AC_DEFINE(HAVE_SHM_MMAP_POSIX, 1, [Define if you have POSIX mmap() SHM support])I would guess re-adding the
PHP_CHECK_LIBRARYfixes your problem?
Quoted 9 lines
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 124
Quoted 7 lines
meta-oe/recipes-devtools/php/php_7.4.4.bb +6
-0+# Adding these flags enables dynamic library support, which is disabled by +# default when cross compiling +# See https://bugs.php.net/bug.php?id=60109 +CFLAGS += " -DHAVE_LIBDL " +LDFLAGS += " -ldl " +The linked PHP bug was closed in 2018 due to lack of feedback.
I have now added a comment to hopefully reopen the issue.
Quoted 4 lines
cu
Adrian
Quoted 15 lines · Claude Bing
Quoted 13 lines · Adrian Bunk
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 117
Quoted 9 lines · Claude Bing
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
...meta-oe/recipes-devtools/php/php_7.4.4.bb +4
-0+# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }"Is this actually a bug in 0001-opcache-config.m4-enable-opcache.patch and should instead be fixed there?
Quoted 3 lines
Yes, that does indeed fix the problem. Would you like me to reply to this thread with a new patch, or create a different thread?
...
Your original patch is already in master, please submit a new patch in a different thread that removes this workaround from php_7.4.4.bb and fixes 0001-opcache-config.m4-enable-opcache.patch.
Thanks
Adrian
OK, I started a new patch thread. Who/what determines which patches get included in the named release branches? Specifically, we are using dunfell and would like these changes to show up in that branch.
:)
Regards,
Claude Bing
Quoted 30 lines · Adrian Bunk
Quoted 15 lines · Claude Bing
Quoted 13 lines · Adrian Bunk
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 117
Quoted 9 lines · Claude Bing
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
...meta-oe/recipes-devtools/php/php_7.4.4.bb +4
-0+# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }"Is this actually a bug in 0001-opcache-config.m4-enable-opcache.patch and should instead be fixed there?
Quoted 3 lines
Yes, that does indeed fix the problem. Would you like me to reply to this thread with a new patch, or create a different thread?
...Your original patch is already in master, please submit a new patch in a different thread that removes this workaround from php_7.4.4.bb and fixes 0001-opcache-config.m4-enable-opcache.patch.
Thanks
Adrian
Hi Claude,
Quoted 4 lines · Claude Bing
OK, I started a new patch thread. Who/what determines which patches get included in the named release branches? Specifically, we are using dunfell and would like these changes to show up in that branch.
Just submit a patch to this list tagged with [dunfell]. In general though I won't take a patch unless it is already in master, so a patch for both master and dunfell should be tagged with [master][dunfell]
If the issue is already fixed in master with a version bump, and a version bump in dunfell would be too dangerous (i.e. feature changes) then I'll take a patch to the current version in dunfell. Again, tag it with [dunfell] and also mention the commit in master that fixes the issue.
Thanks,
Steve
Quoted 39 lines
:)
Regards,
Claude Bing
Quoted 30 lines · Adrian Bunk
Quoted 15 lines · Claude Bing
Quoted 13 lines · Adrian Bunk
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 117
Quoted 9 lines · Claude Bing
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
...meta-oe/recipes-devtools/php/php_7.4.4.bb +4
-0+# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }"Is this actually a bug in 0001-opcache-config.m4-enable-opcache.patch and should instead be fixed there?
Quoted 3 lines
Yes, that does indeed fix the problem. Would you like me to reply to this thread with a new patch, or create a different thread?
...Your original patch is already in master, please submit a new patch in a different thread that removes this workaround from php_7.4.4.bb and fixes 0001-opcache-config.m4-enable-opcache.patch.
Thanks
Adrian
The patch is already present in master, so I opted to send a patch rebased for dunfell. If there are any issues, please let me know.
Regards,
Claude Bing
Quoted 63 lines · Steve Sakoman
Hi Claude,
Quoted 4 lines · Claude Bing
OK, I started a new patch thread. Who/what determines which patches get included in the named release branches? Specifically, we are using dunfell and would like these changes to show up in that branch.
Just submit a patch to this list tagged with [dunfell]. In general though I won't take a patch unless it is already in master, so a patch for both master and dunfell should be tagged with [master][dunfell]
If the issue is already fixed in master with a version bump, and a version bump in dunfell would be too dangerous (i.e. feature changes) then I'll take a patch to the current version in dunfell. Again, tag it with [dunfell] and also mention the commit in master that fixes the issue.
Thanks,
Steve
Quoted 41 lines
:)
Regards,
Claude Bing
Quoted 30 lines · Adrian Bunk
Quoted 15 lines · Claude Bing
Quoted 13 lines · Adrian Bunk
meta-oe/recipes-devtools/php/php_7.4.4.bb export PHP_NATIVE_DIR = "${STAGING_BINDIR_NATIVE}" · line 117
Quoted 9 lines · Claude Bing
Explicitly specifying -lrt is required for opcache to be linked against the proper dependencies. Additionally, PHP disables libdl when it detects a cross-compilation environment for some reason. In order to load any type of extension, re-enabling libdl is required.
...meta-oe/recipes-devtools/php/php_7.4.4.bb +4
-0+# link against librt (libc) if opcache is specified in order to avoid the +# following error: +# Failed loading /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: /usr/lib/php7/extensions/no-debug-non-zts-20190902/opcache.so: undefined symbol: shm_unlink +LDFLAGS += "${@ " -lrt " if bb.utils.contains('PACKAGECONFIG', 'opcache', 'true', 'false', d) else "" }"Is this actually a bug in 0001-opcache-config.m4-enable-opcache.patch and should instead be fixed there?
Quoted 3 lines
Yes, that does indeed fix the problem. Would you like me to reply to this thread with a new patch, or create a different thread?
...Your original patch is already in master, please submit a new patch in a different thread that removes this workaround from php_7.4.4.bb and fixes 0001-opcache-config.m4-enable-opcache.patch.
Thanks
Adrian