mkoppanen / php-zbarcode

PHP extension for reading barcodes. Uses ImageMagick(http://www.imagemagick.org/) for image support and zbar(http://zbar.sourceforge.net/) for scanning the barcodes.
http://valokuva.org
383 stars 131 forks source link

problem making with --enable-zbarcode-imagick #21

Open michprof opened 8 years ago

michprof commented 8 years ago

Hi, trying to make with imagick enabled.

I'm getting the following error:

/bin/sh /var/ftp/ftp_user_test/php-zbarcode-master/libtool --mode=compile cc -fopenmp -I/usr/include/ImageMagick -I. -I/var/ftp/ftp_user_test/php-zbarcode-master -DPHP_ATOM_INC -I/var/ftp/ftp_user_test/php-zbarcode-master/include -I/var/ftp/ftp_user_test/php-zbarcode-master/main -I/var/ftp/ftp_user_test/php-zbarcode-master -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/include/ImageMagick -DHAVE_CONFIG_H -g -O2 -c /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c -o zbarcode.lo libtool: compile: cc -fopenmp -I/usr/include/ImageMagick -I. -I/var/ftp/ftp_user_test/php-zbarcode-master -DPHP_ATOM_INC -I/var/ftp/ftp_user_test/php-zbarcode-master/include -I/var/ftp/ftp_user_test/php-zbarcode-master/main -I/var/ftp/ftp_user_test/php-zbarcode-master -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/include/ImageMagick -DHAVE_CONFIG_H -g -O2 -c /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c -fPIC -DPIC -o .libs/zbarcode.o In file included from /usr/include/php/main/php.h:34, from /var/ftp/ftp_user_test/php-zbarcode-master/php_zbarcode.h:41, from /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:19: /usr/include/php/Zend/zend.h:194:1: warning: "restrict" redefined In file included from /var/ftp/ftp_user_test/php-zbarcode-master/php_zbarcode.h:38, from /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:19: /usr/include/ImageMagick/wand/MagickWand.h:40:1: warning: this is the location of the previous definition /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c: In function ‘zim_zbarcodescanner_scan’: /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:347: error: ‘php_imagick_object’ undeclared (first use in this function) /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:347: error: (Each undeclared identifier is reported only once /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:347: error: for each function it appears in.) /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:347: error: ‘intern_image’ undeclared (first use in this function) /var/ftp/ftp_user_test/php-zbarcode-master/zbarcode.c:348: error: expected expression before ‘)’ token make: *\ [zbarcode.lo] Error 1

I'm getting no errors on ./configure

Thanks to everyone will help.

Michele

nitinsbuzz commented 8 years ago

Do you have imagick installed?

jorissteyn commented 8 years ago

The symbol php_imagick_object was removed from imagicks public headers in this commit https://github.com/mkoppanen/imagick/commit/97857130fcf5131b80529f7a1febfaa7533c27de. So if I'm not mistaken you need to build against a version of imagick before 3.4.3.

@mkoppanen could you explain what you think would be the best way for an extension (like zbarcode) to access the interned imagick object?

mkoppanen commented 8 years ago

@jorissteyn,

as you can see from the commit there is an accessor for this: php_imagick_get_class_entry. For PHP7 this probably needs quite a lot of rework on both sides

jorissteyn commented 8 years ago

Thanks for the quick reply!

As far as I understand we don't need the class entry, because we already have the zend_object of the imagick object. And I already ported the zend_object_store code to PHP7. So the only thing missing is the definition of php_imagick_object. As a proof of concept I added the definition of the struct inline in zbarcode.c (https://github.com/jorissteyn/php-zbarcode/commit/a95e63949bfc3704683dda3cf085a6e402e41eee) - and with that commit all tests pass on PHP5 and PHP7 (including 006 and 007 of course).

I hope you have the time to elaborate on what you think is the best way to proceed. Be it restoring the definition in imagicks public headers or reworking imagick/zbarcode to handle this use-case better.

jorissteyn commented 8 years ago

Status update: a better solution is in the making (at least conceptually) in https://github.com/mkoppanen/imagick/issues/169.