php-opencv / php-opencv

opencv 4.5+ with dnn module for php 7/8

Home Page:https://github.com/php-opencv/php-opencv-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error with php7.4

benjy8001 opened this issue · comments

Hi !

i have a compilation error with php-fpm 7.4 (see Dockerfile here => https://github.com/benjy8001/php-fpm-opencv/blob/master/7.4/Dockerfile)

Cloning into 'php-opencv'...
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
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 pkg-config is at least version 0.9.0... yes
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 for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib
checking for PHP extension directory... /usr/lib/php7/modules
checking for PHP installed headers prefix... /usr/include/php7
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for opencv support... yes, shared
checking for php debug... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for pkg-config... found
checking for opencv... found 4.5.0
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/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

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/sh /opt/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /opt/php-opencv/opencv.cc -o opencv.lo 
mkdir .libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /opt/php-opencv/opencv.cc  -fPIC -DPIC -o .libs/opencv.o
/bin/sh /opt/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /opt/php-opencv/source/opencv2/core/opencv_mat.cc -o source/opencv2/core/opencv_mat.lo 
mkdir source/opencv2/core/.libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /opt/php-opencv/source/opencv2/core/opencv_mat.cc  -fPIC -DPIC -o source/opencv2/core/.libs/opencv_mat.o
In file included from /usr/include/php7/Zend/zend.h:27,
                 from /usr/include/php7/main/php.h:33,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/opt/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'void opencv_mat_update_property_by_c_mat(zval*, cv::Mat*)':
/usr/include/php7/Zend/zend_types.h:663:38: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'}
  663 | #define Z_OBJ(zval)     (zval).value.obj
      |                         ~~~~~~~~~~~~~^~~
      |                                      |
      |                                      zend_object* {aka _zend_object*}
/usr/include/php7/Zend/zend_types.h:664:28: note: in expansion of macro 'Z_OBJ'
  664 | #define Z_OBJ_P(zval_p)    Z_OBJ(*(zval_p))
      |                            ^~~~~
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:53:46: note: in expansion of macro 'Z_OBJ_P'
   53 |     zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "rows", sizeof("rows")-1, mat->rows);
      |                                              ^~~~~~~
In file included from /usr/include/php7/main/php.h:37,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_API.h:339:72: note:   initializing argument 2 of 'void zend_update_property_long(zend_class_entry*, zval*, const char*, size_t, zend_long)'
  339 | ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value);
      |                                                                  ~~~~~~^~~~~~
In file included from /usr/include/php7/Zend/zend.h:27,
                 from /usr/include/php7/main/php.h:33,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_types.h:663:38: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'}
  663 | #define Z_OBJ(zval)     (zval).value.obj
      |                         ~~~~~~~~~~~~~^~~
      |                                      |
      |                                      zend_object* {aka _zend_object*}
/usr/include/php7/Zend/zend_types.h:664:28: note: in expansion of macro 'Z_OBJ'
  664 | #define Z_OBJ_P(zval_p)    Z_OBJ(*(zval_p))
      |                            ^~~~~
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:54:46: note: in expansion of macro 'Z_OBJ_P'
   54 |     zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "cols", sizeof("cols")-1, mat->cols);
      |                                              ^~~~~~~
In file included from /usr/include/php7/main/php.h:37,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_API.h:339:72: note:   initializing argument 2 of 'void zend_update_property_long(zend_class_entry*, zval*, const char*, size_t, zend_long)'
  339 | ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value);
      |                                                                  ~~~~~~^~~~~~
In file included from /usr/include/php7/Zend/zend.h:27,
                 from /usr/include/php7/main/php.h:33,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_types.h:663:38: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'}
  663 | #define Z_OBJ(zval)     (zval).value.obj
      |                         ~~~~~~~~~~~~~^~~
      |                                      |
      |                                      zend_object* {aka _zend_object*}
/usr/include/php7/Zend/zend_types.h:664:28: note: in expansion of macro 'Z_OBJ'
  664 | #define Z_OBJ_P(zval_p)    Z_OBJ(*(zval_p))
      |                            ^~~~~
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:55:46: note: in expansion of macro 'Z_OBJ_P'
   55 |     zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "dims", sizeof("dims")-1, mat->dims);
      |                                              ^~~~~~~
In file included from /usr/include/php7/main/php.h:37,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_API.h:339:72: note:   initializing argument 2 of 'void zend_update_property_long(zend_class_entry*, zval*, const char*, size_t, zend_long)'
  339 | ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value);
      |                                                                  ~~~~~~^~~~~~
In file included from /usr/include/php7/Zend/zend.h:27,
                 from /usr/include/php7/main/php.h:33,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_types.h:663:38: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'}
  663 | #define Z_OBJ(zval)     (zval).value.obj
      |                         ~~~~~~~~~~~~~^~~
      |                                      |
      |                                      zend_object* {aka _zend_object*}
/usr/include/php7/Zend/zend_types.h:664:28: note: in expansion of macro 'Z_OBJ'
  664 | #define Z_OBJ_P(zval_p)    Z_OBJ(*(zval_p))
      |                            ^~~~~
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:56:46: note: in expansion of macro 'Z_OBJ_P'
   56 |     zend_update_property_long(opencv_mat_ce, Z_OBJ_P(z), "type", sizeof("type")-1, mat->type());
      |                                              ^~~~~~~
In file included from /usr/include/php7/main/php.h:37,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_API.h:339:72: note:   initializing argument 2 of 'void zend_update_property_long(zend_class_entry*, zval*, const char*, size_t, zend_long)'
  339 | ZEND_API void zend_update_property_long(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_long value);
      |                                                                  ~~~~~~^~~~~~
In file included from /usr/include/php7/Zend/zend.h:27,
                 from /usr/include/php7/main/php.h:33,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_types.h:663:38: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'}
  663 | #define Z_OBJ(zval)     (zval).value.obj
      |                         ~~~~~~~~~~~~~^~~
      |                                      |
      |                                      zend_object* {aka _zend_object*}
/usr/include/php7/Zend/zend_types.h:664:28: note: in expansion of macro 'Z_OBJ'
  664 | #define Z_OBJ_P(zval_p)    Z_OBJ(*(zval_p))
      |                            ^~~~~
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:66:45: note: in expansion of macro 'Z_OBJ_P'
   66 |         zend_update_property(opencv_mat_ce, Z_OBJ_P(z), "shape", sizeof("shape")-1, &shape_zval);
      |                                             ^~~~~~~
In file included from /usr/include/php7/main/php.h:37,
                 from /opt/php-opencv/source/opencv2/core/../../../php_opencv.h:23,
                 from /opt/php-opencv/source/opencv2/core/opencv_mat.cc:18:
/usr/include/php7/Zend/zend_API.h:336:67: note:   initializing argument 2 of 'void zend_update_property(zend_class_entry*, zval*, const char*, size_t, zval*)'
  336 | ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zval *value);
      |                                                             ~~~~~~^~~~~~
/opt/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'zval* opencv_mat_write_property(zend_object*, zend_string*, zval*, void**)':
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:841:40: error: cannot convert 'zend_object*' {aka '_zend_object*'} to 'zval*' {aka '_zval_struct*'} in argument passing
  841 |     std_object_handlers.write_property(object,member,value,cache_slot);
      |                                        ^~~~~~
      |                                        |
      |                                        zend_object* {aka _zend_object*}
/opt/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'void opencv_mat_init()':
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:857:49: error: invalid conversion from 'zval* (*)(zend_object*, zend_string*, zval*, void**)' {aka '_zval_struct* (*)(_zend_object*, _zend_string*, _zval_struct*, void**)'} to 'zend_object_write_property_t' {aka 'void (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'} [-fpermissive]
  857 |     opencv_mat_object_handlers.write_property = opencv_mat_write_property;
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 zval* (*)(zend_object*, zend_string*, zval*, void**) {aka _zval_struct* (*)(_zend_object*, _zend_string*, _zval_struct*, void**)}
make: *** [Makefile:194: source/opencv2/core/opencv_mat.lo] Error 1

@morozovsk , thanks, i just try, and i have an another error :

Cloning into 'php-opencv'...
Branch 'php7.4' set up to track remote branch 'php7.4' from 'origin'.
Switched to a new branch 'php7.4'
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
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 pkg-config is at least version 0.9.0... yes
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 for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib
checking for PHP extension directory... /usr/lib/php7/modules
checking for PHP installed headers prefix... /usr/include/php7
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for opencv support... yes, shared
checking for php debug... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for pkg-config... found
checking for opencv... found 4.5.0
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/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

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/sh /opt/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /opt/php-opencv/opencv.cc -o opencv.lo 
mkdir .libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /opt/php-opencv/opencv.cc  -fPIC -DPIC -o .libs/opencv.o
/bin/sh /opt/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /opt/php-opencv/source/opencv2/core/opencv_mat.cc -o source/opencv2/core/opencv_mat.lo 
mkdir source/opencv2/core/.libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /opt/php-opencv/source/opencv2/core/opencv_mat.cc  -fPIC -DPIC -o source/opencv2/core/.libs/opencv_mat.o
/opt/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'void opencv_mat_init()':
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:858:49: error: invalid conversion from 'zval* (*)(zval*, zval*, zval*, void**)' {aka '_zval_struct* (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'} to 'zend_object_write_property_t' {aka 'void (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'} [-fpermissive]
  858 |     opencv_mat_object_handlers.write_property = opencv_mat_write_property;
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 zval* (*)(zval*, zval*, zval*, void**) {aka _zval_struct* (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)}
make: *** [Makefile:194: source/opencv2/core/opencv_mat.lo] Error 1

error: invalid conversion from 'zval* ()(zval, zval*, zval*, void**)' {aka '_zval_struct* ()(_zval_struct, _zval_struct*, _zval_struct*, void**)'} to 'zend_object_write_property_t' {aka 'void ()(_zval_struct, _zval_struct*, _zval_struct*, void**)'}

looks like you have php7.2 because write_property in php 7.4 returns zval instead void in 7.2.
maybe you have problem because your base or opencv image was cached with php 7.2.

try to add php -v in this line https://github.com/benjy8001/php-fpm-opencv/blob/master/7.4/Dockerfile#L110 after apk add --no-cache php7-dev.

Thanks for the tips.

I see this => (9/9) Installing php7-dev (7.3.26-r0)

Wrong php dev version i suppose

Step 10/20 : FROM opencv as phpopencv
 ---> 2e9e88db579a
Step 11/20 : RUN apk add --no-cache php7-dev &&   php -v && 	export PKG_CONFIG=/usr/bin/pkg-config && export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/ && export LD_LIBRARY_PATH="/usr/local/lib64/" &&     cd /opt &&     git clone https://github.com/php-opencv/php-opencv.git &&     cd php-opencv &&     git checkout php7.4 &&     phpize &&     ./configure --with-php-config=/usr/bin/php-config &&     make && make test && make install &&     cd ../ &&     rm -R php-opencv &&     apk del php7-dev
 ---> Running in b7b2bd0e5647
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz
(1/9) Installing php7-common (7.3.26-r0)
(2/9) Installing php7 (7.3.26-r0)
(3/9) Installing ncurses-dev (6.2_p20200523-r0)
(4/9) Installing libedit-dev (20191231.3.1-r0)
(5/9) Installing libpcre2-16 (10.35-r0)
(6/9) Installing libpcre2-32 (10.35-r0)
(7/9) Installing pcre2-dev (10.35-r0)
(8/9) Installing php7-static (7.3.26-r0)
(9/9) Installing php7-dev (7.3.26-r0)
Executing busybox-1.31.1-r19.trigger
OK: 532 MiB in 150 packages
PHP 7.4.13 (cli) (built: Dec 11 2020 08:57:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans
Cloning into 'php-opencv'...
Branch 'php7.4' set up to track remote branch 'php7.4' from 'origin'.
Switched to a new branch 'php7.4'
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
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 pkg-config is at least version 0.9.0... yes
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 for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-pc-linux-musl
checking host system type... x86_64-pc-linux-musl
checking target system type... x86_64-pc-linux-musl
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib
checking for PHP extension directory... /usr/lib/php7/modules
checking for PHP installed headers prefix... /usr/include/php7
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for opencv support... yes, shared
checking for php debug... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for pkg-config... found
checking for opencv... found 4.5.0
checking for a sed that does not truncate output... /bin/sed
checking for ld used by cc... /usr/x86_64-alpine-linux-musl/bin/ld
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld) is GNU ld... yes
checking for /usr/x86_64-alpine-linux-musl/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
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 dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking how to run the C++ preprocessor... g++ -E
checking the maximum length of command line arguments... 98304
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... yes
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/x86_64-alpine-linux-musl/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

creating libtool
appending configuration tag "CXX" to libtool
checking for ld used by g++... /usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64
checking if the linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) is GNU ld... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/usr/x86_64-alpine-linux-musl/bin/ld -m elf_x86_64) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
(cached) (cached) checking how to hardcode library paths into programs... immediate
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
/bin/sh /opt/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /opt/php-opencv/opencv.cc -o opencv.lo 
mkdir .libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /opt/php-opencv/opencv.cc  -fPIC -DPIC -o .libs/opencv.o
/bin/sh /opt/php-opencv/libtool --mode=compile g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4  -DHAVE_CONFIG_H  -g -O2   -c /opt/php-opencv/source/opencv2/core/opencv_mat.cc -o source/opencv2/core/opencv_mat.lo 
mkdir source/opencv2/core/.libs
 g++ -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -I. -I/opt/php-opencv -DPHP_ATOM_INC -I/opt/php-opencv/include -I/opt/php-opencv/main -I/opt/php-opencv -I/usr/include/php7 -I/usr/include/php7/main -I/usr/include/php7/TSRM -I/usr/include/php7/Zend -I/usr/include/php7/ext -I/usr/include/php7/ext/date/lib -I/usr/local/include/opencv4 -DHAVE_CONFIG_H -g -O2 -c /opt/php-opencv/source/opencv2/core/opencv_mat.cc  -fPIC -DPIC -o source/opencv2/core/.libs/opencv_mat.o
/opt/php-opencv/source/opencv2/core/opencv_mat.cc: In function 'void opencv_mat_init()':
/opt/php-opencv/source/opencv2/core/opencv_mat.cc:858:49: error: invalid conversion from 'zval* (*)(zval*, zval*, zval*, void**)' {aka '_zval_struct* (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'} to 'zend_object_write_property_t' {aka 'void (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)'} [-fpermissive]
  858 |     opencv_mat_object_handlers.write_property = opencv_mat_write_property;
      |                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 zval* (*)(zval*, zval*, zval*, void**) {aka _zval_struct* (*)(_zval_struct*, _zval_struct*, _zval_struct*, void**)}
make: *** [Makefile:194: source/opencv2/core/opencv_mat.lo] Error 1
The command '/bin/sh -c apk add --no-cache php7-dev &&   php -v && 	export PKG_CONFIG=/usr/bin/pkg-config && export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/ && export LD_LIBRARY_PATH="/usr/local/lib64/" &&     cd /opt &&     git clone https://github.com/php-opencv/php-opencv.git &&     cd php-opencv &&     git checkout php7.4 &&     phpize &&     ./configure --with-php-config=/usr/bin/php-config &&     make && make test && make install &&     cd ../ &&     rm -R php-opencv &&     apk del php7-dev' returned a non-zero code: 2

It's working with the correct php7-dev version.

Thanks !