ubuntu下安装sourcenav过程

ubuntu10.04默认安装gcc编译器是4.4版本
sourcenav-6.0.tar.gz是Linux下的源代码查看器的源代码文件。通过下载sourcenav-6.0.tar.gz来进行安装。
下载地址:
http://nchc.dl.sourceforge.net/project/sourcenav/sourcenav/6.0/sourcenav-6.0.tar.gz

在Linux下从源文件安装程序时,有一个通用模式,即配置(./configure)–> 编译(make) –>安装.
编译sourcenav-6.0系统默认的gcc4.4编译通不过,需要安装gcc4.0以下版本。ubuntu环境下不同gcc版本可以共存,不需要卸载gcc高版本。

1、重新安装低版本gcc
我安装的版本是gcc3.4版本
1)安装gcc3.4版本
sudo apt-get install gcc-3.4
2)将将gcc3.4缺省gcc
先查看一下ubuntu是否存在两个版本
ls /usr/bin/gcc* -ll
将gcc3.4缺省gcc
ln -sf /usr/bin/gcc-3.4 /usr/bin/gcc
编译sourcenav完成后,在将gcc4.4设为缺省gcc


2、sourcenav编译和安装
1)安装必要组件
sudo apt-get install libx11-dev
1)解压文件
tar -xzvf sourcenav-6.0.tar.gz
解压后在当前目录下会生成sourcenav-6.0目录,然后进入该目录
cd sourcenav-6.0
2)configure 一些选项, 比如安装目标路径
sudo mkdir /usr/share/sourcenav
5. 执行./configure --prefix=/usr/share/sourcenavigator.
将该软件所有的文件都被复制到这个目录
不指定prefix,可执行文件默认放在/usr /local/bin,库文件默认放在/usr/local/lib,配置文件默认放在/usr/local/etc。
其它的资源文件放在/usr /local/share。要卸载这个程序,要么在原来的make目录下用一次make uninstall(前提是make文件指定过uninstall),
要么去上述目录里面把相关的文件一个个手工删掉。
3)编译
make
4)安装
make install


3、启动SourceNavigator出错问题
cd  /usr/share/sourcenavigator
./snavigator
启动sourcenavigator时,出现如下问题
Can't find a usable tk.tcl in the following directories:
     /usr/local/share/tk8.3

/usr/local/share/tk8.3/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
     while executing
"bind Listbox {
     %W yview scroll [expr {- (%D / 120) * 4}] units
}"
     (file "/usr/local/share/tk8.3/listbox.tcl" line 182)
     invoked from within
"source [file join $tk_library listbox.tcl]"
     invoked from within
"if {[string compare $tcl_platform(platform) "macintosh"] && \
     [string compare {} $tk_library]} {
     source [file join $tk_library button.tcl]
     so..."
     (file "/usr/local/share/tk8.3/tk.tcl" line 308)
     invoked from within
"source /usr/local/share/tk8.3/tk.tcl"
     ("uplevel" body line 1)
     invoked from within
"uplevel \#0 [list source $file]"
This probably means that tk wasn't installed properly.

注意上面的第10行:file “/usr/local/share/tk8.3/listbox.tcl” line 182
$sudo gedit /usr/local/share/tk8.3/listbox.tcl
打开listbox.tcl文件,注释掉182~184三行。

Can't find a usable tk.tcl in the following directories:
     /usr/local/share/tk8.3

/usr/local/share/tk8.3/tk.tcl: no event type or button # or keysym
no event type or button # or keysym
     while executing
"bind Text {
     %W yview scroll [expr {- (%D / 120) * 4}] units
}"
     (file "/usr/local/share/tk8.3/text.tcl" line 457)
     invoked from within
"source [file join $tk_library text.tcl]"
     invoked from within
"if {[string compare $tcl_platform(platform) "macintosh"] && \
     [string compare {} $tk_library]} {
     source [file join $tk_library button.tcl]
     so..."
     (file "/usr/local/share/tk8.3/tk.tcl" line 308)
     invoked from within
"source /usr/local/share/tk8.3/tk.tcl"
     ("uplevel" body line 1)
     invoked from within
"uplevel \#0 [list source $file]"

This probably means that tk wasn't installed properly.
$sudo gedit /usr/local/share/tk8.3/text.tcl
打开text.tcl文件,注释掉457~459行。
启动正常
文章欢迎转载,但请注明作者与出处
作者:流星
出处:http://blog.sina.com.cn/staratsky

你可能感兴趣的:(gcc,ubuntu,sourcenav)