Linux环境下make编译安装ICE-3.3.0
环境:
Linux+lnmp
PHP5.2.17
1、下载安装包:
#wget http://www.zeroc.com/download/Ice/3.3/Ice-3.3.1.zip #wget http://www.zeroc.com/download/Ice/3.3/ThirdParty-Sources-3.3.1.tar.gz
这里提醒一下,安装PHP ICE需要注意PHP版本和ICE版本,PHP 5.2只能用 ICE-3.3.X版本。
2、安装步骤
1)、解压安装包
#tar zxvf ThirdParty-Sources-3.3.1.tar.gz
2)、安装mcpp
#tar zxvf mcpp-2.7.2.tar.gz #cd mcpp-2.7.2 #./configure --prefix=/usr/local/ICE-3.3.0/mcpp-2.7.2/ CFLAGS=-fPIC -enable-mcpplib -disable-shared #make #make install
3)、安装Berkeley DB
# tar zxvf db-4.6.21.NC.tar.gz # cd db-4.6.21.NC # cd build_unix/ # ../dist/configure --prefix=/usr/local/ICE-3.3.0/BerkeleyDB.4.6/ -enable-cxx # make # make install
4)、安装bzip2
# tar zxvf bzip2-1.0.5.tar.gz # cd bzip2-1.0.5
修改Makefile文件:
# vim Makefile #修改PREFIX指向 # Where you want it installed when you do 'make install' # PREFIX=/usr/local PREFIX=/usr/local/ICE-3.3.0/bzip2-1.0.5
# make # make install
5)、安装expat
# tar zxvf expat-2.0.1.tar.gz # cd expat-2.0.1 # ./configure --prefix=/usr/local/ICE-3.3.0/expat-2.0.1/ # make # make install
6)、安装openssl
# tar zxvf openssl-0.9.8g.tar.gz # cd openssl-0.9.8g # ./config --prefix=/usr/local/ICE-3.3.0/openssl # make # make install 问题:
7)、安装ICE-3.3.1
# uzip zxvf Ice-3.3.1.zip # cd Ice-3.3.1/cpp/ # vim config/Make.rules
修改:
# # Select an installation base directory. The directory will be created # if it does not exist. # prefix ?= /usr/local/ICE-3.3.0/Ice-$(VERSION) # # The "root directory" for runpath embedded in executables. Can be unset # to avoid adding a runpath to Ice executables. # embedded_runpath_prefix ?= /usr/local/ICE-3.3.0/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) # If libbzip2 is not installed in a standard location where the # compiler can find it, set BZIP2_HOME to the bzip2 installation # directory. # BZIP2_HOME ?= /usr/local/ICE-3.3.0/bzip2-1.0.5 # If Berkeley DB is not installed in a standard location where the # compiler can find it, set DB_HOME to the Berkeley DB installation # directory. # DB_HOME ?= /usr/local/ICE-3.3.0/BerkeleyDB.4.6 # If expat is not installed in a standard location where the compiler # can find it, set EXPAT_HOME to the expat installation directory. # EXPAT_HOME ?= /usr/local/ICE-3.3.0/expat-2.0.1 # # If OpenSSL is not installed in a standard location where the # compiler can find it, set OPENSSL_HOME to the OpenSSL installation # directory. # OPENSSL_HOME ?= /usr/local/ICE-3.3.0/openssl # # If Mcpp is not installed in a standard location where the compiler # can find it, set MCPP_HOME to the Mcpp installation directory. # MCPP_HOME ?= /usr/local/ICE-3.3.0/mcpp-2.7.2
修改:(如果直接make可以成功,则忽略该修改)
编译安装:
# make # make install 问题: /usr/bin/ld: cannot find -lmcpp collect2: ld returned 1 exit status make[2]: *** [../../lib/libSlice.so.3.3.1] Error 1 make[2]: Leaving directory `/usr/local/Ice-3.3.1/cpp/src/Slice' make[1]: *** [all] Error 1 make[1]: Leaving directory `/usr/local/Ice-3.3.1/cpp/src' make: *** [all] Error 1 解决方法:
通常在软件编译时出现的usr/bin/ld: cannot find -lxxx的错误,主要的原因是库文件并没有导入的ld检索目录中。
解决方式:
1. 确认库文件是否存在,比如-l123, 在/usr/lib, /usr/local/lib,或者其他自定义的lib下有无lib123.so, 如果只是存在lib123.so.1,那么可以通过ln -sv lib123.so.1 lib123.so,建立一个连接重建lib123.so.
2. 检查/etc/ld.so.conf中的库文件路径是否正确,如果库文件不是使用系统路径,/usr/lib, /usr/local/lib, 那么必须在文件中加入.
3. ldconfig 重建ld.so.cache文件,ld的库文件检索目录存放文件。尤其刚刚编译安装的软件,必须运行ldconfig,才能将新安装的库文件导入ld.so.cache.
若此方法不行,且该软件已安装,也已在自定义或安装目录中找到lib123.so.1文件,则可以直接进入/usr/lib文件夹,执行 ln -sv /usr/local/software/lib123.so.1 lib123.so
8)、编译安装 PHP 版本
# cd ../php # vim config/Make.rules
参照ICE修改相应配置,并修改PHP_HOME路径:
# # Select an installation base directory. The directory will be created # if it does not exist. # prefix ?= /usr/local/ICE-3.3.0/Ice-$(VERSION) # # The "root directory" for runpath embedded in executables. Can be unset # to avoid adding a runpath to Ice executables. # embedded_runpath_prefix ?= /usr/local/ICE-3.3.0/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) # If you've installed a distribution, or PHP was included with # your system, then you likely need to review the values of # PHP_INCLUDE_DIR and PHP_LIB_DIR. # PHP_HOME ?= /usr/local/php
编译安装:
# make # make install
复制 IcePHP.so到PHP extension_dir目录:
# cp -p /usr/local/ICE-3.3.0/Ice-3.3.1/lib/IcePHP.so /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
修改PHP配置文件php.ini,添加IcePHP.so
; Directory in which the loadable extensions (modules) reside. extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/" extension = "memcache.so" extension = "pdo_mysql.so" extension = "IcePHP.so"
9)、重启服务,查看php -m或phpinfo
# /usr/local/php/bin/php -m filter ftp gd gettext hash ice iconv json libxml