怎样编译安装apr+apr-util

2017年11月27日 | 分类: 【技术】

注意:不要卸载低版本!

【安装apr】

参考:http://www.linuxfromscratch.org/blfs/view/cvs/general/apr.html
下载:http://archive.apache.org/dist/apr/

编译安装最新版本:

最新版是apr-1.6.3

wget http://archive.apache.org/dist/apr/apr-1.6.3.tar.bz2 && tar -xjvf apr-1.6.3.tar.bz2 && cd apr-1.6.3 && ./configure --prefix=/usr --disable-static --with-installbuilddir=/usr/share/apr-1/build && make && make install

yum版是apr-1.5.2

wget http://archive.apache.org/dist/apr/apr-1.5.2.tar.bz2 && tar -xjvf apr-1.5.2.tar.bz2 && cd apr-1.5.2 && ./configure --prefix=/usr --disable-static --with-installbuilddir=/usr/share/apr-1/build && make && make install

输出:

...
Libraries have been installed in:
   /usr/lib
...
/usr/bin/install -c -m 755 apr-config.out /usr/bin/apr-1-config

安装完成。

【安装apr-util】

参考:http://www.linuxfromscratch.org/blfs/view/cvs/general/apr-util.html
下载:http://archive.apache.org/dist/apr/

编译安装:

最新版是apr-util-1.6.1

wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.bz2 && tar -xjvf apr-util-1.6.1.tar.bz2 && cd apr-util-1.6.1 && ./configure --prefix=/usr --with-apr=/usr --with-gdbm=/usr --with-openssl=/usr --with-crypto && make && make install

yum版是apr-util-1.5.2

wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.bz2 && tar -xjvf apr-util-1.5.2.tar.bz2 && cd apr-util-1.5.2 && ./configure --prefix=/usr --with-apr=/usr --with-gdbm=/usr --with-openssl=/usr --with-crypto && make && make install

make时报错:

...
xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory
 #include <expat.h>
                   ^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] Error 1
make[1]: Leaving directory `/root/apr-1.6.3/apr-util-1.6.1'
make: *** [all-recursive] Error 1

CentOS 环境:

参考:https://github.com/scottcorgan/bucket-list/issues/2

yum install expat-devel

Ubuntu 环境:

参考:https://blog.csdn.net/ldar2011/article/details/43238019

apt-get install libexpat1-dev

重新make通过,然后make install。

输出:

...
Libraries have been installed in:
   /usr/lib
...
/usr/bin/install -c -m 644 aprutil.exp /usr/lib
/usr/bin/install -c -m 755 apu-config.out /usr/bin/apu-1-config

安装完成。