php8.2 build error: implicit declaration of function ‘memrchr’; did you mean ‘memchr’
Closed this issue · 4 comments
Hello,
I'm trying to build pthreads with php8.2 on debian 11
I've got a working php8.2 zts enabled version installed on the server.
root@sandbox-debian11:/usr/src/pthreads# php -r "echo PHP_ZTS;"
1
root@sandbox-debian11:/usr/src/pthreads# make
/bin/bash /usr/src/pthreads/libtool --mode=compile cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Werror=implicit-function-declaration -I. -I/usr/src/pthreads -DPHP_ATOM_INC -I/usr/src/pthreads/include -I/usr/src/pthreads/main -I/usr/src/pthreads -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib -I/usr/src/pthreads/. -DHAVE_CONFIG_H -g -O2 -c /usr/src/pthreads/php_pthreads.c -o php_pthreads.lo
mkdir .libs
cc -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -Werror=implicit-function-declaration -I. -I/usr/src/pthreads -DPHP_ATOM_INC -I/usr/src/pthreads/include -I/usr/src/pthreads/main -I/usr/src/pthreads -I/usr/include/php/20220829 -I/usr/include/php/20220829/main -I/usr/include/php/20220829/TSRM -I/usr/include/php/20220829/Zend -I/usr/include/php/20220829/ext -I/usr/include/php/20220829/ext/date/lib -I/usr/src/pthreads/. -DHAVE_CONFIG_H -g -O2 -c /usr/src/pthreads/php_pthreads.c -fPIC -DPIC -o .libs/php_pthreads.o
In file included from /usr/include/php/20220829/Zend/zend.h:409,
from /usr/include/php/20220829/main/php.h:31,
from ./src/pthreads.h:39,
from /usr/src/pthreads/php_pthreads.c:19:
/usr/include/php/20220829/Zend/zend_operators.h: In function ‘zend_memrchr’:
/usr/include/php/20220829/Zend/zend_operators.h:205:22: error: implicit declaration of function ‘memrchr’; did you mean ‘memchr’? [-Werror=implicit-function-declaration]
205 | return (const void*)memrchr(s, c, n);
| ^~~~~~~
| memchr
/usr/include/php/20220829/Zend/zend_operators.h:205:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
205 | return (const void*)memrchr(s, c, n);
| ^
cc1: some warnings being treated as errors
make: *** [Makefile:194: php_pthreads.lo] Error 1
root@sandbox-debian11:/usr/src/pthreads#
Any idea of what occurs here?
Hi, this doesn't look like a pthreads error at all. It's coming from some random header included from the generic php.h.
I've rebuilt php 8.2.4 with ZTS from sury debian packages.
It looks that is required to add "-D_GNU_SOURCE" but I don't know how where
Regards
I've edit Makefile and I add "-D_GNU_SOURCE" to "DEFS" and finally I've been able to build module.
DEFS = -DPHP_ATOM_INC -D_GNU_SOURCE -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
It would be nice to take in count this issue to have seamless compilation process everywhere.
As I said, this isn't a pthreads issue.