2011年5月26日 星期四

ubuntu gcc 4.4.3 降級 gcc 4.3

1、安装gcc-4.3
$ sudo apt-get install gcc-4.3 g++-4.3
2、修gcc相关链接
$ cd /usr/bin
$sudo ln -snf gcc-4.3 gcc
$sudo ln -snf g++-4.3 g++
$sudo ln -snf cpp-4.3 cpp
3、如是64bit系统,则还需装如下包。
$ sudo apt-get install g++-multilib g++-4.3-multilib

ref: http://www.ways2u.com/?post=163

gcc 4.3 gcc 3.4 快速切換
使用 update-alternatives 工具
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-3.4 30
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-4.4 40

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-3.4 30
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.4 40

sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-3.4 30
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.4 40

設定後 sudo update-alternatives --config gcc

Selection Path 優先級 Status
------------------------------------------------------------
0 /usr/bin/gcc-3.4 40 auto mode
* 1 /usr/bin/gcc-3.4 40 manual mode
2 /usr/bin/gcc-4.4 30 manual mode

Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/bin/gcc-4.4 to provide /usr/bin/gcc (gcc) in manual mode.
可看到版本切換摟

look: gcc -v
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)


2011年5月23日 星期一

Fedora 9設置nfs

以 root 身份登录Fedora9,在命令行运行:
#gedit /etc/exports
编辑nfs 服务的配置文件(注意:第一次打开时该文件是空的),添加以下内容:
/opt/abc/123 *(rw,sync,no_root_squash)
其中:
/opt/abc/123 表示将要共享的的目录,它可以作
为开发板的根文件系统通过nfs 挂接;
* 表示所有的客户机都可以挂接此目录
rw 表示挂接此目录的客户机对该目录有读写的权力
no_root_squash 表示允许挂接此目录的客户机享有该主机的root 身份

,但默认安装的Fedora 系统开启了防火墙,这会导致NFS 服务
无法正常使用。因此先关闭防火墙,在命令行输入“lokkit”命令
选择其中(*)Disabled,然后选择“OK”退出,这样就永久的关闭了防火墙。
下面是启动 NFS 服务的方法和步骤:

(1)通过命令启动和停止nfs 服务
在命令行下运行:
#/etc/init.d/nfs start

这将启动nfs 服务,可以输入以下命令检验nfs 该服务是否启动。
# mount -t nfs localhost:/opt/abc/123 /mnt/
如果没有出现错误信息, 您将可以浏览到/mnt 目录中的内容和
/opt/FriendlyARM/mini6410/root_qtopia_qt4 是一致的。
使用这个命令可以停止 nfs 服务:
#/etc/init.d/nfs stop
(2)通过图形界面启动NFS 服务
为了在每次开机时系统都自动启动该服务,可以输入
# serviceconf
打开系统服务

2. 修改/etc/hosts.allow

sshd:ALL

portmap:192.168.10.0/255.255.255.0:allow

portmap:ALL:deny

nfsd:192.168.10.0/255.255.255.0

3. 启动Fedora 9 nfs server

[root@localhost v2.0]# service nfs start.如果在启动之后需要修改exports,可以exportfs -rv重新输出.

4. 可以在本机测试[root@localhost v2.0]# mount -t nfs 192.168.10.6:/pub /var/nfs

5. 在目标板上运行.下面是我第一次在目标板上运行的结果,查询了之后发现是防火墙的问题.

[root@falinux ~]$ mount -t nfs -o nolock 192.168.10.6:/home/leffy/edfa/v2.0 /mnt/win

mount: RPC: Unable to receive; errno = No route to host

mount: nfsmount failed: Bad file descriptor

mount: Mounting 192.168.10.6:/home/leffy/edfa/v2.0 on /mnt/win failed: Bad file descriptor

6. 关闭防火墙[root@localhost v2.0]# service iptables stop[root@localhost v2.0]# service iptables statusiptables: Firewall is not running.

可以看到防火墙已经半闭以上Fedora 9 nfs系统介绍.


ref:http://www.router.net.cn/Article/41302.html

2011年5月11日 星期三

Qt 樹狀結構圖

Qt 發展樹狀結構圖
http://mapyourinfo.com/wiki/zh.wikipedia.org/Qt/

Mjpeg Webcam

裝置:uvc webcam
軟體:v4l2
Download : mjpeg.tar.bz2
make

xxx@xxx-desktop:~/mjpeg/mjpg-streamer-r63$ ./mjpg_streamer
MJPG Streamer Version.: 2.0
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 640 x 480
i: Frames Per Second.: 5
i: Format............: MJPEG
Unable to set format: Invalid argument
Init v4L2 failed !! exit fatal
i: init_VideoIn failed
xxx@xxx-desktop:~/mjpeg/mjpg-streamer-r63$ ./mjpg_streamer -i "input_uvc.so -d /dev/video0 -y" -o "output_http.so"
MJPG Streamer Version.: 2.0
i: Using V4L2 device.: /dev/video0
i: Desired Resolution: 640 x 480
i: Frames Per Second.: 5
i: Format............: YUV
i: JPEG Quality......: 80
o: www-folder-path...: disabled
o: HTTP TCP port.....: 8080
o: username:password.: disabled
o: commands..........: enabled


*******************************web browser
The command for mplayer i am using is mplayer -nocache -demuxer lavf "http://localhost:8080/?action=stream&ignored.mjpg"

2011年5月9日 星期一

eclipse for qt java install


A Download
i、 下載JRE(Java Runtime Environment) 。(http://java.sun.com/javase/downloads/index.jsp)
安裝JRE


... /usr/local ]#chmod +x jxx-linux-i586-rpm.bin

... /usr/local ]#./jxxx-linux-i586-rpm.bin
產生/usr/local/jdk1.6.0_25
修改路徑
$gedit /etc/profile
...
export JAVA_HOME=/usr/local/jdk1.6.0_25
export JRE_HOME=/usr/local/jdk1.6.0_25/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME;lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
...
umask 022
測試是否成功
source /ect/profile
沒任何提示表示成功

ii. (測試Java是否安装成功)
[root@localhost ~]#java –version
http://www.cnblogs.com/images/cnblogs_com/oomusou/JRE3.jpg

iii. download g++
sudo apt-get install build-essential
輸入 gcc,出現“gcc: no input files”,安裝成功!

iv. 下載qt framework
步驟如下連結

v. 下載 qt and eclipse
tar vxfz qt-eclipse-integration-linux.x86-1.6.1.tar.gz 後先保留後面步驟使用

linux下eclipse的安装
for c/c++
(下載eclipse-linuxtools-helios-SR2-incubation-linux-gtk)
(解壓後eclipse-SDK-3.2.1-linux-gtk.tar.gz)執行



我是安裝c/c++ eclipse 為了整合qt 之用
安裝步驟如上連結且測試了Hello World 發覺eclipse 真是酷也 接下來qt 整在一起吧
install CDT
或者打開eclipse install new software :
選擇或鍵入 http://download.eclipse.org/tools/cdt/releases/helios 此相關pending 後勾選全部下載

接下來qt framework 我解壓縮放在如 上 A 第iv 點make 路徑:/usr/local/Trolltech

A v步驟後: 裡面會和 eclipse的資料夾裡features和plugins兩個資料夾,分別將這兩資料夾內的內容放置你Eclipse(以我為 例我的Eclipse放置/opt/Eclipse)相對應的資料夾內(Eclipse中也有features和plugins兩個資料夾),然後啟動 Eclipse,即可。這樣QT就整合完成了。

重起eclipse 後請設好路徑
version name: 4.7.3
Bin path: /usr/local/Trolltech/Qt-4.7.3/bin
Include: /usr/local/Trolltech/Qt-4.7.3/include

**********************************
最後注意 開發專案
c\c++ 要include Trollech lib compiler:Gnu\g++
qmake -project
qmake
make
Run
QT console compiler: Gun\ g++
qmake -project
qmake
make
Run
參考資料: