Your Red Hat Linux system comes loaded with all the tools you need to develop software. In particular, it has all the GNU software-development tools, such as GCC, the GNU debugger, GNU make, and the RCS version-control utility. This chapter describes these software-development tools and shows you how to use them.

By reading this chapter, you learn that:

  • The GNU tools compose the software-development environment on your Linux PC. These tools include GNU Emacs for text editing; GCC for compiling C and C++ programs; GNU make for automating software builds; the GNU debugger for debugging; and the RCS for version control.

  • A utility named info provides online help information on the GNU tools. You can run info alone in a terminal window or under GNU Emacs by using the Ctrl+h i command.

  • GCC is the GNU C and C++ compiler. You can use the gcc command to compile and link C programs. Use g++ to compile and link C++ programs.

  • GCC has a plethora of options, but you need to use only a few. Some of the common options are -c (for compiling only) and -o (for specifying the name of the output executable file).

  • The GNU make utility enables you to automate the build process. You specify the modules that compose an executable, as well as any dependencies; make takes care of compiling only files that need recompilation. The input file for make is known as a makefile and is commonly named Makefile.

  • The GNU debugger enables you to locate errors in your programs. Use the gdb command to run the debugger. You have to compile the program by using GCC's -g option to generate debugging information the GNU debugger can use.

  • When you use GNU tools to develop software (as you do in Linux), you should be aware of the GNU licenses: the GNU General Public License (GPL) and the GNU Library General Public License (LGPL). The LGPL covers GNU libraries. If you distribute your software in binary form, you should use dynamic linking to comply with the terms of the LGPL. You should not take anything in this book as legal advice, of course; always consult your own legal counsel for a definitive answer.

  • Version control is an important aspect of software development. In Linux, you get the RCS (Revision Control System) to manage revisions of source files.

  • Concurrent Versions System (CVS) is a versatile RCS-based, version-control system that manages multiple directories of files. CVS enables multiple developers to work simultaneously on the same set of files. Open-source projects, such as GNOME, use CVS to enable many developers to work on various parts of the project.

  • Shared libraries are commonly used in Linux applications to reduce the memory requirements of executables. Applications are dynamically linked with a shared library at runtime, and many applications can share a single library.

  • The Linux development community has adopted the Executable and Linking Format (ELF) for binaries. ELF makes dynamic linking simpler to program. This chapter shows an example of how to use dynamic linking in your own applications.