Closed rustjson closed 8 years ago
Works for me, if I ensure that phpize and php-config from php7 are used +1
However testing it, it fails with a segfault:
Program received signal SIGSEGV, Segmentation fault. 0x00007fffee989d8f in hp_execute_ex (execute_data=0x7fffef213770) at /home/fabian/php7/xhprof/xhprof/extension/xhprof.c:1462 1462 func = zend_string_init(class_name->val, class_name_len + 2 + func_name->len, 0); (gdb) bt
at /home/fabian/php7/php-src/Zend/zend_vm_execute.h:458
at /home/fabian/php7/php-src/Zend/zend.c:1428
(gdb)
I will check it tomorrow
@LionsAd Would you mind show my your script that you want to profile? I pushed a patch, try to pull the newest code and rebuild. Be aware that include are currently not supported
remove ignore support?
Uhm, any script did trigger the segfault.
@RustJason Thanks. All works for me.
Make failed to run for me when I tried to install XHProf.
Ubuntu 14.04.3 LTS PHP 7.0.2-1+deb.sury.org~trusty+1 (cli) ( NTS )
vagrant@vagrant:~$ sudo pecl install xhprof-beta
downloading xhprof-0.9.4.tgz ...
Starting to download xhprof-0.9.4.tgz (842,077 bytes)
..........done: 842,077 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version: 20151012
Zend Module Api No: 20151012
Zend Extension Api No: 320151012
building in /tmp/pear/temp/pear-build-root7BuNgN/xhprof-0.9.4
running: /tmp/pear/temp/xhprof/extension/configure --with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib
checking for PHP extension directory... /usr/lib/php/20151012
checking for PHP installed headers prefix... /usr/include/php/20151012
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... nawk
checking if nawk is broken... no
checking whether to enable xhprof support... yes, shared
checking how to print strings... printf
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking for gawk... (cached) nawk
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands
running: make
/bin/bash /tmp/pear/temp/pear-build-root7BuNgN/xhprof-0.9.4/libtool --mode=compile cc -I. -I/tmp/pear/temp/xhprof/extension -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root7BuNgN/xhprof-0.9.4/include -I/tmp/pear/temp/pear-build-root7BuNgN/xhprof-0.9.4/main -I/tmp/pear/temp/xhprof/extension -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/xhprof/extension/xhprof.c -o xhprof.lo
libtool: compile: cc -I. -I/tmp/pear/temp/xhprof/extension -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-root7BuNgN/xhprof-0.9.4/include -I/tmp/pear/temp/pear-build-root7BuNgN/xhprof-0.9.4/main -I/tmp/pear/temp/xhprof/extension -I/usr/include/php/20151012 -I/usr/include/php/20151012/main -I/usr/include/php/20151012/TSRM -I/usr/include/php/20151012/Zend -I/usr/include/php/20151012/ext -I/usr/include/php/20151012/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/xhprof/extension/xhprof.c -fPIC -DPIC -o .libs/xhprof.o
In file included from /usr/include/php/20151012/main/php.h:34:0,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/main/php_config.h:2447:0: warning: "_GNU_SOURCE" redefined [enabled by default]
#define _GNU_SOURCE 1
^
/tmp/pear/temp/xhprof/extension/xhprof.c:24:0: note: this is the location of the previous definition
# define _GNU_SOURCE
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_get_function_name':
/tmp/pear/temp/xhprof/extension/xhprof.c:931:21: error: 'zend_execute_data' has no member named 'function_state'
curr_func = data->function_state.function;
^
/tmp/pear/temp/xhprof/extension/xhprof.c:934:10: warning: assignment from incompatible pointer type [enabled by default]
func = curr_func->common.function_name;
^
/tmp/pear/temp/xhprof/extension/xhprof.c:945:13: warning: assignment from incompatible pointer type [enabled by default]
cls = curr_func->common.scope->name;
^
/tmp/pear/temp/xhprof/extension/xhprof.c:946:22: error: 'zend_execute_data' has no member named 'object'
} else if (data->object) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/tmp/pear/temp/xhprof/extension/xhprof.c:947:28: error: 'zend_execute_data' has no member named 'object'
cls = Z_OBJCE(*data->object)->name;
^
/usr/include/php/20151012/Zend/zend_types.h:530:26: note: in definition of macro 'Z_OBJ'
#define Z_OBJ(zval) (zval).value.obj
^
/tmp/pear/temp/xhprof/extension/xhprof.c:947:15: note: in expansion of macro 'Z_OBJCE'
cls = Z_OBJCE(*data->object)->name;
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1002:9: warning: passing argument 1 of 'hp_get_base_filename' from incompatible pointer type [enabled by default]
filename = hp_get_base_filename((curr_func->op_array).filename);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:892:20: note: expected 'const char *' but argument is of type 'struct zend_string *'
static const char *hp_get_base_filename(const char *filename) {
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_inc_count':
/tmp/pear/temp/xhprof/extension/xhprof.c:1082:3: warning: passing argument 2 of 'zend_hash_find' from incompatible pointer type [enabled by default]
if (zend_hash_find(ht, name, strlen(name) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: expected 'struct zend_string *' but argument is of type 'char *'
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1082:3: error: too many arguments to function 'zend_hash_find'
if (zend_hash_find(ht, name, strlen(name) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_hash_lookup':
/tmp/pear/temp/xhprof/extension/xhprof.c:1106:3: warning: passing argument 2 of 'zend_hash_find' from incompatible pointer type [enabled by default]
if (zend_hash_find(ht, symbol, strlen(symbol) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: expected 'struct zend_string *' but argument is of type 'char *'
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1106:3: error: too many arguments to function 'zend_hash_find'
if (zend_hash_find(ht, symbol, strlen(symbol) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_sample_stack':
/tmp/pear/temp/xhprof/extension/xhprof.c:1170:21: error: macro "add_assoc_string" passed 4 arguments, but takes just 3
1);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1167:3: error: 'add_assoc_string' undeclared (first use in this function)
add_assoc_string(hp_globals.stats_count,
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1167:3: note: each undeclared identifier is reported only once for each function it appears in
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_execute_ex':
/tmp/pear/temp/xhprof/extension/xhprof.c:1645:36: error: 'zend_execute_data' has no member named 'op_array'
zend_op_array *ops = execute_data->op_array;
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_execute_internal':
/tmp/pear/temp/xhprof/extension/xhprof.c:1698:43: error: 'zend_execute_data' has no member named 'op_array'
func = hp_get_function_name(current_data->op_array TSRMLS_CC);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1673:21: warning: initialization discards 'const' qualifier from pointer target type [enabled by default]
#define EX(element) ((execute_data)->element)
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1706:23: note: in expansion of macro 'EX'
zend_op *opline = EX(opline);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1708:5: error: unknown type name 'temp_variable'
temp_variable *retvar = &EX_T(opline->result.var);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1688:23: error: invalid type argument of unary '*' (have 'int')
#define EX_T(offset) (*EX_TMP_VAR(execute_data, offset))
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1708:30: note: in expansion of macro 'EX_T'
temp_variable *retvar = &EX_T(opline->result.var);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1673:36: error: 'zend_execute_data' has no member named 'function_state'
#define EX(element) ((execute_data)->element)
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1709:33: note: in expansion of macro 'EX'
((zend_internal_function *) EX(function_state).function)->handler(
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1711:30: error: request for member 'var' in something not a structure or union
retvar->var.ptr,
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1673:36: error: 'zend_execute_data' has no member named 'function_state'
#define EX(element) ((execute_data)->element)
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1712:25: note: in expansion of macro 'EX'
(EX(function_state).function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ?
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1713:31: error: request for member 'var' in something not a structure or union
&retvar->var.ptr:NULL,
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1673:36: error: 'zend_execute_data' has no member named 'object'
#define EX(element) ((execute_data)->element)
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1714:24: note: in expansion of macro 'EX'
EX(object), ret TSRMLS_CC);
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_begin':
/tmp/pear/temp/xhprof/extension/xhprof.c:1830:28: warning: assignment from incompatible pointer type [enabled by default]
_zend_execute_internal = zend_execute_internal;
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1835:29: warning: assignment from incompatible pointer type [enabled by default]
zend_execute_internal = hp_execute_internal;
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_stop':
/tmp/pear/temp/xhprof/extension/xhprof.c:1903:25: warning: assignment from incompatible pointer type [enabled by default]
zend_execute_internal = _zend_execute_internal;
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_zval_at_key':
/tmp/pear/temp/xhprof/extension/xhprof.c:1930:13: error: 'zval' has no member named 'type'
if (values->type == IS_ARRAY) {
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1936:5: warning: passing argument 2 of 'zend_hash_find' from incompatible pointer type [enabled by default]
if (zend_hash_find(ht, key, len, (void**)&value) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: expected 'struct zend_string *' but argument is of type 'char *'
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1936:5: error: too many arguments to function 'zend_hash_find'
if (zend_hash_find(ht, key, len, (void**)&value) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/tmp/pear/temp/xhprof/extension/xhprof.c: In function 'hp_strings_in_zval':
/tmp/pear/temp/xhprof/extension/xhprof.c:1960:13: error: 'zval' has no member named 'type'
if (values->type == IS_ARRAY) {
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1980:7: warning: passing argument 2 of 'zend_hash_get_current_key_ex' from incompatible pointer type [enabled by default]
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: expected 'struct zend_string **' but argument is of type 'char **'
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1980:7: warning: passing argument 3 of 'zend_hash_get_current_key_ex' from incompatible pointer type [enabled by default]
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: expected 'zend_ulong *' but argument is of type 'uint *'
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1980:7: warning: passing argument 4 of 'zend_hash_get_current_key_ex' from incompatible pointer type [enabled by default]
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: expected 'HashPosition *' but argument is of type 'ulong *'
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1980:7: error: too many arguments to function 'zend_hash_get_current_key_ex'
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: declared here
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1983:58: error: macro "zend_hash_get_current_data" passed 2 arguments, but takes just 1
if ((zend_hash_get_current_data(ht, (void**)&data) == SUCCESS) &&
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1983:14: error: 'zend_hash_get_current_data' undeclared (first use in this function)
if ((zend_hash_get_current_data(ht, (void**)&data) == SUCCESS) &&
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: warning: passing argument 1 of '__builtin_strlen' makes pointer from integer without a cast [enabled by default]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: warning: passing argument 1 of '__builtin_strcmp' makes pointer from integer without a cast [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: warning: passing argument 1 of '__builtin_strlen' makes pointer from integer without a cast [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: warning: passing argument 1 of '__builtin_strcmp' makes pointer from integer without a cast [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: warning: passing argument 1 of '__builtin_strcmp' makes pointer from integer without a cast [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: warning: passing argument 1 of '__builtin_strcmp' makes pointer from integer without a cast [enabled by default]
/tmp/pear/temp/xhprof/extension/xhprof.c:1985:13: note: expected 'const char *' but argument is of type 'int'
/tmp/pear/temp/xhprof/extension/xhprof.c:1986:11: warning: passing argument 1 of '_estrdup' makes pointer from integer without a cast [enabled by default]
result[ix] = estrdup(Z_STRVAL_PP(data));
^
In file included from /usr/include/php/20151012/Zend/zend.h:33:0,
from /usr/include/php/20151012/main/php.h:36,
from /tmp/pear/temp/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_alloc.h:84:31: note: expected 'const char *' but argument is of type 'int'
ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
^
/tmp/pear/temp/xhprof/extension/xhprof.c:1991:19: error: 'zval' has no member named 'type'
} else if(values->type == IS_STRING) {
^
make: *** [xhprof.lo] Error 1
ERROR: `make' failed
@RustJason it sounds like your fork has support, but there's no explanation on how to install xhprof from your git repo.
@jklein I did not provider pecl install, you need to compile from source. I will update readme later
Thanks @RustJason - using your README I was able to get XHProf compiled/installed. It looks like https://github.com/tideways/php-profiler-extension is a more up-to-date fork of XHProf, and they have an open PR that's looking to add PHP7 support. I might switch to that since it seems actively maintained.
Just remind that you should checkout the PHP7 branch.
Just tried building this on Ubuntu 16.04.2 LTS using: $ /usr/bin/phpize7.0 $ ./configure --with-php-config=/usr/bin/php-config7.0
Make failed with this message:
In file included from /usr/include/php/20151012/main/php.h:34:0,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/main/php_config.h:2461:0: warning: "_GNU_SOURCE" redefined
#define _GNU_SOURCE 1
^
/home/brian/xhprof/extension/xhprof.c:24:0: note: this is the location of the previous definition
# define _GNU_SOURCE
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_init_profiler_state’:
/home/brian/xhprof/extension/xhprof.c:667:5: warning: implicit declaration of function ‘FREE_ZVAL’ [-Wimplicit-function-declaration]
FREE_ZVAL(hp_globals.stats_count);
^
/home/brian/xhprof/extension/xhprof.c:669:3: warning: implicit declaration of function ‘MAKE_STD_ZVAL’ [-Wimplicit-function-declaration]
MAKE_STD_ZVAL(hp_globals.stats_count);
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_get_function_name’:
/home/brian/xhprof/extension/xhprof.c:936:21: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘function_state’
curr_func = data->function_state.function;
^
/home/brian/xhprof/extension/xhprof.c:939:10: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
func = curr_func->common.function_name;
^
/home/brian/xhprof/extension/xhprof.c:950:13: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
cls = curr_func->common.scope->name;
^
/home/brian/xhprof/extension/xhprof.c:951:22: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘object’
} else if (data->object) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/home/brian/xhprof/extension/xhprof.c:952:28: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘object’
cls = Z_OBJCE(*data->object)->name;
^
/usr/include/php/20151012/Zend/zend_types.h:530:26: note: in definition of macro ‘Z_OBJ’
#define Z_OBJ(zval) (zval).value.obj
^
/home/brian/xhprof/extension/xhprof.c:952:15: note: in expansion of macro ‘Z_OBJCE’
cls = Z_OBJCE(*data->object)->name;
^
/home/brian/xhprof/extension/xhprof.c:1013:41: warning: passing argument 1 of ‘hp_get_base_filename’ from incompatible pointer type [-Wincompatible-pointer-types]
filename = hp_get_base_filename((curr_func->op_array).filename);
^
/home/brian/xhprof/extension/xhprof.c:897:20: note: expected ‘const char *’ but argument is of type ‘zend_string * {aka struct _zend_string *}’
static const char *hp_get_base_filename(const char *filename) {
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_inc_count’:
/home/brian/xhprof/extension/xhprof.c:1093:26: warning: passing argument 2 of ‘zend_hash_find’ from incompatible pointer type [-Wincompatible-pointer-types]
if (zend_hash_find(ht, name, strlen(name) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: expected ‘zend_string * {aka struct _zend_string *}’ but argument is of type ‘char *’
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/home/brian/xhprof/extension/xhprof.c:1093:7: error: too many arguments to function ‘zend_hash_find’
if (zend_hash_find(ht, name, strlen(name) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
In file included from /usr/include/php/20151012/Zend/zend.h:31:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/home/brian/xhprof/extension/xhprof.c:1094:30: warning: implicit declaration of function ‘Z_LVAL_PP’ [-Wimplicit-function-declaration]
ZVAL_LONG(*(zval**)data, Z_LVAL_PP((zval**)data) + count);
^
/usr/include/php/20151012/Zend/zend_types.h:610:19: note: in definition of macro ‘ZVAL_LONG’
Z_LVAL_P(__z) = l; \
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_hash_lookup’:
/home/brian/xhprof/extension/xhprof.c:1117:26: warning: passing argument 2 of ‘zend_hash_find’ from incompatible pointer type [-Wincompatible-pointer-types]
if (zend_hash_find(ht, symbol, strlen(symbol) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: expected ‘zend_string * {aka struct _zend_string *}’ but argument is of type ‘char *’
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/home/brian/xhprof/extension/xhprof.c:1117:7: error: too many arguments to function ‘zend_hash_find’
if (zend_hash_find(ht, symbol, strlen(symbol) + 1, &data) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_sample_stack’:
/home/brian/xhprof/extension/xhprof.c:1181:21: error: macro "add_assoc_string" passed 4 arguments, but takes just 3
1);
^
/home/brian/xhprof/extension/xhprof.c:1178:3: error: ‘add_assoc_string’ undeclared (first use in this function)
add_assoc_string(hp_globals.stats_count,
^
/home/brian/xhprof/extension/xhprof.c:1178:3: note: each undeclared identifier is reported only once for each function it appears in
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_execute_ex’:
/home/brian/xhprof/extension/xhprof.c:1656:36: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘op_array’
zend_op_array *ops = execute_data->op_array;
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_execute_internal’:
/home/brian/xhprof/extension/xhprof.c:1709:43: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘op_array’
func = hp_get_function_name(current_data->op_array TSRMLS_CC);
^
/home/brian/xhprof/extension/xhprof.c:1722:47: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘function_state’
((zend_internal_function *) execute_data->function_state.function)->handler(
^
/home/brian/xhprof/extension/xhprof.c:1724:13: error: ‘struct _zend_fcall_info’ has no member named ‘retval_ptr_ptr’
*fci->retval_ptr_ptr,
^
/home/brian/xhprof/extension/xhprof.c:1725:12: error: ‘struct _zend_fcall_info’ has no member named ‘retval_ptr_ptr’
fci->retval_ptr_ptr,
^
/home/brian/xhprof/extension/xhprof.c:1726:12: error: ‘struct _zend_fcall_info’ has no member named ‘object_ptr’
fci->object_ptr,
^
/home/brian/xhprof/extension/xhprof.c:1729:34: warning: implicit declaration of function ‘EX_TMP_VAR’ [-Wimplicit-function-declaration]
zval **return_value_ptr = &EX_TMP_VAR(execute_data, execute_data->opline->result.var)->var.ptr;
^
/home/brian/xhprof/extension/xhprof.c:1729:92: error: invalid type argument of ‘->’ (have ‘int’)
zval **return_value_ptr = &EX_TMP_VAR(execute_data, execute_data->opline->result.var)->var.ptr;
^
/home/brian/xhprof/extension/xhprof.c:1730:47: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘function_state’
((zend_internal_function *) execute_data->function_state.function)->handler(
^
/home/brian/xhprof/extension/xhprof.c:1733:22: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘function_state’
(execute_data->function_state.function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
^
/home/brian/xhprof/extension/xhprof.c:1736:21: error: ‘zend_execute_data {aka struct _zend_execute_data}’ has no member named ‘object’
execute_data->object,
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_begin’:
/home/brian/xhprof/extension/xhprof.c:1864:28: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
_zend_execute_internal = zend_execute_internal;
^
/home/brian/xhprof/extension/xhprof.c:1869:29: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
zend_execute_internal = hp_execute_internal;
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_stop’:
/home/brian/xhprof/extension/xhprof.c:1937:25: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
zend_execute_internal = _zend_execute_internal;
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_zval_at_key’:
/home/brian/xhprof/extension/xhprof.c:1964:13: error: ‘zval {aka struct _zval_struct}’ has no member named ‘type’
if (values->type == IS_ARRAY) {
^
/home/brian/xhprof/extension/xhprof.c:1970:28: warning: passing argument 2 of ‘zend_hash_find’ from incompatible pointer type [-Wincompatible-pointer-types]
if (zend_hash_find(ht, key, len, (void**)&value) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: expected ‘zend_string * {aka struct _zend_string *}’ but argument is of type ‘char *’
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/home/brian/xhprof/extension/xhprof.c:1970:9: error: too many arguments to function ‘zend_hash_find’
if (zend_hash_find(ht, key, len, (void**)&value) == SUCCESS) {
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:154:30: note: declared here
ZEND_API zval* ZEND_FASTCALL zend_hash_find(const HashTable *ht, zend_string *key);
^
/home/brian/xhprof/extension/xhprof.c: In function ‘hp_strings_in_zval’:
/home/brian/xhprof/extension/xhprof.c:1994:13: error: ‘zval {aka struct _zval_struct}’ has no member named ‘type’
if (values->type == IS_ARRAY) {
^
/home/brian/xhprof/extension/xhprof.c:2014:47: warning: passing argument 2 of ‘zend_hash_get_current_key_ex’ from incompatible pointer type [-Wincompatible-pointer-types]
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: expected ‘zend_string ** {aka struct _zend_string **}’ but argument is of type ‘char **’
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/home/brian/xhprof/extension/xhprof.c:2014:53: warning: passing argument 3 of ‘zend_hash_get_current_key_ex’ from incompatible pointer type [-Wincompatible-pointer-types]
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: expected ‘zend_ulong * {aka long unsigned int *}’ but argument is of type ‘uint * {aka unsigned int *}’
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/home/brian/xhprof/extension/xhprof.c:2014:59: warning: passing argument 4 of ‘zend_hash_get_current_key_ex’ from incompatible pointer type [-Wincompatible-pointer-types]
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: expected ‘HashPosition * {aka unsigned int *}’ but argument is of type ‘ulong * {aka long unsigned int *}’
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/home/brian/xhprof/extension/xhprof.c:2014:14: error: too many arguments to function ‘zend_hash_get_current_key_ex’
type = zend_hash_get_current_key_ex(ht, &str, &len, &idx, 0, NULL);
^
In file included from /usr/include/php/20151012/Zend/zend.h:36:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_hash.h:168:30: note: declared here
ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_ex(const HashTable *ht, zend_string **str_index, zend_ulong *num_index, HashPosition *pos);
^
/home/brian/xhprof/extension/xhprof.c:2017:58: error: macro "zend_hash_get_current_data" passed 2 arguments, but takes just 1
if ((zend_hash_get_current_data(ht, (void**)&data) == SUCCESS) &&
^
/home/brian/xhprof/extension/xhprof.c:2017:14: error: ‘zend_hash_get_current_data’ undeclared (first use in this function)
if ((zend_hash_get_current_data(ht, (void**)&data) == SUCCESS) &&
^
/home/brian/xhprof/extension/xhprof.c:2018:13: warning: implicit declaration of function ‘Z_TYPE_PP’ [-Wimplicit-function-declaration]
Z_TYPE_PP(data) == IS_STRING &&
^
In file included from /usr/include/string.h:630:0,
from /usr/include/php/20151012/main/php_config.h:2520,
from /usr/include/php/20151012/main/php.h:34,
from /home/brian/xhprof/extension/xhprof.c:27:
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: implicit declaration of function ‘Z_STRVAL_PP’ [-Wimplicit-function-declaration]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: passing argument 1 of ‘__builtin_strlen’ makes pointer from integer without a cast [-Wint-conversion]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: note: expected ‘const char *’ but argument is of type ‘int’
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast [-Wint-conversion]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: note: expected ‘const char *’ but argument is of type ‘int’
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: passing argument 1 of ‘__builtin_strlen’ makes pointer from integer without a cast [-Wint-conversion]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: note: expected ‘const char *’ but argument is of type ‘int’
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast [-Wint-conversion]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: note: expected ‘const char *’ but argument is of type ‘int’
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast [-Wint-conversion]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: note: expected ‘const char *’ but argument is of type ‘int’
/home/brian/xhprof/extension/xhprof.c:2019:20: warning: passing argument 1 of ‘__builtin_strcmp’ makes pointer from integer without a cast [-Wint-conversion]
strcmp(Z_STRVAL_PP(data), ROOT_SYMBOL)) { /* do not ignore "main" */
^
/home/brian/xhprof/extension/xhprof.c:2019:20: note: expected ‘const char *’ but argument is of type ‘int’
In file included from /usr/include/php/20151012/Zend/zend.h:33:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_alloc.h:172:35: warning: passing argument 1 of ‘_estrdup’ makes pointer from integer without a cast [-Wint-conversion]
#define estrdup(s) _estrdup((s) ZEND_FILE_LINE_CC ZEND_FILE_LINE_EMPTY_CC)
^
/home/brian/xhprof/extension/xhprof.c:2020:24: note: in expansion of macro ‘estrdup’
result[ix] = estrdup(Z_STRVAL_PP(data));
^
In file included from /usr/include/php/20151012/Zend/zend.h:33:0,
from /usr/include/php/20151012/main/php.h:36,
from /home/brian/xhprof/extension/xhprof.c:27:
/usr/include/php/20151012/Zend/zend_alloc.h:84:31: note: expected ‘const char *’ but argument is of type ‘int’
ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_MALLOC;
^
/home/brian/xhprof/extension/xhprof.c:2025:19: error: ‘zval {aka struct _zval_struct}’ has no member named ‘type’
} else if(values->type == IS_STRING) {
^
make: *** [xhprof.lo] Error 1
@bhartvigsen I'm having the same issue at current. Did you ever find a solution to this?
@peterfox no I'm sorry I did not, and in fact don't even remember what I was trying to build this package for in the first place! Good luck :)
@bhartvigsen No problem, thanks for replying.
For anyone reading I found https://github.com/tideways/php-profiler-extension worked fine as an alternative.
Done.
https://github.com/Red-wolf-s-husband/xhprof/tree/php7