Ubuntu12.04下安装sourcenavigator-NG4.5阅读源代码

     大家知道Windows下有一个很好的查看源代码的软件sourceinsight,使用sourceinsight查看Linux内核代码、嵌入式软件开发中的C语言项目源代码、驱动程序代码很是方便。在Linux下使用vim查看源代码不是很方便,于是搜了一下Linux下sourceinsight的相关替代软件,找到了一款Source Navigator,于是就试着在Ubuntu12.04下安装了一下。但是安装之后默认字体不好看,新建一个工程很慢,个人感觉跟sourceinsight没法比,还不如使用最新Android集成的Eclipse查看方便。

参考了这两篇文章,第1篇文章的软件版本比较老,就没怎么参考,我主要参考了第二篇文章,然后在Ubuntu12.04下成功安装sourcenavigator-NG4.5。

在ubuntu中安装 Source-Navigator及使用手册

Ubuntu 12.10安装Source Navigator

一、安装sourcenavigator-NG4.5软件

1、软件下载地址为:

点击这里下载最新的源码包,我下载的是sourcenavigator-NG4.5.tar.bz2

2、将下载后的sourcenavigator-NG4.5.tar.bz2拷贝到/opt目录,并且解压到/opt目录

假定下载sourcenavigator-NG4.5.tar.bz2到/tmp目录

Ctrl+Alt+T打开终端并使用如下命令:

cd /tmp

tar -xjvf sourcenavigator-NG4.5.tar.bz2 -c /opt

cd /opt

3、源码编译安装sourcenavigator-NG4.5

通过查看解压之后的sourcenavigator-NG4.5目录下的INSTALL文件,

我摘取了INSTALL安装说明文件中关于Linux下的安装方法:

UNIX Build:

GNU tools must be on the PATH before the configure script
is run. GNU make and gcc are required to build Source-Navigator.
If the GNU make executable on your system is installed as
gmake, type gmake instead of make in the following instructions.

To build under a UNIX system, simply run the configure script.
The following commands assume that the user wants to install into
a non-default location (/opt/sourcenav) that is owned by root.
If the install directory is not owned by root, then you don't need
to become root before the make install step.

% ./configure --prefix=/opt/sourcenav
% make
(become root)
% make install
所以进入到/opt目录下(即解压后的sourcenavigator-NG4.5所在目录)安装命令如下:

./configure --prefix=/opt/sourcenav

make

make install

当然也可以将上面的三条命令连起来写成一条,中间加上&&就OK了,如下:

./configure --prefix=/opt/sourcenav && make && make install

安装过程比较慢。


4、安装好sourcenavigator-NG4.5之后修改/etc/environment配置文件,

在PATH环境变量之后追加sourcenavigator-NG4.5安装后的bin目录

PATH=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/sourcenav/bin

(其中:/opt/sourcenav目录是我安装的sourcenavigator-NG4.5软件的安装目录)

5、启动snavigator

键入命令:snavigator,就可以启动了。不过前提是要将/opt/sourcenav/bin目录下的snavigator等tool工具添加到PATH环境变量中去,不然系统无法识别。

二、sourcenavigator-NG4.5使用体验

安装之后查看代码感觉字体很怪,找了半天也没找到在菜单中如何设置字体,很是郁闷

暂时在Ubuntu12.04下查看代码还是使用QT看C++代码,Android的Eclipse查看Java代码和C语言代码吧。


原文地址:https://www.cnblogs.com/ccf19881030/p/12004880.html