mreiferson / php-wkhtmltox

PHP bindings for libwkhtmltox
MIT License
309 stars 60 forks source link

compiling for PHP 7 #42

Open olablt opened 6 years ago

olablt commented 6 years ago

can not get it to compile with php 7

wget https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0-alpha-7b36694_linux-centos7-amd64.rpm
yum install -y wkhtmltox-0.12.2.1_linux-centos7-amd64.rpm
yum install -y wkhtmltox-0.13.0-alpha-7b36694_linux-centos7-amd64.rpm
git clone https://github.com/mreiferson/php-wkhtmltox.git
cd php-wkhtmltox/ && phpize && ./configure && make install
<...>
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
/bin/sh /tmp/php-wkhtmltox/libtool --mode=compile cc  -I. -I/tmp/php-wkhtmltox -DPHP_ATOM_INC -I/tmp/php-wkhtmltox/include -I/tmp/php-wkhtmltox/main -I/tmp/php-wkhtmltox -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /tmp/php-wkhtmltox/phpwkhtmltox.c -o phpwkhtmltox.lo 
libtool: compile:  cc -I. -I/tmp/php-wkhtmltox -DPHP_ATOM_INC -I/tmp/php-wkhtmltox/include -I/tmp/php-wkhtmltox/main -I/tmp/php-wkhtmltox -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /tmp/php-wkhtmltox/phpwkhtmltox.c  -fPIC -DPIC -o .libs/phpwkhtmltox.o
/tmp/php-wkhtmltox/phpwkhtmltox.c: In function 'zif_wkhtmltox_convert':
/tmp/php-wkhtmltox/phpwkhtmltox.c:137:17: warning: passing argument 2 of 'zend_hash_get_current_data_ex' from incompatible pointer type [enabled by default]                                       
                 zend_hash_get_current_data_ex(params_hash, (void **)&data, &pointer) == SUCCESS;                                                                                                  
                 ^                                                                                                                                                                                 
In file included from /usr/include/php/Zend/zend.h:36:0,                                                                                                                                           
                 from /usr/include/php/main/php.h:35,                                                                                                                                              
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:                                                                                                                                         
/usr/include/php/Zend/zend_hash.h:171:30: note: expected 'HashPosition *' but argument is of type 'void **'                                                                                        
 ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);                                                                                                     
                              ^                                                                                                                                                                    
/tmp/php-wkhtmltox/phpwkhtmltox.c:137:17: error: too many arguments to function 'zend_hash_get_current_data_ex'                                                                                    
                 zend_hash_get_current_data_ex(params_hash, (void **)&data, &pointer) == SUCCESS;                                                                                                  
                 ^                                                                                                                                                                                 
In file included from /usr/include/php/Zend/zend.h:36:0,                                                                                                                                           
                 from /usr/include/php/main/php.h:35,                                                                                                                                              
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:                                                                                                                                         
/usr/include/php/Zend/zend_hash.h:171:30: note: declared here                                                                                                                                      
 ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);                                                                                                     
                              ^                                                                                                                                                                    
/tmp/php-wkhtmltox/phpwkhtmltox.c: In function 'wkhtmltox_set_params':                                                                                                                             
/tmp/php-wkhtmltox/phpwkhtmltox.c:172:13: warning: passing argument 2 of 'zend_hash_get_current_data_ex' from incompatible pointer type [enabled by default]                                       
             zend_hash_get_current_data_ex(params_hash, (void **)&data, &pointer) == SUCCESS;                                                                                                      
             ^                                                                                                                                                                                     
In file included from /usr/include/php/Zend/zend.h:36:0,                                                                                                                                           
                 from /usr/include/php/main/php.h:35,                                                                                                                                              
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:                                                                                                                                         
/usr/include/php/Zend/zend_hash.h:171:30: note: expected 'HashPosition *' but argument is of type 'void **'                                                                                        
 ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);                                                                                                     
                              ^                                                                                                                                                                    
/tmp/php-wkhtmltox/phpwkhtmltox.c:172:13: error: too many arguments to function 'zend_hash_get_current_data_ex'
             zend_hash_get_current_data_ex(params_hash, (void **)&data, &pointer) == SUCCESS; 
             ^
In file included from /usr/include/php/Zend/zend.h:36:0,
                 from /usr/include/php/main/php.h:35,
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:
/usr/include/php/Zend/zend_hash.h:171:30: note: declared here
 ZEND_API zval* ZEND_FASTCALL zend_hash_get_current_data_ex(HashTable *ht, HashPosition *pos);
                              ^
/tmp/php-wkhtmltox/phpwkhtmltox.c:177:9: warning: passing argument 2 of 'zend_hash_get_current_key_ex' from incompatible pointer type [enabled by default]
         if (zend_hash_get_current_key_ex(params_hash, &key, &key_len, &index, 0, &pointer) == HASH_KEY_IS_STRING) {
         ^
In file included from /usr/include/php/Zend/zend.h:36:0,
                 from /usr/include/php/main/php.h:35,
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:
/usr/include/php/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/php-wkhtmltox/phpwkhtmltox.c:177:9: warning: passing argument 3 of 'zend_hash_get_current_key_ex' from incompatible pointer type [enabled by default]
         if (zend_hash_get_current_key_ex(params_hash, &key, &key_len, &index, 0, &pointer) == HASH_KEY_IS_STRING) {
         ^
In file included from /usr/include/php/Zend/zend.h:36:0,
                 from /usr/include/php/main/php.h:35,
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:
/usr/include/php/Zend/zend_hash.h:168:30: note: expected 'zend_ulong *' but argument is of type '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);
                              ^
/tmp/php-wkhtmltox/phpwkhtmltox.c:177:9: warning: passing argument 4 of 'zend_hash_get_current_key_ex' from incompatible pointer type [enabled by default]
         if (zend_hash_get_current_key_ex(params_hash, &key, &key_len, &index, 0, &pointer) == HASH_KEY_IS_STRING) {
         ^
In file included from /usr/include/php/Zend/zend.h:36:0,
                 from /usr/include/php/main/php.h:35,
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:
/usr/include/php/Zend/zend_hash.h:168:30: note: expected 'HashPosition *' but argument is of type 'long 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);
                              ^
/tmp/php-wkhtmltox/phpwkhtmltox.c:177:9: error: too many arguments to function 'zend_hash_get_current_key_ex'
         if (zend_hash_get_current_key_ex(params_hash, &key, &key_len, &index, 0, &pointer) == HASH_KEY_IS_STRING) {
         ^
In file included from /usr/include/php/Zend/zend.h:36:0,
                 from /usr/include/php/main/php.h:35,
                 from /tmp/php-wkhtmltox/phpwkhtmltox.c:7:
/usr/include/php/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/php-wkhtmltox/phpwkhtmltox.c:179:22: error: 'IS_BOOL' undeclared (first use in this function)
                 case IS_BOOL:
                      ^
/tmp/php-wkhtmltox/phpwkhtmltox.c:179:22: note: each undeclared identifier is reported only once for each function it appears in
make: *** [phpwkhtmltox.lo] Error 1

any hints?

julego commented 6 years ago

Hi, I patched the extension a few months ago to make it compatible with PHP 7, you should check my fork there : https://github.com/julego/php-wkhtmltox/tree/julego-php7

Tested on Debian Stretch / PHP 7.0.19 and Wkhtmltopdf 0.12.4 only but it should work with other versions (please let me know).