1. 程式人生 > >centos編譯apahce時出現httpd-2.2.22/srclib/apr-util錯誤的解決方法

centos編譯apahce時出現httpd-2.2.22/srclib/apr-util錯誤的解決方法

今天在編譯apache時,出現如下問題:

make[3]: Entering directory `/tmp/httpd-2.2.22/srclib/apr-util/xml/expat'
/bin/sh ./conftools/mkinstalldirs /usr/local/apache2/lib /usr/local/apache2/include
/bin/sh ./libtool  --mode=install /usr/bin/install -c libexpat.la /usr/local/apache2/lib/libexpat.la
/usr/bin/install -c .libs/libexpat.so.0.5.0 /usr/local/apache2/lib/libexpat.so.0.5.0
(cd /usr/local/apache2/lib && { ln -s -f libexpat.so.0.5.0 libexpat.so.0 || { rm -f libexpat.so.0 && ln -s libexpat.so.0.5.0 libexpat.so.0; }; })
(cd /usr/local/apache2/lib && { ln -s -f libexpat.so.0.5.0 libexpat.so || { rm -f libexpat.so && ln -s libexpat.so.0.5.0 libexpat.so; }; })
/usr/bin/install -c .libs/libexpat.lai /usr/local/apache2/lib/libexpat.la
/usr/bin/install -c .libs/libexpat.a /usr/local/apache2/lib/libexpat.a
chmod 644 /usr/local/apache2/lib/libexpat.a
ranlib /usr/local/apache2/lib/libexpat.a
libtool: install: warning: remember to run `libtool --finish /usr/local/apache2--sysconfdir=/etc/httpd/lib'
/usr/bin/install -c -m 644 ./lib/expat.h /usr/local/apache2/include
make[3]: Leaving directory `/tmp/httpd-2.2.22/srclib/apr-util/xml/expat'
/bin/sh /tmp/httpd-2.2.22/srclib/apr/libtool --mode=install /usr/bin/install -c -m 755 libaprutil-1.la /usr/local/apache2/lib
libtool: install: error: cannot install `libaprutil-1.la' to a directory not ending in /usr/local/apache2--sysconfdir=/etc/httpd/lib
make[2]: *** [install] 錯誤 1
make[2]: Leaving directory `/tmp/httpd-2.2.22/srclib/apr-util'
make[1]: *** [install-recursive] 錯誤 1
make[1]: Leaving directory `/tmp/httpd-2.2.22/srclib'
make: *** [install-recursive] 錯誤 1

卡在這裡編譯不過去了,分析原因,原來是缺少 apr & apr-util,下面我們就來解決該問題。

需要下載以下兩個包:

執行以下命令:

    >wget http://mirror.bjtu.edu.cn/apache//apr/apr-1.4.5.tar.gz
  >tar zxvf apr-1.4.5-tar.gz
  >cd apr-1.4.5
  >./configure --prefix=/usr/local/apr-httpd/
  >make
    >make install

    >wget http://mirror.bjtu.edu.cn/apache//apr/apr-util-1.4.1.tar.gz
  >tar zxvf apr-util-1.4.1-tar.gz
  >cd apr-util-1.4.1
  >./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/
  >make
    >make install

  回到apache編譯目錄

  >./configure --prefix=/usr/local/apache2 --sysconfdir=/etc/httpd --with-z=/usr/local/zlib --with-apr=/usr/local/apr-httpd --with-apr-util=/usr/local/apr-util-httpd  --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
  >make
  >make install

    啟動apache服務

    >/usr/local/apache2/bin/apachectl start

現在可以了,輸入http://loaclhost/訪問試試!