longxinH / xhprof

PHP7/PHP8 support
http://pecl.php.net/package/xhprof
Apache License 2.0
1.09k stars 167 forks source link

macOS Catalina 10.15.1 and php 7.4 compile error #32

Closed nohnaimer closed 4 years ago

nohnaimer commented 5 years ago

Hello, After update on php 7.4 extension compile error:

and1@and1pc:~/Desktop/xhprof/extension$ make
/bin/sh /Users/and1/Desktop/xhprof/extension/libtool --mode=compile cc  -I. -I/Users/and1/Desktop/xhprof/extension -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/and1/Desktop/xhprof/extension/xhprof.c -o xhprof.lo 
 cc -I. -I/Users/and1/Desktop/xhprof/extension -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/and1/Desktop/xhprof/extension/xhprof.c  -fno-common -DPIC -o .libs/xhprof.o
/Users/and1/Desktop/xhprof/extension/xhprof.c:361:10: error: expected ';' after expression
    ulong h = 5381;
         ^
         ;
/Users/and1/Desktop/xhprof/extension/xhprof.c:361:5: error: use of undeclared identifier 'ulong'
    ulong h = 5381;
    ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:361:11: error: use of undeclared identifier 'h'
    ulong h = 5381;
          ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:366:9: error: use of undeclared identifier 'h'
        h += (h << 5);
        ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:366:15: error: use of undeclared identifier 'h'
        h += (h << 5);
              ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:367:9: error: use of undeclared identifier 'h'
        h ^= (ulong) *str++;
        ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:367:15: error: use of undeclared identifier 'ulong'; did you
      mean 'long'?
        h ^= (ulong) *str++;
              ^~~~~
              long
/Users/and1/Desktop/xhprof/extension/xhprof.c:367:14: error: reference to overloaded function could not be
      resolved; did you mean to call it?
        h ^= (ulong) *str++;
             ^~~~~~~
/Users/and1/Desktop/xhprof/extension/xhprof.c:370:28: error: use of undeclared identifier 'ulong'; did you
      mean 'long'?
    for (i = 0; i < sizeof(ulong); i++) {
                           ^~~~~
                           long
/Users/and1/Desktop/xhprof/extension/xhprof.c:370:27: error: reference to overloaded function could not be
      resolved; did you mean to call it?
    for (i = 0; i < sizeof(ulong); i++) {
                          ^~~~~~~
/Users/and1/Desktop/xhprof/extension/xhprof.c:371:27: error: use of undeclared identifier 'h'
        res += ((uint8 *)&h)[i];
                          ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:806:43: warning: format specifies type 'int' but the argument
      has type '__darwin_time_t' (aka 'long') [-Wformat]
    snprintf(key, sizeof(key), "%d.%06d", XHPROF_G(last_sample_time).tv_sec, XHPROF_G(last_sample_time...
                                ~~        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                %ld
./php_xhprof.h:309:21: note: expanded from macro 'XHPROF_G'
#define XHPROF_G(v) (xhprof_globals.v)
                    ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:1443:101: error: too many arguments to function call, expected
      8, have 9
  ...0/* global */, 0/* ZEND_NUM_ARGS() >= 4 */, 0/*flags PREG_OFFSET_CAPTURE*/, 0/* start_offset */);
                                                                                 ^
/usr/local/Cellar/php/7.4.0/include/php/ext/pcre/php_pcre.h:45:1: note: 'php_pcre_match_impl' declared here
PHPAPI void  php_pcre_match_impl(pcre_cache_entry *pce, zend_string *subject_str, zval *return_value,
^
/usr/local/Cellar/php/7.4.0/include/php/main/php.h:71:18: note: expanded from macro 'PHPAPI'
#               define PHPAPI __attribute__ ((visibility("default")))
                              ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:1600:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            size: sizeof(zend_fcall_info),
            ^~~~~
            .size = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1604:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            function_name: func,
            ^~~~~~~~~~~~~~
            .function_name = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1608:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            retval: &retval,
            ^~~~~~~
            .retval = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1609:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            params: &params,
            ^~~~~~~
            .params = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1610:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            object: NULL,
            ^~~~~~~
            .object = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1611:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            no_separation: 1,
            ^~~~~~~~~~~~~~
            .no_separation = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1612:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            param_count: 1
            ^~~~~~~~~~~~
            .param_count = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1609:21: warning: incompatible pointer types initializing
      'zval *' (aka 'struct _zval_struct *') with an expression of type 'zval (*)[1]'
      [-Wincompatible-pointer-types]
            params: &params,
                    ^~~~~~~
9 warnings and 12 errors generated.
make: *** [xhprof.lo] Error 1

Any ideas how to fix? Thank you!

longxinH commented 5 years ago

php7.4 modified a zend api, this problem will be fixed in the near future, but I have not upgraded macOS Catalina 10.15.1, only can be verified under linux

nohnaimer commented 5 years ago

I can test on macOS Catalina 10.15.1

longxinH commented 5 years ago

Please verify if macOS Catalina 10.15.1 works

nohnaimer commented 5 years ago

Same or different error:

and1@and1pc:~/Desktop/xhprof/extension$ make
/bin/sh /Users/and1/Desktop/xhprof/extension/libtool --mode=compile cc  -I. -I/Users/and1/Desktop/xhprof/extension -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/and1/Desktop/xhprof/extension/xhprof.c -o xhprof.lo 
mkdir .libs
 cc -I. -I/Users/and1/Desktop/xhprof/extension -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/and1/Desktop/xhprof/extension/xhprof.c  -fno-common -DPIC -o .libs/xhprof.o
/Users/and1/Desktop/xhprof/extension/xhprof.c:361:10: error: expected ';' after expression
    ulong h = 5381;
         ^
         ;
/Users/and1/Desktop/xhprof/extension/xhprof.c:361:5: error: use of undeclared identifier 'ulong'
    ulong h = 5381;
    ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:361:11: error: use of undeclared identifier 'h'
    ulong h = 5381;
          ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:366:9: error: use of undeclared identifier 'h'
        h += (h << 5);
        ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:366:15: error: use of undeclared identifier 'h'
        h += (h << 5);
              ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:367:9: error: use of undeclared identifier 'h'
        h ^= (ulong) *str++;
        ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:367:15: error: use of undeclared identifier 'ulong'; did you
      mean 'long'?
        h ^= (ulong) *str++;
              ^~~~~
              long
/Users/and1/Desktop/xhprof/extension/xhprof.c:367:14: error: reference to overloaded function could not be
      resolved; did you mean to call it?
        h ^= (ulong) *str++;
             ^~~~~~~
/Users/and1/Desktop/xhprof/extension/xhprof.c:370:28: error: use of undeclared identifier 'ulong'; did you
      mean 'long'?
    for (i = 0; i < sizeof(ulong); i++) {
                           ^~~~~
                           long
/Users/and1/Desktop/xhprof/extension/xhprof.c:370:27: error: reference to overloaded function could not be
      resolved; did you mean to call it?
    for (i = 0; i < sizeof(ulong); i++) {
                          ^~~~~~~
/Users/and1/Desktop/xhprof/extension/xhprof.c:371:27: error: use of undeclared identifier 'h'
        res += ((uint8 *)&h)[i];
                          ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:806:43: warning: format specifies type 'int' but the argument
      has type '__darwin_time_t' (aka 'long') [-Wformat]
    snprintf(key, sizeof(key), "%d.%06d", XHPROF_G(last_sample_time).tv_sec, XHPROF_G(last_sample_time...
                                ~~        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                %ld
./php_xhprof.h:309:21: note: expanded from macro 'XHPROF_G'
#define XHPROF_G(v) (xhprof_globals.v)
                    ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:1605:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            size: sizeof(zend_fcall_info),
            ^~~~~
            .size = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1609:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            function_name: func,
            ^~~~~~~~~~~~~~
            .function_name = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1613:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            retval: &retval,
            ^~~~~~~
            .retval = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1614:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            params: &params,
            ^~~~~~~
            .params = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1615:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            object: NULL,
            ^~~~~~~
            .object = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1616:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            no_separation: 1,
            ^~~~~~~~~~~~~~
            .no_separation = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1617:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            param_count: 1
            ^~~~~~~~~~~~
            .param_count = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1614:21: warning: incompatible pointer types initializing
      'zval *' (aka 'struct _zval_struct *') with an expression of type 'zval (*)[1]'
      [-Wincompatible-pointer-types]
            params: &params,
                    ^~~~~~~
9 warnings and 11 errors generated.
make: *** [xhprof.lo] Error 1

and1@and1pc:~/Desktop/xhprof$ git log
commit 6bfef691a046679ac69f2a8d9f4b9fdec61c9c5e (HEAD -> master, origin/master, origin/HEAD)
Author: longxinhui <longxinhui.e@gmail.com>
Date:   Thu Dec 5 10:29:15 2019 +0800

    back to dev

    #32 fix for PHP 7.4

commit 613a88e9178c4555ea7958ea047d17923ee0027c
Author: longxinhui <longxinhui.e@gmail.com>
Date:   Wed Dec 4 09:47:04 2019 +0800

    Update version number 2.1.1

    Update version number 2.1.1

commit da6dcb1b549f7c47ffb14a7e0cf920f801d9db6b (tag: v2.1.1)
Author: longxinhui <longxinhui.e@gmail.com>
Date:   Tue Dec 3 17:07:14 2019 +0800

    Fix macOS time benchmark

    #31 Fix macOS time benchmark
longxinH commented 5 years ago

fixed

nohnaimer commented 5 years ago

Compile, install, works!

Снимок экрана 2019-12-05 в 10 16 28
and1@and1pc:~/Desktop/xhprof/extension$ php -v
PHP 7.4.0 (cli) (built: Nov 29 2019 16:18:44) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Xdebug v2.8.0, Copyright (c) 2002-2019, by Derick Rethans
    with Zend OPcache v7.4.0, Copyright (c), by Zend Technologies
and1@and1pc:~/Desktop/xhprof/extension$ php -m | grep xhprof
xhprof

Thank you!

nohnaimer commented 5 years ago

Compile with 9 warnings:

and1@and1pc:~/Desktop/xhprof/extension$ make
/bin/sh /Users/and1/Desktop/xhprof/extension/libtool --mode=compile cc  -I. -I/Users/and1/Desktop/xhprof/extension -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/and1/Desktop/xhprof/extension/xhprof.c -o xhprof.lo 
mkdir .libs
 cc -I. -I/Users/and1/Desktop/xhprof/extension -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/and1/Desktop/xhprof/extension/xhprof.c  -fno-common -DPIC -o .libs/xhprof.o
/Users/and1/Desktop/xhprof/extension/xhprof.c:806:43: warning: format specifies type 'int' but the argument
      has type '__darwin_time_t' (aka 'long') [-Wformat]
    snprintf(key, sizeof(key), "%d.%06d", XHPROF_G(last_sample_time).tv_sec, XHPROF_G(last_sample_time...
                                ~~        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                %ld
./php_xhprof.h:309:21: note: expanded from macro 'XHPROF_G'
#define XHPROF_G(v) (xhprof_globals.v)
                    ^
/Users/and1/Desktop/xhprof/extension/xhprof.c:1605:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            size: sizeof(zend_fcall_info),
            ^~~~~
            .size = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1609:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            function_name: func,
            ^~~~~~~~~~~~~~
            .function_name = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1613:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            retval: &retval,
            ^~~~~~~
            .retval = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1614:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            params: &params,
            ^~~~~~~
            .params = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1615:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            object: NULL,
            ^~~~~~~
            .object = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1616:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            no_separation: 1,
            ^~~~~~~~~~~~~~
            .no_separation = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1617:13: warning: use of GNU old-style field designator
      extension [-Wgnu-designator]
            param_count: 1
            ^~~~~~~~~~~~
            .param_count = 
/Users/and1/Desktop/xhprof/extension/xhprof.c:1614:21: warning: incompatible pointer types initializing
      'zval *' (aka 'struct _zval_struct *') with an expression of type 'zval (*)[1]'
      [-Wincompatible-pointer-types]
            params: &params,
                    ^~~~~~~
9 warnings generated.
/bin/sh /Users/and1/Desktop/xhprof/extension/libtool --mode=link cc -DPHP_ATOM_INC -I/Users/and1/Desktop/xhprof/extension/include -I/Users/and1/Desktop/xhprof/extension/main -I/Users/and1/Desktop/xhprof/extension -I/usr/local/Cellar/php/7.4.0/include/php -I/usr/local/Cellar/php/7.4.0/include/php/main -I/usr/local/Cellar/php/7.4.0/include/php/TSRM -I/usr/local/Cellar/php/7.4.0/include/php/Zend -I/usr/local/Cellar/php/7.4.0/include/php/ext -I/usr/local/Cellar/php/7.4.0/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2    -o xhprof.la -export-dynamic -avoid-version -prefer-pic -module -rpath /Users/and1/Desktop/xhprof/extension/modules  xhprof.lo 
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/xhprof.so -bundle  .libs/xhprof.o  
dsymutil .libs/xhprof.so || :
creating xhprof.la
(cd .libs && rm -f xhprof.la && ln -s ../xhprof.la xhprof.la)
/bin/sh /Users/and1/Desktop/xhprof/extension/libtool --mode=install cp ./xhprof.la /Users/and1/Desktop/xhprof/extension/modules
cp ./.libs/xhprof.so /Users/and1/Desktop/xhprof/extension/modules/xhprof.so
cp ./.libs/xhprof.lai /Users/and1/Desktop/xhprof/extension/modules/xhprof.la
----------------------------------------------------------------------
Libraries have been installed in:
   /Users/and1/Desktop/xhprof/extension/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.