如何在 msys2 上构建 apache httpd 2.* 及更高版本
how to build apache httpd 2.* and beyond on msys2
msys2 上的 httpd 构建失败并出现以下错误:
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
在真正的 linux 发行版上,安装 expat-devel 包似乎可以解决问题 see here,
更准确地说,expat-devel 是 apr-util 的先决条件
至少它的 headers ar 在 msys2 上丢失了。
既然没有 expat-devel 包或 headers 可用,那么如何使用 msys 构建 httpd?
配置 httpd --with-included-apr 时,apr-utils 在哪里寻找 expat headers 或者如何配置它?
更准确地说,CHANGES-APR-UTIL-1.6 文档说
Changes with APR-util 1.6.0
*) The expat dependency of apr-util is no longer built with
apr-util.
Install expat (including development headers and libraries) first
before building apr-util.
expat headers 和库应该安装在 httpds 构建目录树中的什么地方?
我终于不得不单独构建 expat,
然后出现其他错误并找到解决方案感谢
this link for missing libtool and to that link 构建 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 无法按照 here
所述加载其动态模块,因此无法使用运行时
msys2 上的 httpd 构建失败并出现以下错误:
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
在真正的 linux 发行版上,安装 expat-devel 包似乎可以解决问题 see here, 更准确地说,expat-devel 是 apr-util 的先决条件 至少它的 headers ar 在 msys2 上丢失了。
既然没有 expat-devel 包或 headers 可用,那么如何使用 msys 构建 httpd? 配置 httpd --with-included-apr 时,apr-utils 在哪里寻找 expat headers 或者如何配置它?
更准确地说,CHANGES-APR-UTIL-1.6 文档说
Changes with APR-util 1.6.0
*) The expat dependency of apr-util is no longer built with apr-util. Install expat (including development headers and libraries) first before building apr-util.
expat headers 和库应该安装在 httpds 构建目录树中的什么地方?
我终于不得不单独构建 expat, 然后出现其他错误并找到解决方案感谢 this link for missing libtool and to that link 构建 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 无法按照 here
所述加载其动态模块,因此无法使用运行时