gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 00:44:42 25 4
gpt4 key购买 nike

更新

这个问题似乎与 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 - pecl install imagick 在带有 PHP 8.0 的 M1 MacBook 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66286153/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com