CentOS安装apr-util时报错:xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

时间:2022-06-01 16:36:08

在CentOS 7上安装apr-util,安装apr是正常的,安装apr-util时报错:

[root@localhost apr-util-1.6.1]# make
make[1]: Entering directory `/home/cc/download/apr-util-1.6.1'
/bin/sh /usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/home/cc/download/apr-util-1.6.1/include -I/home/cc/download/apr-util-1.6.1/include/private -I/usr/local/apr/include/apr-1 -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
#include <expat.h>
^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/home/cc/download/apr-util-1.6.1'
make: *** [all-recursive] Error 1

查了下,只需要安装依赖expat-devel即可。执行命令:

yum install expat-devel

重新make安装apr-util,执行成功。