首页 > 编程语言 >php8.2.1编译fileinfo扩展时提示 make: *** [libmagic/softmagic.lo] Error 1

php8.2.1编译fileinfo扩展时提示 make: *** [libmagic/softmagic.lo] Error 1

时间:2023-02-08 16:00:32浏览次数:50  
标签:softmagic php82 lo make usr fileinfo php local

 安装:

cd /opt/php-8.2.1/ext/fileinfo
/usr/local/php82/bin/phpize
./configure --with-php-config=/usr/local/php82/bin/php-config

# make && make install 错误如下
In file included from /usr/include/string.h:633,
                 from /usr/local/php82/include/php/main/../main/php_config.h:2207,
                 from /usr/local/php82/include/php/Zend/zend_config.h:1,
                 from /usr/local/php82/include/php/Zend/zend_portability.h:43,
                 from /usr/local/php82/include/php/Zend/zend_types.h:25,
                 from /usr/local/php82/include/php/Zend/zend.h:27,
                 from /usr/local/php82/include/php/main/php.h:31,
                 from /opt/php-8.2.1/ext/fileinfo/libmagic/config.h:1,
                 from /opt/php-8.2.1/ext/fileinfo/libmagic/file.h:36,
                 from /opt/php-8.2.1/ext/fileinfo/libmagic/softmagic.c:32:
/opt/php-8.2.1/ext/fileinfo/libmagic/softmagic.c:507:7: error: expected identifier or ‘(’ before ‘__extension__’
  507 | char *strndup(const char *, size_t);
      |       ^~~~~~~
/opt/php-8.2.1/ext/fileinfo/libmagic/softmagic.c:510:1: error: expected identifier or ‘(’ before ‘__extension__’
  510 | strndup(const char *str, size_t n)
      | ^~~~~~~
make: *** [libmagic/softmagic.lo] Error 1

 

处理方法:

# 在源码包中 /opt/php-8.2.1/ext/fileinfo 替换Makefile文件的第25行
sed -i "s#CFLAGS = -g -O2#CFLAGS = -std=c99 -g#g" Makefile 
# 清除 make 缓存
make clean
# 再次安装
make && make install
# 安装成功

 验证:

 

标签:softmagic,php82,lo,make,usr,fileinfo,php,local
From: https://www.cnblogs.com/chenjiangbin/p/17102153.html

相关文章