pecl install imagick在带有PHP 8的M1 MacBook上失败,0

nwlls2ji  于 2023-04-28  发布在  PHP
关注(0)|答案(2)|浏览(118)

更新

这个问题似乎与PECL本身有关:
https://github.com/Imagick/imagick/issues/331
我无法运行pecl install imagick的构建过程,也无法从错误日志中获得任何信息。我用的是Mac OS 11。2.1)搭配最新的Apple M1处理器。该库与PHP 8结合使用。0.2
在开始构建过程之前,我安装了以下brew包:

需要的库

brew install pkg-config
brew install imagemagick

生成命令

pecl install imagick

构建过程日志

creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/libtool --mode=compile cc -I. -I/private/tmp/pear/temp/imagick -I/private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/include -I/private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/main -I/private/tmp/pear/temp/imagick -I/opt/homebrew/Cellar/php/8.0.2/include/php -I/opt/homebrew/Cellar/php/8.0.2/include/php/main -I/opt/homebrew/Cellar/php/8.0.2/include/php/TSRM -I/opt/homebrew/Cellar/php/8.0.2/include/php/Zend -I/opt/homebrew/Cellar/php/8.0.2/include/php/ext -I/opt/homebrew/Cellar/php/8.0.2/include/php/ext/date/lib -I/opt/homebrew/Cellar/imagemagick/7.0.11-0/include/ImageMagick-7  -DHAVE_CONFIG_H  -g -O2   -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/homebrew/Cellar/imagemagick/7.0.11-0/include/ImageMagick-7 -c /private/tmp/pear/temp/imagick/imagick_file.c -o imagick_file.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/imagick -I/private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/include -I/private/tmp/pear/temp/pear-build-rootgEqg8P/imagick-3.4.4/main -I/private/tmp/pear/temp/imagick -I/opt/homebrew/Cellar/php/8.0.2/include/php -I/opt/homebrew/Cellar/php/8.0.2/include/php/main -I/opt/homebrew/Cellar/php/8.0.2/include/php/TSRM -I/opt/homebrew/Cellar/php/8.0.2/include/php/Zend -I/opt/homebrew/Cellar/php/8.0.2/include/php/ext -I/opt/homebrew/Cellar/php/8.0.2/include/php/ext/date/lib -I/opt/homebrew/Cellar/imagemagick/7.0.11-0/include/ImageMagick-7 -DHAVE_CONFIG_H -g -O2 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -Xpreprocessor -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/opt/homebrew/Cellar/imagemagick/7.0.11-0/include/ImageMagick-7 -c /private/tmp/pear/temp/imagick/imagick_file.c  -fno-common -DPIC -o .libs/imagick_file.o
In file included from /private/tmp/pear/temp/imagick/imagick_file.c:22:
/private/tmp/pear/temp/imagick/php_imagick_file.h:61:108: error: expected ')'
zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
                                                                                                           ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:61:32: note: to match this '('
zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC);
                               ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:65:54: error: expected ')'
int php_imagick_safe_mode_check(const char *filename TSRMLS_DC);
                                                     ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:65:32: note: to match this '('
int php_imagick_safe_mode_check(const char *filename TSRMLS_DC);
                               ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:68:134: error: expected ')'
php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC);
                                                                                                                                     ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:68:46: note: to match this '('
php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC);
                                             ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:71:153: error: expected ')'
php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC);
                                                                                                                                                        ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:71:47: note: to match this '('
php_imagick_rw_result_t php_imagick_write_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type, zend_bool adjoin TSRMLS_DC);
                                              ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:74:112: error: expected ')'
zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC);
                                                                                                               ^
/private/tmp/pear/temp/imagick/php_imagick_file.h:74:37: note: to match this '('
zend_bool php_imagick_stream_handler(php_imagick_object *intern, php_stream *stream, ImagickOperationType type TSRMLS_DC);
                                    ^
/private/tmp/pear/temp/imagick/imagick_file.c:81:51: error: expected ')'
zend_bool php_imagick_is_url(const char *filename TSRMLS_DC)
                                                  ^
/private/tmp/pear/temp/imagick/imagick_file.c:81:29: note: to match this '('
zend_bool php_imagick_is_url(const char *filename TSRMLS_DC)
                            ^
/private/tmp/pear/temp/imagick/imagick_file.c:85:90: error: expected ')'
        if (php_stream_locate_url_wrapper(filename, &path_for_open, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC)) {
                                                                                                ^
/private/tmp/pear/temp/imagick/imagick_file.c:85:35: note: to match this '('
        if (php_stream_locate_url_wrapper(filename, &path_for_open, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC)) {
                                         ^
/private/tmp/pear/temp/imagick/imagick_file.c:91:108: error: expected ')'
zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC)
                                                                                                           ^
/private/tmp/pear/temp/imagick/imagick_file.c:91:32: note: to match this '('
zend_bool php_imagick_file_init(struct php_imagick_file_t *file, const char *filename, size_t filename_len TSRMLS_DC)
                               ^
/private/tmp/pear/temp/imagick/imagick_file.c:123:40: error: expected ')'
                else if (php_imagick_is_url(filename TSRMLS_CC)) {
                                                     ^
/private/tmp/pear/temp/imagick/imagick_file.c:123:30: note: to match this '('
                else if (php_imagick_is_url(filename TSRMLS_CC)) {
                                           ^
/private/tmp/pear/temp/imagick/imagick_file.c:142:53: error: expected ')'
        file->absolute_path = expand_filepath(buffer, NULL TSRMLS_CC);
                                                           ^
/private/tmp/pear/temp/imagick/imagick_file.c:142:39: note: to match this '('
        file->absolute_path = expand_filepath(buffer, NULL TSRMLS_CC);
                                             ^
/private/tmp/pear/temp/imagick/imagick_file.c:160:133: error: expected ')'
int php_imagick_read_image_using_imagemagick(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
                                                                                                                                    ^
/private/tmp/pear/temp/imagick/imagick_file.c:160:45: note: to match this '('
int php_imagick_read_image_using_imagemagick(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
                                            ^
/private/tmp/pear/temp/imagick/imagick_file.c:201:133: error: expected ')'
int php_imagick_read_image_using_php_streams(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
                                                                                                                                    ^
/private/tmp/pear/temp/imagick/imagick_file.c:201:45: note: to match this '('
int php_imagick_read_image_using_php_streams(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
                                            ^
/private/tmp/pear/temp/imagick/imagick_file.c:207:2: error: expected ')'
        IMAGICK_SET_ERROR_HANDLING_THROW;
        ^
/private/tmp/pear/temp/imagick/imagick_file.c:28:133: note: expanded from macro 'IMAGICK_SET_ERROR_HANDLING_THROW'
#  define IMAGICK_SET_ERROR_HANDLING_THROW zend_replace_error_handling(EH_THROW, php_imagick_exception_class_entry, &error_handling TSRMLS_CC)
                                                                                                                                    ^
/private/tmp/pear/temp/imagick/imagick_file.c:207:2: note: to match this '('
/private/tmp/pear/temp/imagick/imagick_file.c:28:71: note: expanded from macro 'IMAGICK_SET_ERROR_HANDLING_THROW'
#  define IMAGICK_SET_ERROR_HANDLING_THROW zend_replace_error_handling(EH_THROW, php_imagick_exception_class_entry, &error_handling TSRMLS_CC)
                                                                      ^
/private/tmp/pear/temp/imagick/imagick_file.c:216:3: error: expected ')'
                IMAGICK_RESTORE_ERROR_HANDLING;
                ^
/private/tmp/pear/temp/imagick/imagick_file.c:29:88: note: expanded from macro 'IMAGICK_RESTORE_ERROR_HANDLING'
#  define IMAGICK_RESTORE_ERROR_HANDLING   zend_restore_error_handling(&error_handling TSRMLS_CC)
                                                                                       ^
/private/tmp/pear/temp/imagick/imagick_file.c:216:3: note: to match this '('
/private/tmp/pear/temp/imagick/imagick_file.c:29:71: note: expanded from macro 'IMAGICK_RESTORE_ERROR_HANDLING'
#  define IMAGICK_RESTORE_ERROR_HANDLING   zend_restore_error_handling(&error_handling TSRMLS_CC)
                                                                      ^
/private/tmp/pear/temp/imagick/imagick_file.c:224:3: error: expected ')'
                IMAGICK_RESTORE_ERROR_HANDLING;
                ^
/private/tmp/pear/temp/imagick/imagick_file.c:29:88: note: expanded from macro 'IMAGICK_RESTORE_ERROR_HANDLING'
#  define IMAGICK_RESTORE_ERROR_HANDLING   zend_restore_error_handling(&error_handling TSRMLS_CC)
                                                                                       ^
/private/tmp/pear/temp/imagick/imagick_file.c:224:3: note: to match this '('
/private/tmp/pear/temp/imagick/imagick_file.c:29:71: note: expanded from macro 'IMAGICK_RESTORE_ERROR_HANDLING'
#  define IMAGICK_RESTORE_ERROR_HANDLING   zend_restore_error_handling(&error_handling TSRMLS_CC)
                                                                      ^
/private/tmp/pear/temp/imagick/imagick_file.c:228:2: error: expected ')'
        IMAGICK_RESTORE_ERROR_HANDLING;
        ^
/private/tmp/pear/temp/imagick/imagick_file.c:29:88: note: expanded from macro 'IMAGICK_RESTORE_ERROR_HANDLING'
#  define IMAGICK_RESTORE_ERROR_HANDLING   zend_restore_error_handling(&error_handling TSRMLS_CC)
                                                                                       ^
/private/tmp/pear/temp/imagick/imagick_file.c:228:2: note: to match this '('
/private/tmp/pear/temp/imagick/imagick_file.c:29:71: note: expanded from macro 'IMAGICK_RESTORE_ERROR_HANDLING'
#  define IMAGICK_RESTORE_ERROR_HANDLING   zend_restore_error_handling(&error_handling TSRMLS_CC)
                                                                      ^
/private/tmp/pear/temp/imagick/imagick_file.c:255:54: error: expected ')'
int php_imagick_safe_mode_check(const char *filename TSRMLS_DC)
                                                     ^
/private/tmp/pear/temp/imagick/imagick_file.c:255:32: note: to match this '('
int php_imagick_safe_mode_check(const char *filename TSRMLS_DC)
                               ^
/private/tmp/pear/temp/imagick/imagick_file.c:262:64: error: expected ')'
        if (PG(open_basedir) && php_check_open_basedir_ex(filename, 0 TSRMLS_CC)) {
                                                                      ^
/private/tmp/pear/temp/imagick/imagick_file.c:262:51: note: to match this '('
        if (PG(open_basedir) && php_check_open_basedir_ex(filename, 0 TSRMLS_CC)) {
                                                         ^
/private/tmp/pear/temp/imagick/imagick_file.c:269:134: error: expected ')'
php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
                                                                                                                                     ^
/private/tmp/pear/temp/imagick/imagick_file.c:269:46: note: to match this '('
php_imagick_rw_result_t php_imagick_read_file(php_imagick_object *intern, struct php_imagick_file_t *file, ImagickOperationType type TSRMLS_DC)
                                             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [imagick_file.lo] Error 1
ERROR: `make' failed
wljmcqd8

wljmcqd81#

你需要从git安装imagick

$ git clone https://github.com/Imagick/imagick

$ cd imagick

$ phpize && ./configure

$ make

$ make test

$ make install

安装后编辑你的php。ini并添加extension="imagick.so"行。
重新启动Apache并创建索引。php with phpinfo()for check if module imagick ok.

$ echo "<?php phpinfo();" > /your-web-patch/index.php
nc1teljy

nc1teljy2#

PHP 8的imagick还没有发布。他们说大师工作,但这可能会帮助你,也可能不会。请注意,这与Apple Silicon无关-它也不适用于Intel。

相关问题