PCYOPCYO

山上有座庙

linux下读源码的好工具sourcenav-6.0

虽然比windows下的source insight差了不少,但是linux下凑合用还可以,虽然vim+cscope可以胜任短时间内代码量小的文件,但是像linux内核源代码级别的,为了省事(我可懒得去vim下找更多插件),还是装个sourcenav吧

简要的说 安装步骤:

wget http://svn.exactcode.de/t2/trunk/package/develop/sourcenav-ng/tk-lastevent.patch
wget http://nchc.dl.sourceforge.net/sourceforge/sourcenav/sourcenav-6.0.tar.gz

tar zxvf sourcenav-6.0.tar.gz
cp tk-lastevent.patch sourcenav-6.0
cd sourcenav-6.0
patch -p1 < tk-lastevent.patch
./configure
make
sudo make install


 

我安装的是最新的sourcenav-6.0
下载下来解压,我的路径是
sai@sai-laptop:~/pack/sourcenav-6.0/
再从下面地址拷贝补丁
http://bugs.gentoo.org/attachment.cgi?id=161242&action=edit
到/sourcenav-6.0/tk目录下保存为tk-8.4-lastevent.patch,然后在/sourcenav-6.0/tk目录下运行
patch -p0 -i tk-8.4-lastevent.patch

然后先要确保如下库安装了

sudo apt-get install libx11-dev

不然编译过程中会碰到下述错误
/root/tk8.4.16/unix/../generic/tk3d.c:1279: error: ‘TkBorder’ has no member named ‘resourceRefCount’
/root/tk8.4.16/unix/../generic/tk3d.c:1280: error: ‘Tk_FakeWin’ has no member named ‘display’
/root/tk8.4.16/unix/../generic/tk3d.c:1280: error: ‘Tk_FakeWin’ has no member named ‘screenNum’
/root/tk8.4.16/unix/../generic/tk3d.c:1280: error: ‘TkBorder’ has no member named ‘screen’
/root/tk8.4.16/unix/../generic/tk3d.c:1281: error: ‘Tk_FakeWin’ has no member named ‘atts’
/root/tk8.4.16/unix/../generic/tk3d.c:1281: error: ‘TkBorder’ has no member named ‘colormap’
/root/tk8.4.16/unix/../generic/tk3d.c:1301: error: ‘TkDisplay’ has no member named ‘borderTable’
/root/tk8.4.16/unix/../generic/tk3d.c:1301: error: ‘TkDisplay’ has no member named ‘borderTable’
/root/tk8.4.16/unix/../generic/tk3d.c:1306: error: ‘TkBorder’ has no member named ‘nextPtr’
。。。。。。

然后会到/sourcenav-6.0目录下
./configure
sudo make
sudo make install

启动用snavigator

注意,一开始如果没打补丁,直接编译安装的话会出现

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

之类的错误。。。
这个时候最后把目录删掉,重新解压,完全重头来一遍,而不要偷懒打上补丁就make ,make install

本原创文章未经允许不得转载 | 当前页面:PCYO » linux下读源码的好工具sourcenav-6.0

评论