Saturday, May 9, 2009
Qt系列软件包
Qt工具包是一个跨平台的C++开发工具。Qt被主要用在了KDE桌面环境的开发中。它是挪威Trolltech公司的产品,2008年6月17日被芬兰的诺基亚(Nokia)公司收购,以增强该公司在跨平台软件研发方面的实力。
使用Qt开发的软件,可以在任何支援的平台上编译与执行,而不需要修改源代码。可以实现本平台的图形界面风格,也可实现其它平台的图形界面风格。比如您可以在Microsoft Windows平台下编译出具有苹果公司Mac OS图形界面风格的应用程序。
同时,经过多年发展,Qt不但拥有了完善的C++图形库,而且近年来的版本逐渐整合了数据库、OpenGL库、多媒体库(Phonon)、网络库、脚本库、XML库、WebKit库等等,其核心库也加入了进程间通信、多线程等模块,极大的丰富了Qt开发大规模复杂跨平台应用程序的能力,真正意义上实现了其研发宗旨“Code Less; Create More; Deploy Anywhere.”。
Qt中使用了C++的非标准扩展,用在编译前增加一个名为moc的预处理器来实现,moc将Qt代码处理成标准C++代码。
Qt开放源代码,并且提供自由软件的用户协议。使得它可以被广泛地应用在各平台上的开放源代码软件开发中。
其官方网站为:http://www.qtsoftware.com/
二、Qt的授权模式
1.商业版:开发的软件是专属的或商业的,源代码不共享。
2.开源版:遵循GNU GPL v.3.0,发布的程序也必须是基于GPL的。Qt 4.5.0 及以后的版本开始遵循 GNU LGPL v.2.1。
三、Qt的平台支持
Qt 的版本是按照不同的图形系统来划分的,目前分为五个版本:
Win: 适用于Miccrosoft Windows
X11: 适合于使用了x系统的各种 linux 和 unix的平台
Mac: 适合于苹果Mac OS X
embedded-linux: 适合于具有帧缓冲(frame buffer)的linux 的平台
embedded-wince: 适合于Windows CE
四、Qt各软件版本的区别
1. Qt泛指Qt的所有桌面版本,比如Qt/X11,Qt Windows,Qt Mac等。由于Qt最早是在Linux中随着KDE流行开来的,因此通常很多人说的Qt都指用于Linux/Unix的Qt/X11。
2. Qt/E(Qt/Embedded)最初是用于嵌入式Linux系统的Qt版本。Qt/E去掉了X Lib的依赖而直接工作于Frame Buffer上,因而效率更高。
3. Qtopia最初是sourceforge.net上的一个开源项目,全称是Qt Palmtop Environment (QPE),是一个构建于Qt/E之上的类似桌面系统的应用环境,包括了PDA和手机等掌上系统常见的功能如电话簿、日程表等。相比之下,Qt/E是基础类库。在QT4版本前要安装Qtopia需要先装Qt/E,但之后的就不需要了。版本4之后的Qtopia 已经带有QT/E库了。
4. Qtopia Core:就是原来的Qt/E,从Qt 4开始改名为Qtopia Core,把Qtopia Core并到Qtopia的产品线中去了。在版本4之前,Qte和Qtopia是不同的两套程序,Qte是基础类库,Qtopia是构建于Qte之上的一系列应用程序。但从版本4开始,Trolltech将Qte并入了Qtopia,并推出了新的Qtopia4。在该版中,原来的Qte被称为Qtopia Core,作为嵌入式版本的核心,既可以与Qtopia配合,也可以独立使用。原来的Qtopia则被分成几层,核心的应用框架和插件系统被称为 Qtopia Platform,上层的应用程序则按照不同的目标用户分为不同的包,如Qtopai PDA,Qtopia Phone。但实际上Qtopia Core就相当于原来的Qt/E,仍然作为基础类库。从Qt4.4开始,其名称又改回Qt-embedded了,之前的Qtopia改名为Qt Extended了。其线路为Qt/E->Qtopia Core->Qt-embedded。
5. Qt-all是qt的所有版本的源代码了,既可以编译成Linux版本也可以编译成Windows版本。
6. Qt Extended(2008年9月30日前称Qtopia)是一个软件平台,主要用于采用嵌入式Linux系统的(embedded Linux-based system)的电子手机和移动电话。从4.4版本开始,Qtopia改名为Qt Extended,qt-embedded-4.4.x相当于qtopia-core,qt-extended相当于桌面。2009年3月3日,Qt Software宣布将停止开发作为独立产品的 Qt Extended。取而代之的是,Qt Extended 中的一些功能将被转入 Qt 框架,从而使 Qt 成为更加丰富的跨平台应用程序框架。Qt Extended 的最后一个版本是4.4.3。
Wednesday, May 6, 2009
qte4编译
一.qt-embedded-linux-opensource-src-4.4.3
1. cd qt-embedded-linux-opensource-src-4.4.3
2. ./configure -prefix $PWD/build -release -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -optimized-qmake -no-phonon -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb -qt-kbd-usb -confirm-license -qt-mouse-tslib
configure完后会在当前目录下生成config.status文件,里面记录了编译时使用的参数。
configure支持的参数及其意义可以通过./configure --help来查看。
这里使用tslib做为qt鼠标的驱动,需要修改mkspecs/qws/linux-arm-g++/qmake.conf文件:
QMAKE_INCDIR = /home/lcc/project/qt/tslib-1.4/build/include
QMAKE_LIBDIR = /home/lcc/project/qt/tslib-1.4/build/lib
否则会出现"The tslib functionality test failed!"错误。这个错误还有另外一种解决办法就是在configure的时候增加-I和-L参数,qte4.3.4就采用了这种方法。
3. make
4. make install
二.qtopia-core-opensource-src-4.3.4
1. cd qtopia-core-opensource-src-4.3.4
2. ./configure -prefix $PWD/build -release -shared -fast -pch -no-qt3support -qt-sql-sqlite -no-libtiff -no-libmng -qt-libjpeg -qt-zlib -qt-libpng -qt-freetype -no-openssl -nomake examples -nomake demos -nomake tools -no-nis -no-opengl -no-cups -no-xcursor -no-xfixes -no-xrandr -no-xrender -no-xkb -no-sm -no-xinerama -no-xshape -no-separate-debug-info -xplatform qws/linux-arm-g++ -embedded arm -depths 16 -no-qvfb -qt-gfx-linuxfb -no-gfx-qvfb -no-kbd-qvfb -no-mouse-qvfb -qt-kbd-usb -confirm-license -qt-mouse-tslib -I/home/lcc/project/qt/tslib-1.4/build/include -L/home/lcc/project/qt/tslib-1.4/build/lib
需要注意qte4.3.4配置时比qte4.4.3少了两个参数-optimized-qmake -no-phonon。
qte4.3.4不支持-no-phonon这个参数,这个参数的意义是不编译Phonon模块。如果加上的话会出现这个错误:
-no-phonon: invalid command-line switch
-qt-gfx-linuxfb: unknown argument
-no-gfx-qvfb: unknown argument
-no-kbd-qvfb: unknown argument
-no-mouse-qvfb: unknown argument
-qt-kbd-usb: unknown argument
-qt-mouse-tslib: unknown argument
后面几个参数本来是没什么问题的,在此捎带着也受牵连了。
qte4.3.4支持-optimized-qmake这个参数,但是加上这个参数之后在configure的时候会出现一堆segmentation fault,这个问题也有可能是我的环境有问题?不知道有没有人碰到过。
3. make
4. make install
ps: 如果前一次configure成功,可以make confclean然后重新configure。但是如果前一次configure失败了,最好是删掉整个目录重新解压再configure。
ps2:注意系统中gcc版本的高低以及交叉编译链的版本,否则会出现问题。系统gcc的版本不能太低。在gcc3.2.2@redhat9里编译qt-embedded-linux-opensource-src-4.4.3就出现了一些很奇怪的问题。
Tuesday, May 5, 2009
tslib的编译
首先在编译tslib之前需要确保安装了autoconf, automake, libtool这几个工具,否则会在编译的时候报错。错误信息如下:
1、如果autoconf和automake未安装,对于tslib-1.4会指示无法识别autogen.sh文件第4行的autoreconf指令。
2、如果未安装libtool工具,则会提示
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 186.
Use of uninitialized value $libtoolize in pattern match (m//) at /usr/bin/autoreconf line 186.
configure.ac:25: error: possibly undefined macro: AC_DISABLE_STATIC
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:26: error: possibly undefined macro: AC_ENABLE_SHARED
configure.ac:27: error: possibly undefined macro: AC_LIBTOOL_DLOPEN
configure.ac:28: error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
因此,可以在以下步骤之前先执行以下两条指令:
apt-get install autoconf automake
apt-get install libtool
一、tslib-1.3
1. cd tslib-1.3
2. export PREFIX=$PWD/build
3. export CC=arm-linux-gcc
4. ./autogen.sh
5. ./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache --enable-inputapi=no
6. vi plugins/Makefile
将LDFLAGS :=$(LDFLAGS) -rpath $(PLUGIN_DIR)修改为
LDFLAGS :=$(LDFLAGS) -rpath `cd $(PLUGIN_DIR) && pwd`
如果没有此步骤,在make的时候会出现libtool:link: only absolute run-paths are allowed错误
7. make
8. make install
二、tslib-1.4
1. cd tslib-1.4
2. ./tslib-compile.sh
将tslib-1.4的编译过程写成脚本tslib-compile.sh 以方便编译。
附: tslib-compile.sh
export PREFIX=$PWD/build
export CC=arm-linux-gcc
#/*
# *autogen.sh is an important .sh file£?it produce ./configure file according to current env setting
# */
./autogen.sh
echo "ac_cv_func_malloc_0_nonnull=yes" >arm-linux.cache
#/*(it is better to see what parameter that the ./configure program take,use "./configure --help")
# *you can add "--enable-debug"([default=no]),and/or "--enable-static"([default=no])
# */
./configure --host=arm-linux --prefix=$PREFIX --cache-file=arm-linux.cache --enable-inputapi=no
make
make install
ps: 需要注意系统使用的libtool的版本不能太低,可以使用libtool --version查看。如在Red Hat 9里面的libtool版本为1.4.3,编译tslib-1.3没问题,但是编译tslib-1.4时会出现错误:
configure.ac:57: error: possibly undefined macro: AS_HELP_STRING
测试环境:
VMware 5.5.1 & Ubuntu 8.10 & arm-linux-gcc-3.4.6-glibc-2.3.6 & libtool 2.2.4
Monday, May 4, 2009
非编码矩阵键盘扫描算法
1、独立连接式键盘每一个按键占用一个I/O引脚。优点是结构简单,使用方便;缺点是随着按键数的增加,被占用的I/O口线也将增加。所以不适合在按键较多的情况下使用。如图1所示。
2、矩阵式键盘适合采用动态扫描的方式进行识别。优点是节省端口,缺点是编程麻烦。适合按键较多的场合。如图2所示。


1、编码键盘能够由硬件自动提供与被按键对应的ASCII码或其它编码。内部设有键盘编码器,能识键、生成键码、去抖、防串键。
2、非编码键盘则仅提供行和列的矩阵,其硬件逻辑与按键编码不存在严格的对应关系,而要由所用的程序来确定。通常只提供键盘矩阵,按键的识别、键码的提供由软件来完成。
三、非编码矩阵键盘扫描
对于编码式键盘,可以直接通过其预留的接口读取按键值即可。对于非编码式矩阵键盘,需要自己扫描得到按键的值,通常采用的方法是行扫描法和线反转法两种方法。
(1)行扫描法
行列扫描法可以分两步:
step 1.判断是否有按键按下进行全扫描,将所有行线置成低电平;然后扫描全部列线,如果扫描的列值全是高电平,则说明没有任何一个键被按下;如果读入的列值不是全1,则说明有键按下。在只有单键的情况并可以得到列线值。
step 2.判断那一行的按键被按下用逐行扫描的方法确定哪一个键被按下。先扫描第一行,即置该行为低电平,其他行为高电平,然后检查列线,如果某条列线为低电平,则说明第一行与该列相交的位置上的按键被按下;如果所有列线全是高电平,则说明第一行没有键被按下,接着扫描第二行,以此类推,直到找到被按下的键。
(2)线反转法
线反转法需要两步:
step 1.将列线作为输出线,行线作为输入线。置输出线全部为0,此时行线中呈低电平0的为按键所在行,如果全部都不是0,则没有按键按下。
step 2.将行线作为输出线,列线作为输入线。置输出线全部为0,此时列线呈低电平的为按键所在的列。这样,就可以确定了按键的位置(X,Y)。
四、行扫描法和线反转法的区别
1、线反转法需要接键盘的IO口必须是双向的,而行扫描法列线输入,行线输出,单向IO就可以完成。
2、线反转法要求键盘的两端都上拉(如图3所示),如果IO可以支持内部上拉模式的话可以在软件上设置寄存器开启上拉模式(对于Atmega8需要设置DDRxn,PORTxn,PUD(SFIOR))。而行扫描法只需要列线上拉就可以了。
图3
单键行扫描方式的代码如下:
//single key scan function
void KeyScan()
{
U8 data=0xFF;
U8 tmp=0xFF;
U8 line,row;
int i=0,j=0;
unsigned char SendBuffer[2];
SetDataLow(0xFF); //set line high level
tmp = GetDataLow(); //get the key
if(0xFF!=tmp)
{
Delay(100);
tmp = GetDataLow();
if(tmp==0xFF) //avoid dithering
{
//putchar(0x99);
return;
}
line = CheckBit(~tmp);
for(i=0; i<8; i++) //scan begin here
{
SetDataLow(i);
data = GetDataLow(); //get the key
if(data == tmp)
{
row=i;
break;
}
else
{
}
}
SendKeyDownCode(KeyMap[line][row]);
while(0xFF!=GetDataLow()); //wait until this key is up
SendKeyUpCode(KeyMap[line][row]);
}
}
Thursday, April 30, 2009
orocos-bfl-0.6.1编译过程
web site: http://www.orocos.org/bfl
编译过程如下
1. tar -xjvf orocos-bfl-0.6.1-src.tar.bz2#解压
2. cd orocos-ocl-1.8.0
3. mkdir build
4. ccmake ..
需要修改以下几项:
BUILD_EXAMPLES->ON #编译例子
BUILD_TESTS->ON #编译测试程序
CMAKE_EXE_LINKER_FLAGS->-ldl #设置动态链接库
MATRIX_LIB->boost #数学运算库设为boost
RNG_LIB ->boost #随机数产生器库设为boost
__MATRIXWRAPPER_BOOST__->ON
__RNGWRAPPER_BOOST__ ->ON
接着按[c]->[e],如果没有错误,则按[g]产生Makefile并退出
5. make #生成的库文件
6. make check #测试安装结果
7. make install #拷贝头文件到/usr/local/include/ocl,拷贝库文件到/usr/local/lib/以及拷贝orocos-bfl.pc到usr/local/lib/pkgconfig/orocos-bfl.pc
更详细的编译参数和设置可参考http://people.mech.kuleuven.be/~tdelaet/bfl_doc/installation_guide/installation_guide.html
Ubuntu 8.10下配置telnet服务
2. 安装成功后,系统会自动添加
telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
到/etc/inetd.conf。如果没加进去需要手动添加一下。
3. vi /etc/xinetd.conf
添加红色部分:
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/
defaults
{
# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
includedir /etc/xinetd.d
4. vi /etc/xinetd.d/telnet
添加红色部分:
# default: on
# deion: The telnet server serves telnet sessions; it uses \
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
}
5. /etc/init.d/xinetd restart
接下来就可以使用telnet远程登录了。
更详细的设置可参考http://www.cnblogs.com/Huntercat/archive/2008/06/23/1228222.html
Ubuntu 8.10的网络问题
进虚拟机一看,网络不通,ifconfig可以看到网络,但是连自己的ip也ping不通,提示
connect: network is unreachable
运行/etc/init.d/network restart确提示:
SIOCADDRT: No such process
在system->administrator->network configuration下手动配置静态IP地址,提示无法更改设置,错误信息如下:
Updating connection failed: nm-ifupdown.connection.c.82-connection update not supported (read only).."
可能是network-manager出了问题,但是先在网络不通想要升级一下network-manager都不能。正好看到网上有人说8.10的networkmanager是有bug,所以索性把network-manager卸掉吧。
1. apt-get remove network-manager
2. vi /etc/network/interfaces
添加:
auto eth0
iface eth0 inet static #静态IP
address 192.168.0.201 #内网地址
netmask 255.255.255.0 #子网掩码
gateway 192.168.0.55 #网关
3. vi /etc/resolv.conf
添加:
nameserver 202.112.128.51 #配置DNS
4. /etc/init.d/network restart #如果还是失败就reboot一下吧
VMware错误之无法启动
————————————————————————
VMware Workstation unrecoverable error:(vmui)
Unable to create VmappPoll object:没有注册类别.
Reinstalling VMware Workstation may help.
A log file is available in "C:\Documentes and Settings\Administrator\Local Settings\Temp\vmware-administrator\vmware-Administrator-XXX.log". A core file is available in "C:\Documentes and Settings\Administrator\Application Data\VMware\vmware-XXX.dmp". Please request support and include the contents of the log file and core file.
To collect files to submit to VMware support, run cscript vm-support.vbs. We will respond on the basis of your support entitlement.
————————————————————————
我昨天搞了一些启动项和系统服务的优化,不会这么巧和VMware有关吧,记得没有修改VMware相关的设置啊。。。。于是按照提示信息卸载重装。但是重装完还是未果。在网上查到如下解决方案:
在你的VMware安装目录下,就是和vmware.exe同一级的目录下创建一个文本文档,更名为:error.bat。输入以下内容:
regsvr32.exe vmappsdk.dll
regsvr32.exe vmdbCOM.dll
regsvr32.exe vmnetBridge.dll
然后再双击运行error.bat。结果还是未果。
于是抱着侥幸的心理重启系统,居然可以正常打开了。看来更改系统设置之后最好还是重启一下。。。
Thursday, April 23, 2009
orocos-kdl-1.0.0编译过程
web site: http://www.orocos.org/kdl
在此网站上并只有非常老的版本的源码包(最新的为0.4版的)下载,对于新版本只是提供了一个SVN地址:
http://svn.mech.kuleuven.be/repos/orocos/trunk/kdl
可以使用svn客户端直接check out源代码即可。
下面介绍其编译过程。
1. cd kdl #进入kdl源码目录
2. mkdir build #建立编译文件夹
2. cd build
3. ccmake .. #设置参数
4. press [t] to advanced mode and then change some flags #修改参数
a) modify OROCOS_INSTALL to /usr/local
b) modify CMAKE_INSTALL_PREFIX to /usr/local
c) enable OROCOS_PLUGIN
d) enable BUILD_TESTS
e) specify OROCOS_INSTALL directory
f) add "-ldl" to "CMAKE_EXE_LINKER_FLAGS"
g) configure (press c) #这是会生成configure信息,可根据信息判断那些参数可能设置有问题
5. Generate (press g) #生成Makefile
6. make #编译
7. make docs #生成文档
8. make install #安装头文件和库
如果修改参数步骤中没有g这一步骤,make的时候会如下错误信息:
Linking CXX executable framestest
/usr/local/lib/libcppunit.so: undefined reference to `dlsym'
/usr/local/lib/libcppunit.so: undefined reference to `dlopen'
/usr/local/lib/libcppunit.so: undefined reference to `dlclose'
cppunit是在测试程序中使用的,所以如果没有使能BUILD_TESTS的话就算没有g也是可以编译通过的。
当然了还有一种可能是/usr/lib/libdl.so出问题了,这个库文件是glibc里的,所以需要重新装一下glibc。在ubuntu下只需要apt-get install build-essential即可。
还有一些编译细节可以参考kdl/INSTALL,ccmake的使用可以在进入之后按[h]键查看帮助。
ps: 从ccmake里面显示的KDL_VERSION和kdl/src目录下的.hpp文件里面的信息都显示使用的kdl版本是1.0.0
测试环境:
VMware 5.5.1 & Ubuntu 8.10 & gcc4.3.2
Wednesday, April 22, 2009
orocos-ocl-1.8.0编译过程
web site: http://www.orocos.org/ocl
编译过程如下
1. tar -xjvf orocos-ocl-1.8.0-src.tar.bz2 #解压
2. cd orocos-ocl-1.8.0 #进入源代码目录
3. cmake . #生成Makefile,在Linux标准平台上使用默认参数即可
4. make #生成的库文件放在各个组件自己的根目录下
5. make install #拷贝头文件到/usr/local/include/ocl,拷贝库文件到/usr/local/lib/以及拷贝orocos-ocl-gnulinux.pc到usr/local/lib/pkgconfig/orocos-ocl-gnulinux.pc
6. make docapi dochtml docpdf
这个命令需要安装一下几个包:
apt-get install doxygen
apt-get install graphviz
apt-get install docbook
apt-get install xmlto
docapi命令在orocos-ocl-1.8.0/doc/api目录下生成API文档
dochtml命令在orocos-ocl-1.8.0/doc/xml目录下生成OCL文档
docpdf 命令生成pdf文档,但是docpdf需要apache fop工具,装起来依赖的包比较多比较占空间,所以就没装。
详细的编译参数和设置可参考orocos-ocl-1.8.0/README
测试环境:
VMware 5.5.1 & Ubuntu 8.10 & gcc4.3.2
orocos-rtt-1.8.0编译过程
web site: http://www.orocos.org/rtt
编译过程如下:
1. tar -xvjf orocos-rtt-1.8.0-src.tar.bz2 #解压
2. mkdir orocos-rtt-1.8.0/build #创建编译目录
3. cd orocos-rtt-1.8.0/build #进入编译目录
4. ../configure --with-
5. make #生成的库文件存放在build/src目录下,liborocos-rtt-gnulinux.so.1.8.0
6. make install #拷贝头文件到/usr/local/include/rtt/目录,有一部分boost相关。
make install时并没有看到liborocos-rtt-gnulinux.so.1.8.0被拷贝到/usr/local/lib目录下,看了修改时间也不是make install的时间,估计是make的时候直接生成然后放到/usr/local/lib目录下了,留待下次重新编译的时候验证。
详细的编译参数设置可参考:
1.orocos-rtt-1.8.0/README
2.http://www.orocos.org/stable/documentation/rtt/v1.8.x/doc-xml/orocos-installation.html
测试环境:
VMware 5.5.1 & Ubuntu 8.10 & gcc4.3.2
cppunit-1.12.1编译过程
web site: http://sourceforge.net/projects/cppunit/
由于是在Linux标准平台下使用,所以很多参数比如CC,CXX,--prefix等环境变量和参数使用默认的参数即可,基本上不需要制定编译参数,因此整个编译比较简单。
编译过程如下:
1. cd /home/lcc/share/cppunit-1.12.1 #进入源码目录
2. ./configure #生成Makefile
3. make #编译,生成的库文件放在cppunit-1.12.1/src/cppunit/.libs目录下
4. make intsall #将头文件拷贝到/usr/local/include/cppunit/目录,并将库文件拷贝到/usr/local/lib/目录下,接着拷贝文档,最后拷贝了几个工具和配置文件到相应的目录下面,如下所示:
test -z "/usr/local/bin" /bin/mkdir -p "/usr/local/bin"
/usr/bin/install -c 'cppunit-config' '/usr/local/bin/cppunit-config'
test -z "/usr/local/share/aclocal" /bin/mkdir -p "/usr/local/share/aclocal"
/usr/bin/install -c -m 644 'cppunit.m4' '/usr/local/share/aclocal/cppunit.m4'
test -z "/usr/local/share/man/man1" /bin/mkdir -p "/usr/local/share/man/man1"
/usr/bin/install -c -m 644 './cppunit-config.1' '/usr/local/share/man/man1/cppunit-config.1'
test -z "/usr/local/lib/pkgconfig" /bin/mkdir -p "/usr/local/lib/pkgconfig"
/usr/bin/install -c -m 644 'cppunit.pc' '/usr/local/lib/pkgconfig/cppunit.pc'
详细的configure参数和编译设置可参看cppunit-1.12.1更目录下的INSTALL,INSTALL-unix和INSTALL-WIN32.txt文件
测试环境:
VMware 5.5.1 & Ubuntu 8.10 & gcc4.3.2
xerces-c-src_2_6_0编译过程
web site: http://xml.apache.org/xerces-c/
编译过程如下:
1. export XERCESCROOT=/home/lcc/share/xerces-c-src_2_6_0 #设置环境变量
2. cd ./xerces-c-src_2_6_0/src/xercesc #进入源码目录
3. ./runConfigure -plinux -cgcc -xg++ -minmem -nsocket -tnative -rpthread #运行configure脚本生成Makefile,runConfigure设置了一些特定的环境变量和编译标志并调用configure生成Makefile
4. make #生成的链接库放在xerces-c-src_2_6_0/lib目录下
5. make install #将头文件拷贝到usr/local/include/xercesc/并将生成的动态链接库拷贝到/usr/local/lib/目录下
编译参数的详细设置可参考xerces-c-src_2_6_0/doc/html/build-winunix.html
测试环境:
VMware 5.5.1 & Ubuntu 8.10 & gcc4.3.2
boost_1_38_0编译过程
web site: http://www.boost.org/
编译过程如下:
一.Window环境
1. 运行cmd
2. cd boost_1_38_0\tools\jam\src @进入jam源码目录
3. build.dat vc8 @针对VS2005编译
4. copy bin.ntx86\bjam.exe ..\..\.. @将bjam文件拷贝到顶层目录下
5. cd ..\..\.. @回到顶层目录
6. bjam.exe --build-dir=.\build --toolset=msvc-8.0 stage
更详细的编译参数可参考boost_1_38_0/more/getting_started/windows.html
二.Linux环境
1. cd ~/share/boost_1_38_0 #进入boost源码目录
2. cd tools/jam/src/ #进入jam源码目录
3. ./build.sh gcc #在当前目录下的bin.linuxx86生成bjam文件
4. cp ./bin.linuxx86/bjam ../../../ #将bjam文件拷贝到顶层目录下
5. cd ../../.. #回到顶层目录
6. ./bjam --build-dir=$PWD/build --toolset=gcc --build-type=release stage #生成的库文件存放在boost_1_38_0/stage/lib/目录下
更详细的编译参数可参考boost_1_38_0/more/getting_started/unix-variants.html
测试环境:
Windows XP Professional SP2 & VS2005
VMware 5.5.1 & Ubuntu 8.10 & gcc4.3.2
关于cannot open shared object file no such file or directory错误
1.将库的路径加入/etc/ld.so.conf
echo "/usr/local/lib" >>ld.so.conf
ldconfig
2.软连接
如果是一两个库的话可以直接建立软连接到/usr/lib目录,比如:
ln -s /usr/local/lib/libstdc++.so.5 /usr/lib/libstdc++.so.5
3. 设置LD_LIBRARY_PATH
vi .bash_profile(or .bashrc)
加入以下内容:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH
:wq
source ~/.bash_profile(or source ~/.bashrc)
OCL-1.8.0和RTT-1.8.1的版本匹配问题
root@itmlcc:/home/lcc/share/orocos-ocl-1.8.0# make
Use: make docapi dochtml docpdf to build the documentation.
[ 0%] Built target message
[ 5%] Building CXX object ocl/CMakeFiles/orocos-ocl-common-gnulinux.dir/ocltoolkit.o
[ 11%] Building CXX object ocl/CMakeFiles/orocos-ocl-common-gnulinux.dir/HMIConsoleOutput.o
Linking CXX shared library liborocos-ocl-common-gnulinux.so
[ 11%] Built target orocos-ocl-common-gnulinux
[ 16%] Building CXX object taskbrowser/CMakeFiles/orocos-taskbrowser-gnulinux.dir/TaskBrowser.o
Linking CXX shared library liborocos-taskbrowser-gnulinux.so
[ 16%] Built target orocos-taskbrowser-gnulinux[ 22%] Building CXX object timer/CMakeFiles/orocos-timer-gnulinux.dir/TimerComponent.o
Linking CXX shared library liborocos-timer-gnulinux.so
[ 22%] Built target orocos-timer-gnulinux
[ 27%] Building CXX object helloworld/CMakeFiles/helloworld.dir/HelloWorld.o
Linking CXX executable helloworld
../ocl/liborocos-ocl-common-gnulinux.so.1.8.0: undefined reference to `RTT::OS::StartStopManager::startFunction(boost::function
collect2: ld returned 1 exit status
make[2]: *** [helloworld/helloworld] Error 1
make[1]: *** [helloworld/CMakeFiles/helloworld.dir/all] Error 2
make: *** [all] Error 2
由于使用的是orocos-rtt-1.8.1,在/usr/local/lib/目录下并没有liborocos-ocl-common-gnulinux.so.1.8.0,而只有liborocos-ocl-common-gnulinux.so.1.8.1,尝试将liborocos-ocl-common-gnulinux.so.1.8.1软连接为liborocos-ocl-common-gnulinux.so.1.8.0,重新编译问题照旧。查看liborocos-ocl-common-gnulinux.so.1.8.1的内容:
root@itmlcc:/home/lcc/share/orocos-ocl-1.8.0# nm -C /usr/local/lib/liborocos-rtt-gnulinux.so.1.8.1 grep RTT::OS::StartStopManager::startFunction
002f2d20 T RTT::OS::StartStopManager::startFunction(boost::function
可以看到RTT::OS::StartStopManager::startFunction函数的参数和orocos-ocl-1.8.0需要的并不完全一致。
于是重新编译了orocos-rtt-1.8.0,发现和orocos-ocl-1.8.0是匹配的,没上面的这个错误了,nm的结果也是正确的。
目前rtt更新到了1.8.2,而最新的ocl却只是1.8.0的。
而orocos的网站上也对于orocos-ocl-1.8.0的包给出了如下解释:
A tarball of the current stable version (works with RTT-1.8.x)
也就是说OCL-1.8.0可以和RTT-1.8.x工作。
如今实测得到的结果说明并不是向他们所说的一样兼容。
Sunday, April 19, 2009
ubuntu 8.10安装ssh,vsftpd,tftp服务
ubuntu 8.10默认没有安装ssh服务,需要手动安装ssh服务。通过SSH可以远程安全的登陆到服务器端。
1.apt-get install ssh
2./etc/init.d/ssh restart
这样就可以使用putty和xshell等工具通过ssh端口远程登陆了。
二. vsftpd
vsFTPD是一款小巧易用FTP服务器程序,可以很方便的在各个网络设备间传输文件。
1. apt-get install vsftpd #自动创建/home/ftp目录,此目录是匿名账号登陆的根目录
2. vi /etc/vsftpd.conf
需要注意设置以下几项:
#anonymous_enable=YES #使能匿名账号,默认根目录为/home/ftp,注释掉这一行即可阻止匿名账号登陆,
local_enable=YES #使能本地账号,使用账号名和密码进行登陆
chroot_local_user=YES #将本地账号的目录严格限制在该用户的的主目录下
3. /etc/init.d/vsftpd restart
这样就可以使用Xftp,FlashFXP等ftp客户端软件登陆ftp服务器了。
三.tftp
tftp是一个简单的文件传输协议。在很多bootloader中使用它来传输内核和根文件系统。
1. apt-get install tftpd tftp xinetd
2. vi /etc/xinetd.d/tftp
在文件中输入以下内容:
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
3. mkdir /tftpboot
4. chmod 777 -R /tftpboot
5. vi /etc/inetd.conf
改为如下内容:
tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot
6. /etc/init.d/xinetd restart
7. in.tftpd -l /tftpboot
ubuntu 8.10的samba服务配置
Vmware虚拟机下使用samba服务可以很方便的实现windows xp和Linux下的文件夹。以下简述今天在ubuntu 8.10上配置samba服务的过程。
1.sudo apt-get insall samba2.mkdir ~/share
3.chmod -R 777 ~/share
4.cp /etc/samba/smb.conf /etc/samba/smb.conf.bak5.vi /etc/samba/smb.conf
在smb.conf最后添加
[share]
path = /home/username/share
available = yes
browsealbe = yes
public = yes
writable = yes
6.touch /etc/samba/smbpasswd
7.smbpasswd -a USERNAME
-a参数为添加用户,此处将USERNAME替换为需要的用户名。
此命令会要求你输入samba帐户的密码
New SMB password:
Retype new SMB password:
8./etc/init.d/samba restart
vim下syntax on和光标键问题
今天使用刚安装的ubuntu 8.10,为了增加vim里的语法高亮 ,在.vimrc里加了syntax on,结果却并没有得到语法加亮的效果而且每次vi文件都会提示syntax指令不正确,而且还有一个问题是在INSERT模式下上下左右键并不是预想的光标移动,而会分别出现ABCD这几个字符,一开始还怀疑是键盘方案选错了。。。
分析:
ubuntu 预设的vim是精简版的,重新安装vim即可解决以上问题。
步骤:
1.apt-get install vim
2.touch ~/.vimrc
3.vi ~/.vimrc,在其中添加syntax on