CentOS 6.3用ICC编译PHP5.4.8+Percona5.5.27+Tengine1.4.1


在上一篇文章里我们学习了如何安装ICC编译器,今天我们来记录一下用icc编译一台web服务器的过程。但是比较遗憾的是,根据我的测试,同样的参数,用icc编译出来的环境,运行discuz并未比用gcc编译出来的环境要有多大的提升,这是比较令人沮丧的。当然,也许是编译参数未能调整到最优的缘故。不管怎样,还是把这个编译过程记录下来吧,留作参考。

相关阅读:VMware虚拟机安装CentOS 6.3
 
1、准备工作
 前提是你的服务器已经安装了icc编译器,没安装的话移步这里:
 
下载相关的源码:
 wget http://cn.php.net/get/php-5.4.8.tar.gz/from/this/mirror
 wget http://www.percona.com/redir/downloads/Percona-Server-5.5/LATEST/source/Percona-Server-5.5.27-rel29.0.tar.gz
 wget http://tengine.taobao.org/download/tengine-1.4.1.tar.gz
 wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
 wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz
 wget "http://downloads.sourceforge.net/mcrypt/libmcrypt-2.5.8.tar.gz?modtime=1171868460&big_mirror=0"
 wget "http://downloads.sourceforge.net/mcrypt/mcrypt-2.6.8.tar.gz?modtime=1194463373&big_mirror=0"
 wget http://download.savannah.gnu.org/releases/libunwind/libunwind-1.1.tar.gz
 wget https://gperftools.googlecode.com/files/gperftools-2.0.tar.gz
 wget http://downloads.sourceforge.net/project/pcre/pcre/8.31/pcre-8.31.tar.gz
 

其他还有memcache、imagick等大家就根据实际需要来下载安装吧。为了节约篇幅我们今天就不涉及这些东东了。
 设置动态链接库的路径,避免后续编译的时候出错:
 vi /etc/ld.so.conf
 最后增加:
 /opt/intel/lib/intel64/
 /usr/local/lib
 /usr/lib
 保存
 vi /etc/ld.so.conf.d/usr_local_lib.conf
 /usr/local/lib
 /usr/lib
 保存
 ldconfig
 
2、编译安装
 tar zxvf libunwind-*.tar.gz
 cd libun*
 CC=icc \
 CXX=icpc \
 LD=xild \
 AR=xiar \
 CFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fPIC' \
 CXXFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti -fPIC' \
 ./configure
 make && make install
 cd ..
 
tar zxvf gperftools-2.0.tar.gz
 cd gperftools-2.0
 CC=icc \
 CXX=icpc \
 LD=xild \
 AR=xiar \
 CFLAGS="-O3 -no-prec-div -ip -fp-model fast=1 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -fPIC" \
 CXXFLAGS="${CFLAGS}" \
 CPPFLAGS=" -I/opt/intel/include " \
 ./configure
 make && make install
 cd ..
 
tar xzvf libic*
 cd libic*
 CC=icc \
 CXX=icpc \
 LD=xild \
 AR=xiar \
 CFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel' \
 CXXFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti' \
 ./configure --prefix=/usr/local
 make && make install
 cd ..
 
tar xzvf libmcry*
 cd libmcry*
 CC=icc \
 CXX=icpc \
 LD=xild \
 AR=xiar \
 CFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel' \
 CXXFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti' \
 ./configure
 make && make install
 /sbin/ldconfig
 cd libltdl/
 CC=icc \
 CXX=icpc \
 LD=xild \
 AR=xiar \
 CFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel' \
 CXXFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti' \
 ./configure --enable-ltdl-install
 make && make install
 cd ../../
 
tar zxvf mcrypt-2.6.8.tar.gz
 cd mcrypt-2.6.8/
 /sbin/ldconfig
 CC=icc \
 CXX=icpc \
 LD=xild \
 AR=xiar \
 CFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel' \
 CXXFLAGS='-O3 -xSSE4.2 -axSSE4.2,SSE4.1,SSE3,SSE2 -ip -unroll2 -no-prec-div -fp-model source -restrict -static-intel -fno-implicit-templates -fno-exceptions -fno-rtti' \
 ./configure
 make && make install
 cd ../
 
/usr/sbin/groupadd mysql
 /usr/sbin/useradd -g mysql mysql

  • 1
  • 2
  • 下一页

相关内容