ice 编译安装

15.  ICE的编译
32位机器:

wget http://www.zeroc.com/download/Ice/3.4/Ice-3.4.1-rhel5-i386-rpm.tar.gz

64位机器:

wget http://www.zeroc.com/download/Ice/3.4/Ice-3.4.1-rhel5-x86_64-rpm.tar.gz

ICE源码:

wget http://www.zeroc.com/download/Ice/3.4/Ice-3.4.1.tar.gz

第三方库:

wget http://www.zeroc.com/download/Ice/3.4/ThirdParty-Sources-3.4.1.tar.gz

wget http://www.zeroc.com/download/Ice/3.4/qt-x11-opensource-src-4.5.3.tar.gz

 

编译过程:

首先 安装第三方包:  ThirdParty-Sources-3.3.0.tar.gz
解压 ThirdParty-Sources-3.3.0.tar.gz
$ cd ThirdParty-Sources-3.3.0
1)mcpp  is a C/C++ preprocessor
----
解压 mcpp-2.7.2.tar.gz
$ cd mcpp-2.7.2
$ patch -p0 < ../mcpp/patch.mcpp.2.7.2
$ patch -p0 < ../mcpp/mcpp-2.7.2.patch2
 
$ ./configure CFLAGS=-fPIC --enable-mcpplib --disable-shared
$ make
$ su
$ make install
2)Berkeley DB  是一个高性能的,嵌入数据库编程库,和C语言, C++, Java, Perl, Python, Tcl以及其他很多语言都有绑定。
-----
解压 db-4.8.30.NC.tar.gz
$ cd db-4.8.30.NC
$ cd build_unix
$ ../dist/configure --enable-cxx --enable-java
$ make
$ su
$ make install
默认安装在/usr/local/BerkeleyDB.4.8下
3)bzip2 是 Julian Seward 开发并按照自由软件/开源软件协议发布的数据压缩算法及程序
------
解压 bzip2-1.0.5.tar.gz
$ cd bzip2-1.0.5
$ make -f Makefile-libbz2_so
$ su
$ make install
4) expat 是一个 XML parsing C library
------
解压 expat-2.0.1.tar.gz
$ cd expat-2.0.1
$ ./configure
$ make
$ su
$ make install
5) openssl 是 Secure Socket Layer (SSL) binary and related cryptographic tools
--------
解压 openssl-0.9.8g.tar.gz
$ cd openssl-0.9.8g
$ ./config --prefix=/usr/local --openssldir=/usr/local/openssl
$ make
$ su
$ make install
现在正式安装 Ice-3.3.0.tar.gz

 

--------
解压 Ice-3.3.0.tar.gz
$ cd Ice-3.3.0/cpp
$ make
$ su
$ make install
特别注意: 如果编译不通过 ,请修改 cpp/config/Make.rules的相关报错第三方库的路径,重新编译。还要注意设置ICE的安装目录,比如: prefix = /opt/ICE
修改cpp/config/Make.rules中的DB_HOME:
DB_HOME         ?= /usr/local/BerkeleyDB.4.8

修改cpp/config/Make.rules中的profix
profix                          ?=/usr/local
 

以root身份把/usr/local/lib; /usr/local/BerkeleyDB.4.8/lib

路径加入/etc/ld.so.conf,然后运行ldconfig更新/etc/ld.so.cache。

 

如果是碰到libcrypto.a的链接错误(/usr/local/lib/libcrypto.a(x86_64cpuid.o): relocation R_X86_64_PC32 against symbol `OPENSSL_cpuid_setup' can not be used when making a shared object; recompile with -fPIC),则重新编译 采用如下的指令

./config --prefix=/usr/local --openssldir=/usr/local/openssl -fPIC shared

同时输出静态和动态库.

 

如果遇到找不到iconv相关的函数,则在 cpp/config/Make.rules.Linux,在最显眼的地方【143行】在最后加上一个 -liconv.

 

16.  ICE的安装
RPM包安装方式

wget Ice-3.4.1-rhel5-x86_64-rpm.tar.gz
tar -zxvf Ice-3.4.1-rhel5-x86_64-rpm.tar.gz
rpm -ivh ice-3.4.1-1.rhel5.noarch.rpm
rpm -ivh db48-4.8.30-1ice.rhel5.x86_64.rpm
rpm -ivh db48-devel-4.8.30-1ice.rhel5.x86_64.rpm
rpm -ivh db48-utils-4.8.30-1ice.rhel5.x86_64.rpm
rpm -ivh ice-libs-3.4.1-1.rhel5.x86_64.rpm
rpm -ivh ice-c++-devel-3.4.1-1.rhel5.x86_64.rpm
rpm -ivh ice-python-3.4.1-1.rhel5.x86_64.rpm
rpm -ivh ice-python-devel-3.4.1-1.rhel5.x86_64.rpm
rpm -ivh ice-php-3.4.1-1.rhel5.x86_64.rpm
rpm –ivh ice-php-devel-3.4.1-1.rhel5.x86_64.rpm
rpm -ivh ice-utils-3.4.1-1.rhel5.x86_64.rpm
rpm –ivh ice-servers-3.4.1-1.rhel5.x86_64.rpm

 

 

17.  IcePHP
1:在php.ini中设置extension=php_ice.dll,将IcePHP.dll拷贝到php安装目录下的modules(windows下是ext)目录下。

2:将Ice下的php目录下的所有php脚本拷贝到apache的主目录下

3:将编写的slice文件拷贝到主目录下,并通过slice2php编译出php文件

4:编写调用程序,一个通过定位服务器查找到代理,并调用相关接口的例子如下:

<?php

       require 'Ice.php';

       require 'Hello.php';

      

       $initData = new Ice_InitializationData;

       $initData->properties = Ice_createProperties();

       $initData->properties->setProperty("Ice.Default.Locator", "DemoIceGrid/Locator:default -h 192.168.41.62 -p 12000 -t 10000");

       $communicator = Ice_initialize($initData);

       $proxy= $communicator->stringToProxy("hello");

       $helloObj = Demo_HelloPrxHelper::checkedCast($proxy);

       if($helloObj==null)

       {

                     echo("hello proxy null");

                     return ;

       }

      

  $helloObj->getGreeting();

?>

 

不通过定位服务器查找代理并访问接口的方法如下:

<?php

   require 'Ice.php';

   require 'Status.php';

   function ProcessHTTPRequest()

   {

       $communicator = Ice_initialize();

       $proxy= $communicator->stringToProxy("Status:default -p 10000");

       $ret=-1;

       try

       {

$statusObj = RPC_StatusPrxHelper::checkedCast($proxy);

$method = $_GET["method"];

$app_key =$_GET["app_key"];

if ($method=="character.getStatus")

{

$uid     = $_GET["user_id"];

$ret = $statusObj->GetStatus($app_key,$uid);

return "{\"data\":{\"status\":\"".$ret."\"},\"return_code\":0,\"return_message\":\"ok\"}";

}

              }

          catch(Exception  $e)

         {

                         return "{\"data\":null,\"return_code\":\"".$ret."\",\"return_message\":\"Bad gateway\"}";

         }

   }

   echo ProcessHTTPRequest();

?>

 

如果是在linxu下安装IcePHP的话,则需要在Ice源文件下的php目录下编译源码,然后执行make install安装IcePHP扩展,一般Ice会安装到opt/Ice-3.4.1目录下(这里假设版本号为3.4.1),然后在php.ini中定义:

extension_dir = /opt/Ice-3.4.1/php
extension = IcePHP.so
include_path = /opt/Ice-3.4.1/php

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值