BitOne / php-meminfo

PHP extension to get insight about memory usage
MIT License
1.08k stars 78 forks source link

Extension does not compile on Mac #25

Closed kix closed 6 years ago

kix commented 8 years ago

Here's the output I get for make:

/bin/sh /Users/kix/Documents/Code/php/php-meminfo/extension/libtool --mode=compile cc  -I. -I/Users/kix/Documents/Code/php/php-meminfo/extension -DPHP_ATOM_INC -I/Users/kix/Documents/Code/php/php-meminfo/extension/include -I/Users/kix/Documents/Code/php/php-meminfo/extension/main -I/Users/kix/Documents/Code/php/php-meminfo/extension -I/usr/local/Cellar/php56/5.6.17/include/php -I/usr/local/Cellar/php56/5.6.17/include/php/main -I/usr/local/Cellar/php56/5.6.17/include/php/TSRM -I/usr/local/Cellar/php56/5.6.17/include/php/Zend -I/usr/local/Cellar/php56/5.6.17/include/php/ext -I/usr/local/Cellar/php56/5.6.17/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c -o meminfo.lo
 cc -I. -I/Users/kix/Documents/Code/php/php-meminfo/extension -DPHP_ATOM_INC -I/Users/kix/Documents/Code/php/php-meminfo/extension/include -I/Users/kix/Documents/Code/php/php-meminfo/extension/main -I/Users/kix/Documents/Code/php/php-meminfo/extension -I/usr/local/Cellar/php56/5.6.17/include/php -I/usr/local/Cellar/php56/5.6.17/include/php/main -I/usr/local/Cellar/php56/5.6.17/include/php/TSRM -I/usr/local/Cellar/php56/5.6.17/include/php/Zend -I/usr/local/Cellar/php56/5.6.17/include/php/ext -I/usr/local/Cellar/php56/5.6.17/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c  -fno-common -DPIC -o .libs/meminfo.o
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:241:41: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
    php_stream_printf(stream TSRMLS_CC, meminfo_info_dump_header(header, sizeof(header)));
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:261:35: error: too few arguments to function call, single argument 'tsrm_ls' was not specified
        zend_rebuild_symbol_table();
        ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php56/5.6.17/include/php/Zend/zend_API.h:525:1: note: 'zend_rebuild_symbol_table' declared here
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
^
/usr/local/Cellar/php56/5.6.17/include/php/main/php_config.h:6:19: note: expanded from macro 'ZEND_API'
# define ZEND_API __attribute__ ((visibility("default")))
                  ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:276:31: error: too few arguments to function call, single argument 'tsrm_ls' was not specified
    zend_rebuild_symbol_table();
    ~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/Cellar/php56/5.6.17/include/php/Zend/zend_API.h:525:1: note: 'zend_rebuild_symbol_table' declared here
ZEND_API void zend_rebuild_symbol_table(TSRMLS_D);
^
/usr/local/Cellar/php56/5.6.17/include/php/main/php_config.h:6:19: note: expanded from macro 'ZEND_API'
# define ZEND_API __attribute__ ((visibility("default")))
                  ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:327:36: error: use of undeclared identifier 'tsrm_ls'
    zend_objects_store *objects = &EG(objects_store);
                                   ^
/usr/local/Cellar/php56/5.6.17/include/php/Zend/zend_globals_macros.h:45:16: note: expanded from macro 'EG'
# define EG(v) TSRMG(executor_globals_id, zend_executor_globals *, v)
               ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:164:57: note: expanded from macro 'TSRMG'
#define TSRMG(id, type, element)        (((type) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
                                                               ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:392:30: error: use of undeclared identifier 'tsrm_ls'
    php_stream_printf(stream TSRMLS_CC, "        \"children\" : {\n");
                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:398:38: error: use of undeclared identifier 'tsrm_ls'
            php_stream_printf(stream TSRMLS_CC, ",\n");
                                     ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:410:46: error: use of undeclared identifier 'tsrm_ls'
                    php_stream_printf(stream TSRMLS_CC, "            \"%s\":\"%p\"", meminfo_escape_for_json(property_name), *zval );
                                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:412:46: error: use of undeclared identifier 'tsrm_ls'
                    php_stream_printf(stream TSRMLS_CC, "            \"%s\":\"%p\"", meminfo_escape_for_json(key), *zval );
                                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:417:42: error: use of undeclared identifier 'tsrm_ls'
                php_stream_printf(stream TSRMLS_CC, "            \"%ld\":\"%p\"", num_key, *zval );
                                         ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:423:30: error: use of undeclared identifier 'tsrm_ls'
    php_stream_printf(stream TSRMLS_CC, "\n        }\n");
                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:442:34: error: use of undeclared identifier 'tsrm_ls'
        php_stream_printf(stream TSRMLS_CC, "\n    },\n");
                                 ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:447:30: error: use of undeclared identifier 'tsrm_ls'
    php_stream_printf(stream TSRMLS_CC, "    \"%s\" : {\n", zval_id);
                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:448:30: error: use of undeclared identifier 'tsrm_ls'
    php_stream_printf(stream TSRMLS_CC, "        \"type\" : \"%s\",\n", zend_get_type_by_const(Z_TYPE_P(zv)));
                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:449:30: error: use of undeclared identifier 'tsrm_ls'
    php_stream_printf(stream TSRMLS_CC, "        \"size\" : \"%ld\",\n", meminfo_get_element_size(zv));
                             ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:453:38: error: use of undeclared identifier 'tsrm_ls'
            php_stream_printf(stream TSRMLS_CC, "        \"symbol_name\" : \"%s\",\n", meminfo_escape_for_json(symbol_name));
                                     ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:455:34: error: use of undeclared identifier 'tsrm_ls'
        php_stream_printf(stream TSRMLS_CC, "        \"is_root\" : true,\n");
                                 ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:456:34: error: use of undeclared identifier 'tsrm_ls'
        php_stream_printf(stream TSRMLS_CC, "        \"frame\" : \"%s\"\n", meminfo_escape_for_json(frame_label));
                                 ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:458:34: error: use of undeclared identifier 'tsrm_ls'
        php_stream_printf(stream TSRMLS_CC, "        \"is_root\" : false\n");
                                 ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:468:34: error: use of undeclared identifier 'tsrm_ls'
        php_stream_printf(stream TSRMLS_CC, ",\n");
                                 ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
/Users/kix/Documents/Code/php/php-meminfo/extension/meminfo.c:469:34: error: use of undeclared identifier 'tsrm_ls'
        php_stream_printf(stream TSRMLS_CC, "        \"class\" : \"%s\",\n", meminfo_escape_for_json(meminfo_get_classname(zv->value.obj.handle)));
                                 ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:168:21: note: expanded from macro 'TSRMLS_CC'
#define TSRMLS_CC       , TSRMLS_C
                          ^
/usr/local/Cellar/php56/5.6.17/include/php/TSRM/TSRM.h:167:18: note: expanded from macro 'TSRMLS_C'
#define TSRMLS_C        tsrm_ls
                        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [meminfo.lo] Error 1
BitOne commented 8 years ago

Hello @kix !

Thanks a lot for reporting this issue.

I have some coworkers using the PHP Meminfo extension on a Mac, so I'm not sure it's linked to the Mac environment. I tried with a PHP 5.6.19 locally and compiling works well.

Can you give me the output of phpize -v, please ?

kix commented 8 years ago

@BitOne, here it is, PHP 5.6.20:

$ phpize -v
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
armel commented 8 years ago

It compiles and works like a charm for me with PHP 5.5.34 (OS X El Capitan / PHP built-in version).

$ phpize -v
Configuring for:
PHP Api Version:         20121113
Zend Module Api No:      20121212
Zend Extension Api No:   220121212
BitOne commented 6 years ago

@kix : I stumbled upon the same problem on another environment (on a Ubuntu), and it was linked to use of ZTS version of PHP. This problem doesn't exist anymore for PHP 7, and I fixed it for PHP 5. Tell me if it is fixed too for you. Thanks !

kix commented 6 years ago

Yeah, I've tried rebuilding this and everything worked nicely, thanks!