Ubuntu1404编译安装Ice-3.3.1
来源:互联网 发布:淘宝中国质造怎么加入 编辑:程序博客网 时间:2024/06/04 18:43
环境:Ubuntu14.04(x64),gcc-4.4
步骤:
1.下载源码
https://zeroc.com/distributions/ice/archive,选择Ice 3.3.1并下载Ice-3.3.1.tar.gz和ThirdParty-Sources-3.3.1.tar.gz
2.编译第三方包
1)编译mcpp(64位操作系统需指定库文件位置为lib64)
#tar -zxvf mcpp-2.7.2.tar.gz
# cd mcpp-2.7.2
# ./configure --prefix=/usr/local/ICE-3.3.1/mcpp-2.7.2/ -- libdir=/usr/local/ICE-3.3.1/mcpp-2.7.2/lib64/ CFLAGS=-fPIC -enable-mcpplib -disable-shared
# make
# make install
2)编译Berkeley DB 解压 mcpp-2.7.2.tar.gz(64位操作系统需指定库文件位置为lib64)
#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.1/BerkeleyDB.4.6/ -- libdir=/usr/local/ICE-3.3.1/BerkeleyDB.4.6//lib64/ -enable-cxx
# make
# make install
3)编译bzip2(64位操作系统需指定库文件位置为lib64,在makefile中修改了无效,后在编译完成后直接将lib重命名为lib64)
#tar -zxvf bzip2-1.0.5.tar.gz
# cd bzip2-1.0.5
修改Makefile,将PREFIX指向/usr/local/ICE-3.3.1/bzip2-1.0.5,在CC=gcc 后面加上 -fPIC命令,因为后面编译Ice-3.3.1的时候会提示出错,要求加上此命令并重新编译
# make
# make install
4)编译expat(64位操作系统需指定库文件位置为lib64)
#tar -zxvf expat-2.0.1.tar.gz
# cd expat-2.0.1
# ./configure --prefix=/usr/local/ICE-3.3.1/expat-2.0.1/ -- libdir=/usr/local/ICE-3.3.1//expat-2.0.1/ lib64/
# make
# make install
5)编译openssl(64位操作系统需指定库文件位置为lib64,在makefile中修改了无效,后在编译完成后直接将lib重命名为lib64)
#tar -zxvf openssl-0.9.8g.tar.gz
# cd openssl-0.9.8g
# ./config --prefix=/usr/local/ICE-3.3.1/openssl
# make
# make install
备注:openssl编译完成后,再编译Ice-3.3.1,遇到诸多问题,最重要的如下:
如果是碰到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
同时输出静态和动态库.
3.正式编译安装Ice-3.3.1.tar.gz
#tar -zxvf Ice-3.3.1.tar.gz
编译cpp版本
#cd Ice-3.3.1/cpp
#vi config/Make.rules
...
#
# Select an installation base directory. The directory will be created
# if it does not exist.
#
# prefix ?= /opt/Ice-$(VERSION)
prefix ?= /usr/local/ICE-3.3.1/Ice-$(VERSION)
#
# The "root directory" for runpath embedded in executables. Can be unset
# to avoid adding a runpath to Ice executables.
#
# embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR)
embedded_runpath_prefix ?= /usr/local/ICE-3.3.1/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.1/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 ?= /opt/db
DB_HOME ?= /usr/local/ICE-3.3.1/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 ?= /opt/expat
EXPAT_HOME ?= /usr/local/ICE-3.3.1/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 ?= /opt/openssl
OPENSSL_HOME ?= /usr/local/ICE-3.3.1/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 ?= /opt/mcpp
MCPP_HOME ?= /usr/local/ICE-3.3.1/mcpp-2.7.2
...
#make && make install 完成安装。
注1:安装中碰到的编译器的问题:
系统开始安装的时gcc-4.8版本的编译器,因template的问题,Ice-.3.3.1与此编译器不相兼容,故重新安装gcc-4.4版本的编译器,重新编译Ice-3.3.1
切换编译器方法:
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40
#sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 80
#sudo update-alternatives --config gcc,根据提示选择40版本的gcc
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 40
#sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 80
#sudo update-alternatives --config g++,根据提示选择40版本的g++
注2:安装中碰到的关于头文件的问题:
手动在发生错误的源文件中添加头文件引用(多时系统库,例如#ifdef __linux #include <unistd.h> # endif)
注3:完成安装之后设置环境变量:
ICE_HOME=/usr/local/ICE-3.3.1/Ice-3.3
PATH=$PATH:$ICE_HOME/bin
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ICE_HOME/lib
export PATH ICE_HOME LD_LIBRARY_PATH
注4:安装完成后在测试:
控制台输入slice2cpp -v
注5:安装完成之后在Qt中测试:
1)Qt5.8编译器用的时gcc-4.8,故切换到本机安装的另一版本Qt4.8.5,使用低版本的编译器,不然Ice同样会报出template相关错误
2)设置链接ICE库
在工程的*.pro文件中加入
INCLUDEPATH += /opt/Ice-3.3/include
LIBS += -L/opt/Ice-3.3/lib64 -lIce -lIceUtil
- Ubuntu1404编译安装Ice-3.3.1
- ubuntu1404 编译新内核
- Ubuntu系统编译安装Ice
- CentOS安装ice编译错误
- ubuntu1404 安装 ppsspp
- vmware11+Ubuntu1404安装samba
- ubuntu1404安装xen
- Ubuntu1404安装ROS
- ubuntu1404下安装anaconda
- ubuntu1404安装简记
- vmware11+Ubuntu1404安装samba
- VS2010编译与安装ICE指南
- linux环境下编译安装ICE
- ubuntu1404安装配置jdk1.7
- Ubuntu1404安装ssh和ftp
- ubuntu1404安装Vundle和YouCompleteMe
- Ubuntu1404下安装MATLAB R2014A
- 编译ICE
- Hadoop学习笔记(1)
- ARM day3 程序的编译(linux)
- linux 中查看mysql数据库
- 纹理
- 一款好用的切换目录的工具autojump
- Ubuntu1404编译安装Ice-3.3.1
- Docker Java应用日志时间和容器时间不一致
- [leetcode]1. Two Sum
- SIFT代码中RANSAC原理详解
- sqlserver2000不能访问1433端口
- FindCmdLineSwitch
- While 循环的各个部分
- Hadoop学习笔记(2)
- CodeForces 600CMake Palindrome