本文介绍了如何在msys2上构建Apache httpd 2. *及更高版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在msys2上进行的httpd构建失败,并出现以下错误:

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

在实际的Linux发行版上,安装expat-devel软件包似乎可以解决问题请参阅在这里,更确切地说,expat-devel是apr-util的先决条件至少在msys2上缺少其标头.

那么由于没有可用的expat-devel软件包或头文件,因此如何使用msys构建httpd?在配置httpd --with-included-apr时,apr-utils在哪里寻找expat标头或如何配置它?

更准确地 CHANGES-APR-UTIL-1.6 文档说

应该在httpds构建目录树中的哪些位置安装expat标头和库?

解决方案

我最终不得不分别构建expat,然后出现了其他错误并找到了解决方案,这要归功于链接,用于缺少libtool,并链接到链接,可以有效地在不生成导出重新定义的情况下构建外派人员.

在此处找到完整的构建脚本:

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无法按照此处所述进行加载,因此无法使用运行时是很有用的/p>

httpd build on msys2 fails with the following error:

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

On real linux distros, installing the expat-devel package seems to solve the problem see here,more precisely, expat-devel is an apr-util prerequisiteand at least its headers ar missing on msys2.

So how to build httpd with msys since no expat-devel package or headers is available ?When configuring httpd --with-included-apr, where do apr-utils look for expat headers or how to configure that ?

more precisely the CHANGES-APR-UTIL-1.6 documentation says

where should expat headers and libs be installed in httpds build directory tree ?

解决方案

I finally had to build expat separately,then other errors arised and found a solution thanks tothis link for missing libtool and to that link for the effective way to build expat without generating export redefinition.

let find the full build script here:

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

The build process completed successfully,but usefull to say that the runtime can't be used since httpd is not able to load its dynamic modules as described here

这篇关于如何在msys2上构建Apache httpd 2. *及更高版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-26 17:23