Thursday, April 30, 2009

orocos-bfl-0.6.1编译过程

BFL是OROCOS工程的一个库,全称为BAYESIAN FILTERING LIBRARY。BFL库的需要一个数学运算库和一个随机数产生器库,在此我们已经安装过boost库,所以就直接使用boost库了。
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服务

1. apt-get install xinetd telnetd
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的网络问题

昨天到早上远程SSH登陆另外一台电脑上的虚拟机上的Ubuntu时突然连不上了,前一天晚上走的时候还是好好的。。。
进虚拟机一看,网络不通,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,双击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编译过程

KDL是OROCOS工程的一个库,其全称为Kinematics and Dynamics Library。
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编译过程

OCL是OROCOS工程的一个组件库,全称为Orocos Component Library。
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编译过程

RTT是orocos工程一个组成部分,全称为Real-Time Toolkit。
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- [--prefix=/usr/local][--with-linux=/usr/src/linux] #配置参数并生成Makefile文件,target不指定的话默认为gnulinux,别的几个参数在标准Linux平台上采用默认值即可,在此直接使用../configure即可
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编译过程

cppunit是一个强大的单元测试库。
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编译过程

Xerces-C是一个非常健壮的XML解析器,它提供了验证,以及SAX和DOM API。
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编译过程

boost是一个完全符合C++规范的代码库,
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错误

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的版本匹配问题

使用orocos-rtt-1.8.1,在编译orocos-ocl-1.8.0时产生了以下错误:

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服务

一. SSH
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 samba

2.mkdir ~/share

3.chmod -R 777 ~/share

4.cp /etc/samba/smb.conf /etc/samba/smb.conf.bak

5.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

Monday, April 13, 2009

test

Just test this blog!