簡體   English   中英

pecl install imagick 在帶有 PHP 8.0 的 M1 MacBook 上失敗

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

更新

這個問題似乎與 PECL 本身有關:

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


我無法運行pecl install imagick的構建過程,也無法從錯誤日志中獲取任何信息。 我使用配備最新 Apple M1 處理器的 Mac (OS 11.2.1)。 該庫與 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

您需要從 git 安裝 imagick

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

$ cd imagick

$ phpize && ./configure

$ make

$ make test

$ make install

安裝后編輯您的 php.ini 並添加行extension="imagick.so"

重新啟動 apache 並使用 phpinfo() 創建 index.php 以檢查模塊是否正常。

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

PHP 8 的 imagick 尚未發布。 他們說大師作品,但這可能會或可能不會幫助你。 請注意,這與 Apple Silicon 無關——它也不適用於英特爾。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM