php-src icon indicating copy to clipboard operation
php-src copied to clipboard

Unable to build if Valgrind is available

Open vobruba-martin opened this issue 4 years ago • 2 comments

Description

This code doesn't seem right:

/* Even if we don't build with valgrind support, include the symbol so that valgrind available
 * only at runtime will not result in false positives. */
#ifndef HAVE_VALGRIND
# define I_REPLACE_SONAME_FNNAME_ZU(soname, fnname) _vgr00000ZU_ ## soname ## _ ## fnname
#endif

ZEND_API bool ZEND_FASTCALL I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_val)(zend_string *s1, zend_string *s2)
{
	return !memcmp(ZSTR_VAL(s1), ZSTR_VAL(s2), ZSTR_LEN(s1));
}

Build fails with this error:

Zend/zend_string.c:375:29: error: ‘I_REPLACE_SONAME_FNNAME_ZU’ declared as function returning a function
 ZEND_API bool ZEND_FASTCALL I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_val)(zend_string *s1, zend_string *s2)
                             ^

As a workaround I had to use --without-valgrind to make the build successful.

PHP Version

PHP 8.1.5

Operating System

No response

vobruba-martin avatar Apr 28 '22 09:04 vobruba-martin

After further investigation I can tell that my valgrind version is too old to build with PHP 8.1 (valgrind.h is missing #define I_REPLACE_SONAME_FNNAME_ZU). I expect that configure script should catch this.

vobruba-martin avatar Apr 28 '22 10:04 vobruba-martin

We should replace this with #ifndef I_REPLACE_SONAME_FNNAME_ZU.

nikic avatar Apr 30 '22 09:04 nikic