Linux Apache 编译安装 fatal error: expat.h

本文介绍了解决 APR XML 编译过程中遇到的 expat.h 文件缺失问题的方法。通过安装 libexpat1-dev 软件包并重新配置编译环境,可以成功解决编译错误。
这里报错
xml/apr_xml.c:35:19: fatal error: expat.h: 没有那个文件或目录
compilation terminated.
/etc/httpd/apr-util-1.6.0/build/rules.mk:206: recipe for target 'xml/apr_xml.lo' failed
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory '/etc/httpd/apr-util-1.6.0'
/etc/httpd/apr-util-1.6.0/build/rules.mk:118: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

解决办法就是安装libexpat1-dev

sudo apt-get install libexpat1-dev

 重新输

sudo make
sudo make install

在我的记录里,补充安装了libexpat1-dev 软件包后,

make clean

make 

会报错,类似于以下:

httpd-2.4.28/build/program.mk:22: recipe for target 'httpd' failed

我们正确的做法是:

#apt install libexpat1-dev

(build tree)#rm -rf ./*

(build tree)# ../configure --prefix=/usr/local/apache \
--enable-dav \
--enable-so \
--enable-maintainer-mode \
--enable-rewrite \
--enable-deflate=shared \
--enable-ssl=shared \
--enable-expires=shared \
--enable-headers=shared \
--enable-static-support \
--with-included-apr \
--with-mpm=prefork \
--enable-cache \
--enable-file-cache \

--with-pcre=/usr/local/pcre

(当然,编译选项自己选择)

(build tree)#make

(build tree)#make install

大功告成。

我所强调的重点是,补充安装缺失的软件包后,需要重新configure,然后再make && make install.


https://www.linuxidc.com/Linux/2017-08/146567.htm

https://www.cnblogs.com/zlslch/p/7136288.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值