Ubuntu Install GNU Global (gtags) Read Linux kernel source __linux

Source: Internet
Author: User
Tags code tag git clone
CSDN GitHub
Ubuntu Install GNU Global (gtags) read Linux kernel source Aderxcoding/system/tools/global


This work uses the Knowledge sharing signature-non-commercial use-the same way Shares 4.0 international License Agreement to authorize, reprint please indicate the source, thank the cooperation

Because of my technical level and limited knowledge, the content if there are flaws or need to amend the place, you are welcome to correct, but also welcome you to provide some other good debugging tools for inclusion, I hereby thank you


1 Global Profile 1.1 Background

Previously introduced a lot of web code reading tools, and recently wanted to see the Linux kernel code, originally wanted to build a LXR server.

Ubuntu14.04 Build LXR local server read Linux kernel code

Building method of Opengrok of tools

Installation and application of Opengrok in Ubuntu environment

But the idea was to use the GNU GLOBAL server that was built inside the company. Hence the Baidu. It is found that building GLOBAL is much simpler than LXR, and it is also powerful enough for individuals or small teams to read code. Since LXR this road, let's go for another road. Decisively replaces LXR with GLOBAL. 1.2 Global

Summary: GNU GLOBAL is a source code tagging system that works in a different environment in the same way, such as the Emacs Editor, Vi Editor, less viewer, Bash shell, and various web browsers.

GNU GLOBAL is a source code tagging system that can be read and indexed in code. GNU GLOBAL works in the same way in different environments, such as Emacs Editor, Vi Editor, less viewer, Bash shell, and various web browsers, etc.

Using GNU GLOBAL, you can find different objects in your source code and move them easily, such as functions, macros, structs, classes, and so on. This is useful for large projects, especially those that contain many subdirectories, many #ifdef, and many main () functions.

It is similar to ctags or ETag, but has two different points:

Standalone editor

Ability to process definitions and references

GNU GLOBAL can run on UNIX (POSIX) compliant systems, such as GNU and BSD. GNU GLOBAL supports a number of languages that support the definition and reference of symbols in C, C + +, YACC, Java, PHP4, and assembly language, and also through exuberant Ctags, which supports the index of 40 + languages.

As part of the GNU Project, GNU GLOBAL is free software, and you are free to copy, modify and redistribute the GNU GPL under the program.

Unix/linux users can install directly from the warehouse. No additional settings are required when the installation is complete.

Windows users can click here to download.

For more information on GNU GLOBAL please see here:

https://www.gnu.org/software/global/ 2 Installation 2.1 uses a self-contained source to install global

sudo apt-get install global
2.2 Compiling and installing global

The GLOBAL version of Ubuntu 14.04 is 5.7.1 but the official website is already 6.6. So if you want to use the latest version of GLOBAL, you need to compile the installation yourself. To install a library of compilation dependencies

sudo apt build-dep global
sudo apt install libncurses5-dev libncursesw5-dev

Move to GNU GLOBAL to download the latest tar.gz package and unlock it.

wget https://ftp.gnu.org/pub/gnu/global/global-6.6.tar.gz
Compiling the installation
./configure--with-sqlite3   # gtags can use Sqlite3 as a database, which needs to be added at compile time
make-j4
sudo make install
3 using GLOBAL

Let's assume that we're going to generate the Linux Kernel parsing HTML Next
Perform

git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git

Of course, you can download the Linux kernel tar packets directly to the local after decompression.

Enter the directory where Linux Kernel is run gtags generate index data

#  Generate tag file
gtags–v

Of course, you can also add the--sqlite3 parameter, the following is the parameter help information given by-help.

Use the Sqlite 3 API to make tag files. By default, the bsd/db 1.85 API is used.
To the "Use" option, you are need to invoke configure script with--with-sqlite3 in the build
phase.

After the tag file is generated, execute the htags command to generate the HTML file.

Htags-dffnva-m "Specify the name of the main function"-t ' here, fill in the page you want to title '

3.2 Configuration Service

GLOBAL has an HTTP SERVER that can be used directly to start the Htags-server

If I run htags-server directly, I find that the extranet cannot access my GLOBAL Web server, look at the Help file, and execute the following code:

Htags-server–b IP Address Port number

If you do not fill in the port number, default 8000, if you want to open the service in port 8080, it seems like sudo, otherwise the error, somehow.

If you want to use the Apache service to visit Web services, you need to add the-D or-f option when htags.

For more help, please refer to-HELP or consult the official documentation.
Official documentation: http://www.gnu.org/software/global/globaldoc.html 3.3 Incremental Update

GLOBAL supports incremental updates, global-u This command automatically finds project/gtags up and updates its contents. The advantage of Gtags is that the incremental update of a single file is extremely fast and almost instantaneous.

Global-vu

Or

Gtags-iv

4 reference materials

GNU GLOBAL Source Code TAG system to browse the source code, very convenient

Using GNU Global to read code in Emacs

Use GNU Global in vim

GNU Global Source Analysis tool use notes

Introduction to GNU Global, a more convenient and faster indexing tool than cscope

Ubuntu 14.04 Install the latest version of GNU Global (gtags)


This work/Bowen (aderstep-Purple night-Blue Ling Xiang Cao copyright©2013-2017), by Chengjian (Gatieme) creation.

Use of knowledge-sharing signatures-non-commercial use-Share 4.0 International license agreements in the same way. Welcome to reprint, use, republish, but be sure to keep the article signed Chengjian Gatieme (including Links: http://blog.csdn.net/gatieme), not for commercial purposes.

Based on the modified works of this article must be issued with the same license. If you have any questions, please contact me.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.