如何在msys2上构建apache httpd 2. *及更高版本

问题描述 投票:0回答:1

msys2上的httpd build失败,出现以下错误:

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

在真正的Linux发行版上,安装expat-devel软件包似乎解决了问题see here,更准确地说,expat-devel是一个apr-util先决条件,至少在msys2上缺少它的头文件。

那么如何使用msys构建httpd,因为没有expat-devel包或头文件可用?在配置httpd --with-included-apr时,apr-utils在哪里查找expat头文件或如何配置?

更准确地说,CHANGES-APR-UTIL-1.6文件说

使用APR-util 1.6.0进行更改

*)apr-util的expat依赖关系不再使用apr-util构建。在构建apr-util之前首先安装expat(包括开发头和库)。

应该在httpds构建目录树中安装expat头文件和库吗?

apache msys2
1个回答
0
投票

我最后不得不单独构建expat,然后出现其他错误,并找到一个解决方案,感谢this链接缺少libtool和that链接,以便有效地构建expat而不生成导出重定义。

让我们在这里找到完整的构建脚本:

pacman -S make gcc libcrypt perl unzip libtool msys/libcrypt-devel

cd OpenSSL_1_1_1-stable
curl http://mirrors.standaloneinstaller.com/apache/httpd/httpd-2.4.38.tar.gz --output httpd-2.4.38.tar.gz
tar xvf  httpd-2.4.38.tar.gz

cd $HOME
git clone --branch OpenSSL_1_1_1-stable https://github.com/openssl/openssl.git
mv openssl  OpenSSL_1_1_1-stable
cd OpenSSL_1_1_1-stable
./configure gcc --prefix=$HOME/openssl
make
make install

cd $HOME
wget https://github.com/libexpat/libexpat/releases/download/R_2_2_6/expat-2.2.6.tar.bz2
tar xjvf expat-2.2.6.tar.bz2
cd $HOME/expat-2.2.6
./configure --prefix=$HOME/httpd --exec-prefix=$HOME/httpd
make
make install

cd $HOME
curl http://mirrors.standaloneinstaller.com/apache//apr/apr-1.6.5.tar.gz --output apr-1.6.5.tar.gz
tar xvf apr-1.6.5.tar.gz
curl http://mirrors.standaloneinstaller.com/apache//apr/apr-util-1.6.1.tar.gz --output apr-util-1.6.1.tar.gz
tar xvf apr-util-1.6.1.tar.gz
cd $HOME/apr-1.6.5
./configure --prefix=$HOME/httpd
 make
 make install
cd $HOME/apr-util-1.6.1
 ./configure --prefix=$HOME/httpd --with-apr=$HOME/httpd --with-expat=$HOME/httpd 
 make
 make install

cd $HOME
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar xvf pcre-8.43.tar.gz
cd pcre-8.43
./configure --prefix=$HOME/pcre
make 
make install

cd $HOME
wget https://github.com/nghttp2/nghttp2/releases/download/v1.37.0/nghttp2-1.37.0.tar.gz
tar xvf nghttp2-1.37.0.tar.gz
cd $HOME/nghttp2-1.37.0
./configure  --exec-prefix=$HOME/httpd --prefix=$HOME/httpd
make 
make install

cd $HOME/httpd-2.4.38
 ./configure --prefix=$HOME/httpd --with-expat==$HOME/httpd --with-apr-util=$HOME/httpd --with-apr=$HOME/httpd --with-pcre=$HOME/pcre --enable-ssl --enable-ssl-staticlib-deps --with-ssl=$HOME/openssl --enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-balancer --enable-http2 --enable-nghttp2-staticlib-deps --with-nghttp2=$HOME/nghttp2
make
make install

构建过程成功完成,但有用的说运行时无法使用,因为httpd无法加载其动态模块,如qazxsw poi所述

© www.soinside.com 2019 - 2024. All rights reserved.