mod_brotli 和 apache 2.4.33 的编译问题

问题描述 投票:0回答:2
由于包含对 Apache 2.4.33 的 mod_brotli 支持而出现以下问题。

我编译了 brotli,它编译得很好,但是当我使用

--enable-brotli

--with-brotli=/apps/httpdx64/brotli
 在 apache 配置脚本中启用它时。编译 apache 时收到以下错误消息:

/apps/httpdx64/apr/build-1/libtool --silent --mode=link gcc -std=gnu99 -I/usr/include/libxml2 -I/apps/httpdx64/brotli/include -g -O2 -pthread -DSSL_EXPERIMENTAL_ENGINE -L/apps/httpdx64/apache24/openssl/lib -L/usr/lib64 -L/apps/httpdx64/expat/lib -o mod_brotli.la -rpath /apps/httpdx64/apache24/modules -module -avoid-version mod_brotli.lo -L/apps/httpdx64/brotli/lib -lbrotlienc -lbrotlicommon -export-symbols-regex brotli_module /usr/bin/ld: cannot find -lbrotlienc collect2: ld returned 1 exit status make[3]: *** [mod_brotli.la] Error 1 make[3]: Leaving directory `/apps/httpdx64/httpd-2.4.33/modules/filters' make[2]: *** [install-recursive] Error 1 make[2]: Leaving directory `/apps/httpdx64/httpd-2.4.33/modules/filters' make[1]: *** [install-recursive] Error 1 make[1]: Leaving directory `/apps/httpdx64/httpd-2.4.33/modules' make: *** [install-recursive] Error 1

请告知我如何修复此错误。

apache apache-modules brotli
2个回答
1
投票
不确定为什么将 brotli 路径设置为 httpd 文件夹 (

--with-brotli=/apps/httpdx64/brotli

)?

我像这样编译它(正如

我在这里解释):

#You may need to install some dependencies if not already installed on your machine. #For Centos/RHEL 7 the following should do this for you: sudo yum install wget sudo yum install perl sudo yum install gcc sudo yum install pcre-devel sudo yum install cmake.x86_64 cd ~ mkdir sources cd sources #Download and install brotli git clone https://github.com/google/brotli.git cd brotli/ git checkout v1.0 mkdir out && cd out ../configure-cmake make make test sudo make install #Download and install the latest Apache (needs to be 2.4.26 or above) #For example: wget http://mirrors.whoishostingthis.com/apache/httpd/httpd-2.4.33.tar.gz wget https://www.apache.org/dist/httpd/httpd-2.4.33.tar.gz.asc #Verify the package after download: gpg --verify httpd-2.4.33.tar.gz.asc) tar -zxvf httpd-2.4.33.tar.gz cd httpd-2.4.33 ./configure --with-pcre=/usr/bin/pcre-config --enable-ssl --enable-so --enable-brotli --with-brotli=/usr/local/brotli make sudo make install

谢谢, 巴里


0
投票
对于像我这样偶然发现同样问题的人,我通过走捷径并将 Brotli 重新安装到系统查找它的位置来解决此问题。

问题:

/usr/bin/ld: cannot find -lbrotlienc

分辨率:

知道
    ld
  1. 在哪里寻找

    -lbrotlienc

    。通过运行来做到这一点:
    ld -lbrotlienc --verbose
    

    在输出末尾附近,您应该会得到提示,其中
    ld
    正在尝试寻找

    -lbrotlienc

    。就我而言,它看起来像:
    attempt to open //usr/x86_64-redhat-linux/lib64/libbrotlienc.so failed
    attempt to open //usr/x86_64-redhat-linux/lib64/libbrotlienc.a failed
    attempt to open //usr/lib64/libbrotlienc.so failed
    attempt to open //usr/lib64/libbrotlienc.a failed
    ...
    attempt to open //usr/local/lib64/libbrotlienc.so failed
    

    选择一个合理的目录来安装 Brotli 库。就我而言,根据上面的输出,我想在 
  2. /usr/local/lib64
  3. 重新安装 Brotli 库。

    重新编译并重新安装 Brotli。
    1. cd
    2. 到您运行

      cmake

       构建 Brotli 的目录。就我而言,那就是:
      cd /usr/local/src/brotli-1.1.0/out/
      

      删除之前的 Brotli 安装和设置。
    3. xargs rm < install_manifest.txt cd /usr/local/src/brotli-1.1.0/out/ rm -rf out/

      准备 Brotli 编译,您想要放置其库的位置。
    4. mkdir out && cd out cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=/usr/local ..

      注意传递给 
    5. -DCMAKE_INSTALL_LIBDIR
    6. 标志的值。这将告诉 Brotli 库文件将放置在哪里。现在在重新编译之前,最好通过检查

      -DCMAKE_INSTALL_LIBDIR

       中的值来检查 
      CMakeCache.txt
      是否生效。
      cat CMakeCache.txt | grep CMAKE_INSTALL_LIBDIR
      

      最后,重新编译Brotli。
    7. cmake --build . --config Release --target install

      奖励:如果您运行 
    8. brotli --version
    9. 并获得

      symbol lookup error

      ,请按照 
      brotli/issues/1097
       中的说明配置 
      ldconfig
      ;只需跳过编译部分即可。

    完成这些步骤后,从源代码编译 httpd 时,Brotli 链接器错误应该消失。这是我启用 Brotli 的 httpd 编译设置,供您参考。
./configure --enable-brotli --with-brotli=/usr/local # irrelevant options snipped


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