编译安装Apache遇到的缺少expat.h与undefined reference to `XML_GetErrorCode'错误
1 缺少expat.h 编译安装Apache需要apr-util,而在编译安装apr-util时提示说缺少expat.h,此时直接安装expat库即可(centos): yum install expat-devel 2 undefined reference to `XML_GetErrorCode' 首先安装libxml2-devel包: yum install libxml2-devel 接着删除apr-util安装目录并重新编译安装: sudo rm -rf /usr/local/apr-util cd apr-util make clean ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make make install 目录的话根据需要修改,最后重新编译安装apache: cd httpd-xxxxx make clean ./configure \ --prefix=/usr/local/apache \ --with-apr=/usr/local/apr \ --with-apr-util=/usr/local/apr-util \ --with-pcre=/usr/local/pcre 同样目录按需修改。 来源: oschina 链接: https://my.oschina