11 Development Tools: 11.1 Program Builds
11 Development Tools: 11.1 Program Builds
11 Development Tools
Software development requires many development tools, such as editors and compil-
ers. Other essential tools include debugger, analysis tools, source code management
tools and documentation tools. These de-
velopment tools are widely available due to (11) Development Tools
the work of FOSS developers, who create
We have variety of Development tools
tools that they themselves need for FOSS FOSS development tools
Developers make a new
Compiler
Debugger
Source code
Based on FOSS
management
Maintaining
development via the
Localization
Documentation
ry means of FOSS development, develop- increasing, in addition to
conventional CUI-based IDE based on GUI
tools Bug tracking tools
guage. Next, the object code is linked to File describing the process of building software
Makefile
227
Program Builds
11.1.1 GCC
GCC, which stands for the GNU Compiler
Collection, is a set of compilers. Devel- GCC
opment of GCC was started in 1984 by
gcc (the GNU Compiler Collection)
Richard Stallman. The name originally Development started in 1984 by Richard Stallman
stood for GNU C Compiler, since it was Originally stood for GNU C Compiler
Now stands for GNU Compiler Collection
originally developed as a compiler for the Includes compilers and libraries for C, C++, Objective-
C, Fortran, Java and Ada
braries, adding support for additional lan- Widely used for commercial and non-commercial
operating systems
11.1.2 Make
Make is a utility for automatic building process. Rules for a build are described in
a file called a makefile. These files prescribe how to compile, link and install pro-
grams. Make executes a build according
to the contents of the makefile. In addi- Make
tion to automating builds, make includes To help manage build PACKAGE = hogehoge
SRCS = $(PACKAGE).c
OBJS = $(SRCS:.c=.o)
features to shorten build times by mini- process
FILES = README Makefile $(HEADS) $(SRCS)
VER = `date +%Y%m%d`
Marking of dependency CC = gcc
ing the modification time of the source files Autotools convenient for
automatic generation of
$(OBJS): $(HEADS) Makefile
.c.o:
rules
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
with the last time the derived files were up- Build optimization
.cc.o:
.f.o:
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
$(FC) $(FFLAGS) -c $< -o $@
.p.o:
228
Development Tools
ment. Linking involves the following pro- Link multiple object files and library or archive files
Relocate data
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 296
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
Linkage can be static or dynamic. Static linking is a linking method that combines
all object files and libraries from the build into a single file. Although the file runs as
a stand--alone file, the drawback is that it produces a large executable file. Dynamic
linking only designates the names of libraries to enable dynamic linking to libraries
during execution. The use of dynamic linking reduces the file size of the program
in its executable format. This method also has the advantage of enabling separate
management of libraries. For these reasons, dynamic linking is widely used today.
11.3 Debugger
11.3.1 Debugging
Bugs or errors inevitably arise during coding in software development. Debugging is
the process of locating and fixing bugs. The debugging process essentially involves
checking for the following items:
Debugging Tools
· Are the values of variables as expected?
Debugging
Process of fixing bugs in coding
output the values for variables. This pro- Debuggers, profilers, tracers, etc.
229
Debugger
are used to check the function call efficiency or detect memory leaks. Tracers are
used to trace function calls.
11.3.2 Debugger
The major FOSS debugger is GDB, which
stands for the GNU Project Debugger. The Debuggers
GDB tool has the same features as other
GDB (The GNU Project
gscanbus
Tool for acquiring and
displaying data from
connected IEEE 1394
device
Problem (bug?)
Camera icon displayed
as question mark
Camera works
properly
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 299
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
230
Development Tools
grep command, you can search the loca- Rom_info.h and rom_info.c files exist
in the rom_info.h and rom_info.c files. NODE_TYPE_CONF_CAM when camera you are using
(unit_sw_version=0x101) is connected
}
resolv_guid(rom_info->guid_hi, rom_info->guid_lo, &cpu);
if (cpu) return NODE_TYPE_CPU;
return NODE_TYPE_UNKNOWN;
erly if you change the source code to re- An Introduction to Free/Open-Source Software
}
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 301
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
231
Analysis Tools
is no guarantee that the method you used Fix was possible because of viewable source code
is the correct method for fixing the prob- feeding back to community
tracer is used to trace function calls and Profilers / memory testing tools
Tools to get statistical information on CPU and memory
A static source code analysis tool is used to Tools to trace function calls and system calls
trary point using an editor. It is also used To jump directly to the definition of classes and functions
cflow
for visualization of source code. Tools such To show the invocation tree between functions and functions
An Introduction to Free/Open-Source Software
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 303
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
232
Development Tools
11.4.1 Profilers
A profiler is used to acquire (profile) and display the status of program execution at
fixed intervals. By using a profiler, it is possible to grasp hardware information such
as the processor and thread status or cache
hit ratios. A CPU profiler acquires CPU-- Profilers
related information such as CPU utiliza-
Profiling
tion rates. A memory profiler acquires in- Acquire status of program execution at fixed intervals
formation about memory usage or detects Also acquire hardware information such as cache hit
ratio
Memory profilers
Measure memory usage, detect memory leaks
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 304
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
necks in this way is useful for accelerating Specify -pg option when compiling
Sample output
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software 305
The slide at right shows a sample output from gprof. The results show that execution
of func1 took zero time, while execution of func2 took nearly all of the time. This
indicates that accelerating func1 will have barely any effect on accelerating the
program. Accelerating func2 will help to accelerate the overall program.
233
Analysis Tools
leaks. The slide at right shows a screen-- Test for memory leaks
MEMWATCH
shot of MemProf. CUI memory testing
tool for C
11.4.4 Tracers
A tracer tool is used to trace function calls and system calls. Several FOSS tracers
are available for different tracing purposes.
Tracers
CTrace
Traces function calls
Ltrace
Traces function calls for shared libraries
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 307
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
11.4.4.1 CTrace
CTrace is a tracer for function calls and is used for programs written in C. The ctrace
command embeds tracing text into C language programs. When a modified program
is compiled and executed, the trace status is output at execution so that you can
check the operation of the program. To check shell script operation, designate the
-x option when executing a shell script.
234
Development Tools
11.4.4.2 Ltrace
Ltrace is used to trace calls for shared library functions. The slide shows a sample
output from ltrace. The ltrace output displays the call status of shared libraries
as function--name (argument) = returned--value. Unlike CTrace, programs do not
need to be recompiled when using ltrace.
ing. In some instances, you may wish to To make sure when, who, where and how modified?
lem occurs, or to create a branch version RCS, CVS, subversions and other similar tools were
developed in association with changes of development
to test new features. Various source code styles from independent development to team and
distributed development
235
Source Code Management
printf("Hello World!\n");
return 0;
--- 3,5 ----
Tool to generate differences
hence saving the entire file results in much Basic features of RCS, CVS and Subversion
duplication. Consequently, only the dif- Used by someone other than source code administrator
to create bug fixes or add features
236
Development Tools
(repository) update
Enables concurrent Updates working copies
editing of same file by
add/delete
multiple persons
Adds and deletes files
Subversion diff
Addresses downsides of Shows differences between files
CVS (inability to move or
status
delete directories, etc.)
Shows status of files
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 310
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
11.5.2.2 CVS
Where RCS enables multiple users to share the same file stored on one computer,
CVS uses a server architecture to manage a repository. Under this arrangement,
users copy the contents of the repository to individual clients. This enables multiple
individuals to concurrently edit copies of the same file. When a change is made to
the original file, CVS automatically merges the changes from copied files. If changes
are made to the same portion of the original file, the developer has to decide how
to merge the overlapping changes.
11.5.2.3 Subversion
Subversion shares the same basic features and operating method as CVS, but with
enhancements to address the downsides of CVS. Specifically, Subversion includes
the ability to move and delete directories and to track these changes as part of the
versions. These features are missing in CVS. Subversion is upwardly compatible
with CVS.
237
Other Tools
238
Development Tools
Differences in libraries
3. The specification for a library can change due to a version upgrade, leading to
incompatibilities with the previous version of the library.
4. Differences in the library path can occur, compared with the computer envi-
ronment used for development. For example, a library can be located in the
/usr/local/lib directory or in /usr/lib.
239
Other Tools
Autotools was developed to address these Need tools to compile and execute same program on
different platforms (OS or environment)
A configure script can be used to gather Minor format differences depending on version
240
Development Tools
11.6.3 Localization
In most parts of the world, English increasingly serves as the universal language of
the FOSS community. However, there are many developers and users who lack En-
glish skills. Furthermore, many users de-
sire software in their own native language, Localization
even if they do have good English--language
English is the universal language of FOSS
prepare versions of software in languages Desire for different language versions so that many
others can use software
own native language, so that many people and dialogs in different languages
can use the software. Localization is criti- Translators do not need to understand source code
display of menus, dialogs and other char- See I18n, M17n and L10n
Localization tools can support the display of menus and other elements in different
languages. However, these tools are not equipped to implement internationalization
such as multilingual handling and line breaks. Localization, internationalization
and multilingualization are discussed in detail in Section 10.5.3: I18n, M17n and
L10n.
241
Other Tools
2. Surround the internationalized charac- Replaces Hi (msgid) with Guten Tag (msgstr)
msgid "Hi"
msgid "Add"
msgstr "Hinzufuegen"
In the example shown above, “Guten Tag” (msgid) is replaced with “Welcome” (ms-
gstr). To support many languages, a message catalog for each target language must
be prepared.
11.6.5 Documentation
Many FOSS developers place a lower priority on creating documents such as manuals
and specifications, compared with the priority they place on software development.
There are few FOSS projects that prepare
adequate documentation. The problem is Documentation
so widespread that lack of documentation
Importance of documentation
User manual
ploying FOSS. This section stresses the im- Expand developer base
Documentation is critical for users and oth- Writing documents perceived as bothersome
original developers themselves. Preparing Can also graph class relationships, etc.
242
Development Tools
Documentation also benefits the original developer. If you have ever been involved in
software development, you know that sometimes it is possible to forget the purpose of
source code written a week or a month ago. Documentation is effective in preventing
this type of situation from happening.
Creating documents is time--consuming, but documentation tools can be used to
effectively streamline the process. Documentation tools automatically generate doc-
uments from source code. These tools can shape the comment style within source
code and graph class relationships. However, documentation tools do not analyze
the contents of source code to identify the purpose of the program. If you wish to
reflect the purpose of the program in documents, then you must mark portions of
the source code with comments.
that you can use Javadoc in all your Java Supports Java, C, C++,
PHP, etc.
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 316
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
243
Other Tools
iar with GUI development environments. Demand for GUI-based IDEs as developer base grows
(IDEs) are available for Windows develop- Eclipse with multi-language support
ment and are the primary choice for de- KDevelop for KDE applications
244
Development Tools
11.6.8 Eclipse
The most famous FOSS IDE is Eclipse. Eclipse was written in Java and runs on a
wide range of operating systems that support Java. The advantages of Eclipse are
its high extensibility and plug--in architec-
ture to strengthen various features. Mod- Eclipse
ules and plug--ins are available for multi--
IDE written in Java
chitecture of Eclipse in some ways makes Plug-in architecture to strengthen various features
its high extensibility, Eclipse is billed as a IBM sells Eclipse-based IBM Rational Software
Development Platform
so makes it necessary to grasp the work Dedicated database for bug tracking
sheets become inadequate for managing bugs, As software grows in scale, management tools such as e-mail
and spreadsheets become inadequate for grasping overall
picture
resulting in the need for a centralized sys- Stores information such as bug reporter, reproduction method,
bug correction assignee, correction history, correction method,
tem for managing bugs. This type of sys- degree of importance, test status, etc.
reporting tool. Bugs can sometimes recur after bug correction or during testing
245
Chapter Review
bugs. This information includes the bug reporter, reproduction method and per-
son assigned to correct the bug. Also tracked are the correction history, correction
method, degree of importance and test status.
A bug life cycle refers to the sequence of events from bug identification until the bug
report is closed. Typically, the life cycle involves the following sequence of events:
1. bug report,
3. correction of bug,
In some cases, bugs can recur after they are corrected, due to fixing a different part
of the software or when testing reveals that the bug correction was inadequate.
11.6.10 Bugzilla
Bugzilla is a bug reporting tool that was developed by Mozilla.org for the Mozilla
browser. The software is known for its powerful bug tracking and search features. In
addition to being used internally by Mozil-
la.org, Bugzilla is used by other large--scale Bugzilla
projects such as XFree86, Apache, Samba,
Developed by
Copyright © 2005,2006, Center of the International Cooperation for Computerization (CICC) All Rights Reserved.
An Introduction to Free/Open-Source Software Copyright © 2005,2006, Mitsubishi Research Institute, Inc. All Rights Reserved. 320
Copyright © 2008, University of Puerto Rico at Mayaguez. All Rights Reserved.
246
Development Tools
· What are the advantages and disadvantages of static and dynamic linking?
· What essential feature does CVS have that RCS does not have?
· What essential feature does Subversion have that CVS does not have?
· Explain which steps are taken to when localizing software with gettext.
· What are the main advantage and the main disadvantage of GUI IDEs compared
to CUI tools?
· Explain the bug life cycle. What are its main events?
247