【问题标题】:how to build apache httpd 2.* and beyond on msys2如何在 msys2 上构建 apache httpd 2.* 及更高版本
【发布时间】:2019-08-05 23:36:57
【问题描述】:

在 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 的先决条件 并且至少在 msys2 上缺少它的标头。

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

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

APR-util 1.6.0 的变化

*) apr-util 的 expat 依赖不再使用 四月实用程序。 首先安装 expat(包括开发头文件和库) 在构建 apr-util 之前。

expat 头文件和库应该安装在 httpds 构建目录树的什么位置?

【问题讨论】:

    标签: apache msys2


    【解决方案1】:

    我最终不得不单独构建 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 无法加载其动态模块,如 here 所述。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-24
      • 2015-03-04
      • 2021-11-17
      • 1970-01-01
      • 2014-06-08
      相关资源
      最近更新 更多