简体   繁体   English

pecl install imagick 在带有 PHP 8.0 的 M1 MacBook 上失败

[英]pecl install imagick fails on M1 MacBook with PHP 8.0

UPDATE更新

It seems this issue is related to the PECL itself:这个问题似乎与 PECL 本身有关:

https://github.com/Imagick/imagick/issues/331 https://github.com/Imagick/imagick/issues/331


I'm unable to run the build process for pecl install imagick and not get any information from the error logs.我无法运行pecl install imagick的构建过程,也无法从错误日志中获取任何信息。 I use a Mac (OS 11.2.1) with the latest Apple M1 processor.我使用配备最新 Apple M1 处理器的 Mac (OS 11.2.1)。 The library is used in combination with PHP 8.0.2该库与 PHP 8.0.2 结合使用

Before I started the build process, I installed the following brew packages:在开始构建过程之前,我安装了以下 brew 包:

required libraries所需库

brew install pkg-config
brew install imagemagick

build command构建命令

pecl install imagick

build process log构建过程日志

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

You need install imagick from git您需要从 git 安装 imagick

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

$ cd imagick

$ phpize && ./configure

$ make

$ make test

$ make install

After install edit your php.ini and add the line extension="imagick.so" .安装后编辑您的 php.ini 并添加行extension="imagick.so"

Restart apache and create a index.php with phpinfo() for check if module imagick ok.重新启动 apache 并使用 phpinfo() 创建 index.php 以检查模块是否正常。

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

There is no release of imagick for PHP 8 yet. PHP 8 的 imagick 尚未发布。 They say master works, but that may or may not help you.他们说大师作品,但这可能会或可能不会帮助你。 Note, this is unrelated to Apple Silicon—it doesn't work on Intel, neither.请注意,这与 Apple Silicon 无关——它也不适用于英特尔。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM