Ice-3.5.1在CentOS 6.5系统中的编译配置教程
1 操作系统
CentOS release 6.5 (Final) x86_64 系统。
2 源码包下载
Ice-3.5.1.zip
下载地址:https://zeroc.com/download/Ice/3.5/Ice-3.5.1.zip
ThirdParty-Sources-3.5.1.tar.gz,
下载地址:http://download.zeroc.com/Ice/3.5/ThirdParty-Sources-3.5.1.tar.gz
其中包括:
1) db-5.3.21.NC.tar.gz 及随ICE-3.5.1发布的补丁文件patch.db.5.3.21
2) jgoodies-common-1_4_0.zip
3) jgoodies-forms-1_6_0.zip
4) jgoodies-looks-2_5_2.zip
5) mcpp-2.7.2.tar.gz 及随ICE-3.5.1发布的补丁文件patch.mcpp.2.7.2
此外,还需要下载:
1) bzip2-1.0.6.tar.gz
2) expat-2.1.1.tar.bz2
3) mono-2.11.3.tar.bz2
4) OpenSSL_0_9_8-stable.zip
3 编译环境配置
在系统的个人目录,例如:/home/$(username)/Documents下:
1)解压ice-3.5.1.zip形成ice-3.5.1源码目录,新建名为install文件夹,用于安装编译后的第三方软件工具。
2)解压ThirdParty-Sources-3.5.1.tar.gz文件,形成第三方源码文件目录。
3)新建ice的环境变量文件env.sh.
首先,根据ThirdParty-Sources-3.5.1文件夹中的“README”文件内容,进行带补丁的第三方工具mcpp和db-5.3.21的编译和安装:
(1)解压缩mcpp-2.7.2.tar.gz文件
$ cd mcpp-2.7.2
通过补丁文件patch.mcpp.2.7.2,对mcpp-2.7.2中的部分源代码进行自动化地修改。
$ patch -p0 < ../mcpp/patch.mcpp.2.7.2
$ ./configure CFLAGS=-fPIC --enable-mcpplib --disable-shared
--prefix=/home/$(username)/Documents/Ice/install/3rd/mcpp272
$ make
$ make install
(2)解压缩db-5.3.21.NC.tar.gz文件。
$ cd db-5.3.21.NC
通过补丁文件patch.db.5.3.21,对db-5.3.21.NC中的部分源代码进行自动化地修改。
$ patch -p0 < ../db/patch.db.5.3.21
$ cd db-5.3.21.NC/build_unix
$ ../dist/configure --prefix=/home/$(username)/Documents/Ice/install/3rd/db5321--enable-cxx --enable-java --enable-shared --enable-static
然后,进行其它第三方工具的安装:
(3)解压缩bzip2-1.0.6.tar.gz文件。
$ cd bzip2-1.0.6
$ make install PREFIX=/home/$(username)/Documents/Ice/install/3rd/bzip2106
(4)解压缩expat-2.1.1.tar.bz2文件。
$ cd expat-2.1.1
$ ./configure --prefix=/home/$(username)/Documents/Ice/install/3rd/expat211
$ make
$ make install
(5)解压缩mono-2.11.3.tar.bz2文件
$ cd mono-2.11.3
$ ./configure --prefix=/home/$(username)/Documents/Ice/install/3rd/nono2113
$ make
$ make install
(6)解压缩OpenSSL_0_9_8-stable.zip文件
$ cd openssl-OpenSSL_0_9_8-stable
$ ./config --prefix=/home/$(username)/Documents/Ice/install/3rd/openssl098
--openssldir=/home/$(username)/Documents/Ice/install/3rd/openssl098/openssl
$ make
$ make install
(7)在/home/$(username)/Documents/Ice/install/3rd/目录中,新建文件夹jgoodies,并将下面三个文件解压至该文件夹。
三个文件分别是:jgoodies-common-1_4_0.zip、jgoodies-forms-1_6_0.zip和jgoodies-looks-2_5_2.zip。
主要是获取jgoodies-common-1.4.0.jar,jgoodies-forms-1.6.0.jar和jgoodies-looks-2.5.2.jar三个Java包。
最后,编辑环境变量文件env.sh,内容如下:
===========================================================================
export TOPDIR=/home/$(username)/Documents/Ice
#bzip
export PATH=$TOPDIR/install/3rd/bzip2106/bin:$PATH
export LD_LIBRARY_PATH=$TOPDIR/install/3rd/bzip2106/lib:$LD_LIBRARY_PATH
#Berkeley DB
export PATH=$TOPDIR/install/3rd/db5321/bin:$PATH
export LD_LIBRARY_PATH=$TOPDIR/install/3rd/db5321/lib:$LD_LIBRARY_PATH
#expat
export PATH=$TOPDIR/install/3rd/expat211/bin:$PATH
export LD_LIBRARY_PATH=$TOPDIR/install/3rd/expat211/lib:$LD_LIBRARY_PATH
#mcpp
export PATH=$TOPDIR/install/3rd/mcpp272/bin:$PATH
export LD_LIBRARY_PATH=$TOPDIR/install/3rd/mcpp272/lib:$LD_LIBRARY_PATH
#openssl
export PATH=$TOPDIR/install/3rd/openssl098/bin:$PATH
export LD_LIBRARY_PATH=$TOPDIR/install/3rd/openssl098/lib:$LD_LIBRARY_PATH
#mono-2.1.1.3
export PATH=$TOPDIR/install/3rd/nono2113/bin:$PATH
export LD_LIBRARY_PATH=$TOPDIR/install/3rd/nono2113/lib:$LD_LIBRARY_PATH
#java classpath
export CLASSPATH=$TOPDIR/ThirdParty-Sources-3.5.1/jgoodies/jgoodies-common-1.4.0/jgoodies-common-1.4.0.jar:$CLASSPATH
export CLASSPATH=$TOPDIR/ThirdParty-Sources-3.5.1/jgoodies/jgoodies-forms-1.6.0/jgoodies-forms-1.6.0.jar:$CLASSPATH
export CLASSPATH=$TOPDIR/ThirdParty-Sources-3.5.1/jgoodies/jgoodies-looks-2.5.2/jgoodies-looks-2.5.2.jar:$CLASSPATH
export CLASSPATH=$TOPDIR/install/3rd/db5321/lib/db.jar:$CLASSPATH
===============================================================================
4 编译过程
4.1 cpp模块的编译
首先,切换目录到:/home/$(username)/Documents/Ice/ice-3.5.1/cpp,编译cpp部分:
编译cpp的过程中会报错:找不到libmcpp.a这个静态库:
===============================================================================
g++ -shared -Wl,--enable-new-dtags -Wl,-rpath,/opt/Ice-3.5/lib64 -rdynamic -m64 -Wall -Werror -pthread -fPIC -g -L../../lib
/usr/bin/ld: cannot find -lmcpp
collect2: ld returned 1 exit status
make[3]: *** [../../lib/libSlice.so.3.5.1] Error 1
make[3]: Leaving directory `/home/zhchshen/.local/share/Trash/files/ice-3.5.1/cpp/src/Slice'
make[2]: *** [Slice] Error 2
make[2]: Leaving directory `/home/zhchshen/.local/share/Trash/files/ice-3.5.1/cpp/src'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/home/zhchshen/.local/share/Trash/files/ice-3.5.1/cpp'
make: *** [all] Error 1
===============================================================================
信息所显示的编译命令中的静态库文件的目录引导:-L../../lib,和出错后的第一层退出位置:/home/zhchshen/.local/share/Trash/files/ice-3.5.1/cpp/src/Slice/,可知编译过程的库文件位置为:/home/$(username)/Documents/Ice/ice-3.5.1/cpp/lib,此处没有libmcpp.a库文件。
将/home/$(username)/Documents/Ice/install/3rd/mcpp272/lib/libmcpp.a库文件,复制到:
/home/$(username)/Documents/Ice/ice-3.5.1/cpp/lib目录中:
关闭当前已经显示出错信息的Linux终端,重新打开终端,并source环境变量文件env.sh,再次编译,成功!
编译cpp的test程序,在进行make test之前,需要修改目录:
/home/$(username)/Documents/Ice/ice-3.5.1/cpp/test/IceUtil/unicode中的filename文件名,修改为:filename.txt。否则,会报如下错误:
==============================================================================
*** running tests 3/84 in /home/zhchshen/Documents/Ice/ice-3.5.1/cpp/test/IceUtil/unicode
*** configuration: Default
*** test started: 08/12/17 14:16:11
starting client... ok
testing UTF-8 to wstring (utf32le) conversion... ok
wstring (utf32le) to UTF-8 conversion... ok
testing UTF-8 filename... failed!
Client.cpp:197: assertion `os.is_open()' failed
unexpected exit status: expected: 0, got -6
('test in /home/zhchshen/Documents/Ice/ice-3.5.1/cpp/test/IceUtil/unicode failed with exit status', 256)
===============================================================================
测试程序编译、执行完毕:
4.2 Java模块的编译
类似cpp模块的编译,先source环境变量,然后在Linux终端,切换目录:
$ cd /home/$(username)/Documents/Ice/ice-3.5.1/java
$ make
该过程中会出现如下错误信息:
/home/$(username)/Documents/Ice/ice-3.5.1/java/test/Ice/slicing/objects/ServerPrivateAMD.ice:159: `Forward' is not defined
/home/$(username)/Documents/Ice/ice-3.5.1/java/test/Ice/slicing/objects/ServerPrivateAMD.ice:220: `Forward' is not defined
这是由于ServerPrivateAMD.ice文件的第159行出现了如下所示的双斜线注释语句:
class Forward; // Forward-declared class defined in another compilation unit
需要将注释的双斜线修改为/* Forward-declared class defined in another compilation unit */
然后继续编译。成功编译后,执行测试:
$ make test
4.3 cs模块的编译
类似cpp模块的编译,先source环境变量,然后在Linux终端,切换目录:
$ cd /home/$(username)/Documents/Ice/ice-3.5.1/cs
$ make
编译过程中同样会报出‘Forward’没有定义的错误:
/home$(username)/Documents/Ice/ice-3.5.1/cs/test/Ice/slicing/objects/TestAMD.ice:153: `Forward' is not defined,同样是slice文件双斜线注释引起的问题:
class Forward; // Forward-declared class defined in another compilation unit
双斜线修改为/* */,重新编译,成功编译后,执行测试:
$ make test
4.4 python模块的编译
类似cpp模块的编译,先source环境变量,然后在Linux终端,切换目录:
$ cd /home/$(username)/Documents/Ice/ice-3.5.1/py
$ make
成功编译后,执行测试:
$ make test
在测试的过程中出现‘Forward’没有定义的错误:
===============================================================================
starting ServerAMD.py. Traceback (most recent call last):
File "/home/zhchshen/Documents/Ice/ice-3.5.1/py/test/Ice/slicing/objects/run.py", line 31, in <module>
TestUtil.clientServerTest(server="ServerAMD.py")
File "/home/zhchshen/Documents/Ice/ice-3.5.1/scripts/TestUtil.py", line 1309, in clientServerTest serverProc = spawnServer(server, env = serverenv, lang=serverCfg.lang, mx=serverCfg.mx)
File "/home/zhchshen/Documents/Ice/ice-3.5.1/scripts/TestUtil.py", line 1125, in spawnServer server.expect("[^\n]+ ready\n")
File "/home/zhchshen/Documents/Ice/ice-3.5.1/scripts/Expect.py", line 399, in expect raise e
Expect.TIMEOUT: timeout exceeded in match
pattern: "[^\n]+ ready\n"
buffer: "/home/zhchshen/Documents/Ice/ice-3.5.1/py/test/Ice/slicing/objects/TestAMD.ice:153: `Forward\' is not defined
Traceback (most recent call last):
File \"/home/zhchshen/Documents/Ice/ice-3.5.1/py/test/Ice/slicing/objects/ServerAMD.py\", line 14, in <module>
Ice.loadSlice(\'-I. --all ServerPrivateAMD.ice Forward.ice\')
RuntimeError: Slice parsing failed for `-I. --all ServerPrivateAMD.ice Forward.ice\'"('test in /home/zhchshen/Documents/Ice/ice-3.5.1/py/test/Ice/slicing/objects failed with exit status', 256)
===============================================================================
修改文件:
/home/$(username)/Documents/Ice/ice-3.5.1/py/test/Ice/slicing/objects/TestAMD.ice的69行,双斜线注释,修改为/* */注释。然后继续make test。
4.5 其它模块的编译
其它模块包括php,ruby和vb,暂时不需要这些语言的支持,本教程没有涉及。
Linux centos s3 客户端
转载文章标签 Linux centos s3 客户端 ice slice 分布式架构 ci jar 解压缩 文章分类 架构 后端开发
-
mac安装s3命令客户端
装s3命令客户端在 macOS 上安装
mac s3 命令行 安装 AWS -
frpc客户端 linux frp centos
frp 是一个高性能的内网穿透的反向代理软件,支持 TCP、UDP、HTTP、HTTPS 等常见协议(TCP最常用),可以将处于局域网或者家用电脑主机、办公电脑主机通过中转服务器的方式暴露在公网里,使用户可以通过访问公网的IP(域名)的方式获取内网里的信息,对于开发者来说,frp帮助我们调试接口(微信公众号或其他拥有IP白名单的接口),frp帮助我们取流内网的摄像头,访问内网数据库资源等
frpc客户端 linux frp内网穿透 frp安装搭建 centos安装frp windows安装frp