Linux Tutorial - Software Development on Linux

Programming Linux applications

This tutorial covers the tools available for programming languages supported by Linux.
JAVA programmers, also see the YoLinux JAVA on Linux tutorial.
C++ programmers, also see: YoLinux C++ on Linux tutorial.

Contents:

Related YoLinux Tutorials:

°C++ Info, links

°C++ String Class

°C++ STL vector, list

°Emacs and C/C++

°Advanced VI

°CGI in C++

°Subversion / Trac

°Subversion commands / use

°Clearcase Commands

°MS/Visual C++ Practices

°C++ Memory corruption and leaks

°YoLinux Tutorials Index




Free Information Technology Magazines and Document Downloads
TradePub link image


Free Information Technology Software and Development Magazine Subscriptions and Document Downloads


Compilers:

Open Source:

C, C++ and FORTRAN come with most distributions.

Language Info
C/C++/FORTRAN GNU C compiler man page (gcc)
GNU C++ compiler man page (g++)
g77 man page
Note: the current and newer branch of the gcc compiler is known as the egcs or "enhanced" GNU compiler
kgcc Kernel C compiler. This is a Red Hat hack to get the kernel to compile. The future plan is to eliminate this.
ProPolice SSP for gcc IBM: GCC extension for protecting applications is a compiler extension which generates "hardened" executables which can survive "stack smashing" attacks. ProPolice is an enhancement to GCC, and is distributed under GPL.

The paper that started it all: StackGuard

SGI C,C++,FORTRAN/IA-64 SGI compiler for Intel IA-64 64 bit platform
Java /usr/bin/jikes [jikes man page] - java source to bytecode compiler.
gcj - GNU JAVA compiler. (Part of complete Red Hat install. This creates native executable.)
Pascal Free Pascal Home page, documentation and download
Cobol TinyCobol Home Page
LISP CLISP interpreter, compiler and debugger
CMU Common Lisp
octave GNU Octave - An interactive language for numerical computation.
ADA GNAT - wiki
GNAT/Linux
Scheme MIT Scheme
C# Ximian: MONO (Not ready yet)
C# The DotGNU project (Not ready yet)
Mumps Mumps compiler - Basic like syntax with tree structured database.
HBasic HBasic - Similar to Visual Basic. Uses QT for GUI.

Cross Compiling:

Commercial Compilers:

Language WWW Description
Ada Ada Core Technologies Ada 95 GNAT open source compiler and GUI tools. (gcc backend)
Ada Green Hills Software AdaMULTI 2000, ADA 95 IDE
Ada Aonix Software Ada 95/83, ObjectAda
Ada Rational Software: Apex Ada 95/83 development
C Compaq C True 64 Compiler ported to Linux for Alpha chip.
C++ Intel Intel ISO standard C++ compiler and tools (optimized)
C++ KAI (Kuck and Associates): Guide OpenMP C/ C++ compiler for SMP multiprocessor systems. Has OpenSMP directives for dynamic balancing and dynamic threading
C++ Fujitsu C/C++ Optimized ANSI, K and R, ISO/IEC and ATandT standard C++ compiler
C/C++/Ch C/C++ embedable interpreters ISO C/C++, POSIX, GTK+, OpenGL, Motif, Sockets, CGI and scientific programming support.
FORTRAN Portland Group Compilers Paralell FORTRAN, Cray extentions
FORTRAN Absoft ProFortran ANSI FORTRAN 95, array bounds checking, HP/Compaq/VAX extensions
FORTRAN Intel FORTRAN 95, HP/Compaq/VAX extensions. [buy]
FORTRAN HP/Compaq Fortran True 64 Compiler ported to Linux on Alpha chip (only).
FORTRAN N.A.Software GUI debugger, IEEE math and exception handling. Lots of math libraries.
FORTRAN Fujitsu FORTRAN Optimized 95, 90, 77, 66 compiler
FORTRAN Numerical Algorithms Group (NAG) Compiler supports 64 bit integers and High Performance FORTRAN (HPF), IEEE support.
COBOL Liant: COBOL Re-host Mainframe apps on Unix/Linux.
COBOL Micro Focus COBOL For IBM zSeries Linux mainframe.
PL/1 Liant: Open PL/1 Re-host Mainframe apps on Unix/Linux.
JAVA Tower Technology: TowerJ Compiles JAVA to native code. Will also compile JAVA byte code to native binary code.
LISP Franz Inc: Allegro CL Common Lisp object-oriented development environment
Eiffel ISE: Eiffel Object-oriented language and development environment
BASIC PureBasic Compiler not an interpreter. Many extensions

Also see:


Development Tools:

  • C++:
    c++filt Demangle C++ symbols
    SWIG.org Interface compiler for wrapper routines which run from test scripts for testing "C" and "C++". Works with Perl, Python, Ruby, and Tcl and allows scripts to invoke "C" and "C++" functions, libraries, etc.
    ParaSoft C++ Test Static source code tester and automated unit test cases.

  • Parasoft C++ Test notes:
    • View command line options: cpptest -h
    • From directory in which Makefile resides:
      [user1@prompt]$ make CC="cpptest -Zms Project-Name"
      Project file: /home/user1/C++TestProj/ProjectsFiles/Project-Name.cpf
      Options:
      • cpptest -Zcpf Project-Name.cpf -Zd off
        Turning on/off dynamic analysis. (default is on)
    • Command line: cpptest -Zcpf /home/user1/C++TestProj/ProjectsFiles/Project-Name.cpf -Zd off -Zrf Proj-Output-Test-Results.txt
    • Launch GUI: c++test &

  • C:
    lint Where is it??? Try lclint
    bison GNU Project parser generator (yacc replacement)
    pccts Purdue Compiler-Compiler (yacc/lex combo)
    flex fast lexical analyzer generator
    cdecl
    c++decl
    Compose C and C++ type declarations
    CScope C source code cross referencing tool
    cxref C source code documentation and cross referencing tool

  • FORTRAN:
    f2c Convert Fortran 77 to C or C++

  • Debuggers:
    gdb [man] GNU debugger. Command driven text/console interface. [Tutorial]
    xxgdb [xxgdb] X window system interface to the GNU debugger
    DDD [man] Data Display Debugger. GUI interface for gdb and dbx.
    GPS GtkAda/GNAT Graphical IDE Debugger Interface
    KDbg KDE Desktop Graphical GDB Debugger Interface
    RHIDE Console mode with windows like Borland 3.1 toolset.
    Insight GUI interface to gdb. Works with Source-Navigator IDE
    xwpe Borland C++ console mode IDE clone
    RogueWave TotalView [Commercial] Specialized in debugging multi-threaded software with memory leak detection. Also MPI/OpenMP debugging facilities.

  • Java:
    kaffe Java virtual machine

    For a full list of Java tools and JVMs, see the YoLinux Java Tutorial

  • Source Code Documentation:
    dOxygen Documentation system for C++, C, Java, IDL (Corba, Microsoft, and KDE-DCOP flavors). Generates on-line documentation (in HTML) and/or an off-line reference manual (in LaTex)
    See YoLinux dOxygen guide

  • Gnome:
    glade Visual GUI builder to generate gtk C++ code or Gnome XML interface description to build Gnome GUI applications
    memprof Memory Profiling Tool to profile code, look for memory leaks and monitor code execution.

    For more information, see the YoLinux GTK+ Tutorial

  • Motif/LessTiff:
    uil Compile Motif scripting interface (Not my 1st choice for Motif programming)
    xmbind configures the virtual key bindings of LessTif

  • General:
    make Utility to maintain groups of programs with compiling/linker directives
    imake Utility to generate Makefiles from a template.
    GNU autoconf Tool used to generate configure script. Requires GNU m4.
    gHex Binary Editor and Viewer
    beav Binary Editor and Viewer
    od dump files in octal and other formats. od -c will try to dump everthing as ascii.
    xxd make a hexdump or do the reverse
    strings Print the strings of printable characters found in a file.
    install copy files and set attributes (ginstall)
    m4 Macro language for builing configuration files
    objdump display assembler information from object files
    nm display symbol table from an object file
    readelf Displays information about ELF format object files.
    ar Create, modify, and extract from archives
    ranlib Generate index to archive
    ldconfig determine run-time link bindings
    ldd Print shared library dependencies for an executable
    (i.e.: ldd `which xpdf`)
    GNU libtool Used to generate shared libraries.
    ipcs Report interprocess communication facility status for queues, shared memory, semaphores
    iprm Remove queues, shared memory, or semaphores

  • Data Base toolkit:
    gdbm
    (Includes dbm and ndbm compatability.)
    The GNU database manager.
    Berkeley DB Open Source embedded database system/toolkit.
    SQLite.org Open Source embedded database system/toolkit.


Commercial Software Development Tool Vendors:

Eiffel Cross platform code integration and design. Eiffel OO language and GUI framework.
Visual SlickEdit Editor, Class browser, Dynamic Tagging
Perforce Software Software configuration management
Gimpel Software: FlexeLint Check C/C++ source code and find bugs, glitches, inconsistencies.
Parasoft: WebKing Verification and testing tools for web services (SOAP), validate HTML, CSS, JavaScript, XML, and WSDL
Flexera: InstallAnywhere Software installation package
ParaSoft
C++Test
C/C++ coding standards enforcement tool. Cross platform. Code analysis and editing IDE. Static analysis of source code.
Parasoft: SOAPtest Uses WSDL or UDDI info to generate SOAP requests/tests


IDE: Integrated Development Environment

  • IDE:
    Eclipse.org IBM open source JAVA and C/C++ (with CDT plug-in) IDE. Included with FC4. Extensible IDE consortium - Borland, IBM, Red Hat, Rational. Lots of industry backing. (Open Source)
    Also see EclipsePluginCentral.com Plugins available for Subversion SCM, XML documents, HEX, ...
    Also see: YoLinux C++ Development
    Anjuta C, C++. Written for GTK/Gnome. Solid, simple, intuitive, bug free IDE for C/C++ development on Linux. Search/Indexing, edit, compile and debug. Almost no learning curve for those familiar with IDE's.
    KDevelop.org C++ KDE IDE
    Sun Studio C/C++, FORTRAN IDE for Linux. (Free and supported x86 versions)
    Source Navigator C/C++, FORTRAN, COBOL, Tcl, JAVA, asm editor, cross reference tool, class browser and IDE.
    wxStudio C++ cross platform IDE. Written for wxWindows cross platform GUI framework.
    Moonshine IDE built with Adobe AIR, for AS3/Flex Development.
    DiaSCE C/C++ Gnome code editor. Integrated with Glade GTK GUI builder. (no debugging)
    Lazarus IDE for Free Pascal (GPL'ed compiler) and class libraries which emulate Delphi.

  • Commercial IDE's:
    Freescale: CodeWarrior Code navigation, compile and compare (cross platform), GNU C++ and JAVA
    Borland: C++ Builder 5 Full IDE. Cross platform desktop apps.
    New Planet Software: Code Medic Works with Code Crusader (strong C++) development environment and JX (X-window C++ application framework).
    C-Forge Project management and complete edit/compile/debug cycle support. Supports CVS, SCCS, RCS, ETAGS, C/C++ and FORTRAN, Querix 4gl and eRuby, Qt Designer, WxWindows and your wheel mouse.
    Viosoft: Arriba Embedded Software IDE. MS/Visual C++ like IDE for Linux.
    WindRiver: Workbench C, C++ or ADA. Unix or Windows
    Aligo: Omni Mobile Platform Mobile Java development (Cell phones/PDA's)

    Also see:


Memory Debugging Development Tools:
  • Memory Debugging:
    ccmalloc ETH Zurich: C/C++, Checks for illegal memory access and leaks. Cannot detect illegal memory reads.
    GNU Checker Warns of using uninitialized variable or memory or unallocated memory.
    dbmalloc C malloc, memory, string, and bstring
    dmalloc C malloc, realloc, calloc, free. Memory-leak tracking, fence-post write detection, file/line number reporting. Portable replacement C libraries memory allocation routines with debugging and statistics gathering.
    Electric Fence malloc() debugger. Stops program on the instruction that overruns or under-runs a malloc buffer. Catches buffer overruns by using write protected pages to guard memory.
    fda FDA provides a toolkit for validating pointers, checking for leaks, gathering memory statistics, bounds checking...
    Leak Tracer C++ program for checking memory leaks.
    libcw Full-featured debugging support library for C++ developers.
    libsafe Detect and handle buffer overflow and format string vulnerabilities before the hackers do. (Middleware software, not compiled in)
    Valgrind MemCheck Part of the KDE Valgrind toolset. C/C++ memory supervision. Intercepts malloc/new/free/delete. Detects memory leaks, uninitialised memory, inappropriate read/write of stack and malloc'ed blocks, some pthread errors. Valgrind modifies its object as it is running to detect memory errors. Valgrind detects memory leaks by scanning memory. Valgrind HOWTO
    This tool is often rated the best Open Source memory debugging tools.
    Memleak Part or X11R6.4
    Memdebug
    MemProf Red Hat GUI (Gtk/Gnome) tool for profiling and leak detection. Preloads it's own runtime library. Supports threaded and forked programs.
    MM Shared memory abstraction layer library.
    mpatrol Profile and log/trace malloc/free/new[]
    mpr Log malloc/free calls
    NJAMD Replaces malloc. Looks for overflows,underflows, writes to freed memory, leaks. C/C++, thread safe.
    YAMD Yet Another Malloc Debugger: C/C++
    gcc w/ bounds checking GCC bounds checking compiler patch. Adds the -fbounds-checking flag to gcc.
    Cacheprof Profile/investigate cache effects in x86 programs.
    Works with gcc compiler: cacheprof gcc -O -o myprog myprog.c.

  • Commercial Memory debugging tools:
    Aprobe Memory and performance audits.
    Etnus TotalView Memory leak detection including threaded software.
    Parasoft: Insure++ Memory corruption and memory leak error detection. C/C++
    IBM/Rational: Purify Runtime memory analysis.
    Memory corruption and memory leak error detection. C/C++
    IBM/Rational: Purify Plus Runtime memory analysis, profiling and code coverage.
    Memory corruption and memory leak error detection. C/C++

  • Parasoft Insure++ Notes/Example:
    Configure Insure++:
    1. Add to path in .bash_profile: /opt/parasoft/Insure++/bin.linux2/cpp/
    2. turn on graphical interface:
      Add to the file /opt/parasoft/Insure++/.psrc
      Insure++.inuse on 
    Compile/run:
    1. Test with example: cd /opt/parasoft/Insure++/examples/cpp/
    2. Compile: insure -g -o leak leak.C
    3. Run: ./leak

    Output from run:

  • Alternate memory functions:
    Boem Garbage Collector A garbage collector for C and C++. Replaces malloc/new
    CSRI (tar download)
    GNU Malloc (tar download)
    Hoard Memory allocator for multiprocessors. Improves multithreaded program performance on multiprocessor systems.
    Ptmalloc (GNU C library) Malloc extended for SMP
    Quick Fix Malloc qf.c: Optimized for low memory use and optimal allignment.
    vmalloc (Part of ast) AT&T Labs


Software Design:

Commercial Design Tools:

Software Requirements Management Tools:

  • aNimble - Grails/web based Requirements Management tools. Based on OSRMT. [download]
  • OSRMT - Desktop GUI application
  • rmtoo - Text and command line based. Generates dependency graphs and requirements docs. Rmtoo text files CM'ed with source.


CM: Software Change Management and Configuration Management:

Change Management (CM) Versioning systems and control:
Subversion / Trac (YoLinux tutorial) Subversion is a version control CVS replacement.
[YoLinux Subversion user TUTORIAL]
IBM/Rational: Clearcase Commercial product.
YoLinux Tutorials:
RCS Revision Control System. YoLinux Tutorial
CVS Concurrent Versions System. YoLinux Tutorial
Bonsai/LXR/Glimpse [alt] Web front-end CVS browsing and indexing engine for CVS
Ximian Red Carpet Automated Software Maintenance and Version Management
Katie Rational Clearcase style of filesystem browsing of source code repository. Uses PostgreSQL database.
MKS: Source Integrity Commercial product
PVCS: Version Manager Commercial product
BitKeeper Commercial product
Perforce Commercial product
Serena: Change management software. Source code, web content, ... Commercial product
Aldon Lifecycle Manager Enterprise Software Configuration, Change Management, deployment
SourcePuller Bitkeeper compatable source code management client.
GIT Distributed source code management. Written in "C" and developed by Linus Torvalds for use with the Linux Kernel. Concept roots inspired by Bit Keeper.
[Linus video speach on why he likes GIT]

Also see the YoLinux Git and Trac integration tutorial

Mercurial Almost the same as GIT but written in Python and based on a different data management system. Supports Maven build system.


Build Systems:

  • GNU gmake/make: GNU make is a build system based on the original UNIX "make" build system but with more features. Install RPM package: make
    GNU make manual
  • scons: Newer python based, cross platform build system. Great for cross platform development (i.e. MS/Windows and Linux/Unix)
  • Apache ANT: XML based build tool. Built-in support for Java
  • Apache Maven: XML based Java project build, reporting and documentation tool. Supports plug-ins for additional support


Application Lifecycle Management (ALM):

ALM systems integrate the software process from requirements through design, project management and task decomposition, assingment, coding, documentation, builds, testing, bug reporting all the way to requirements verification and release (or so they claim).

ALM tool
(framework)
License
CM
SVN
CM
Git
WikiReqTask
& Bug
track
Peer
review
AgileComments
Endeavour
Java/Tomcat
GNU
YNYYYNNALM layer on top of the following individual components: JamWiki, Jenkins, Sventon, Subversion and JForum. Sill acts like separate products and not yet fully integrated. Requirements support still needs work. Supports Gant chart.
Codebeamer
Java/Tomcat
commercial product
YYYYYNNMS/Word document import/export for requirements. Authenticated with LDAP server. Did not get Git integration working. From Germany
Codendi
Java/Php
commercial and GNU community edition
YYYYYNNRequirements and requiremnts trace. Difficult to install, if not impossible.
From France
Codebeamer was the most promising ALM tool I tested. Due to tight integration with wiki, task and bug tracking and CM, I still prefer Trac even though it is not a true ALM tool. Trac does have extensive plugin support to extend basic capabilities and can be customized into the system you want.


GNU Makefile for cross platform deployment:

GNU Makefile OS dependencies:

Makefiles can use defined OS variables. Cygwin sets $OS to "MS/Windows-Cygwin". This does not seem to be set for other OS's but can be set in the system profile or it can be explicitly set as in the example below.
OS = $(shell uname -s)

ifeq "$(OS)" "CYGWIN_NT-5.0"
OS_DIR    = win-i32
CC        = /usr/bin/g++
CPPFLAGS    = -g -mms-bitfields -mno-cygwin -mwindows
LDFLAGS     = -g -mms-bitfields -mno-cygwin -mwindows
AR    = /usr/bin/ar
CP    = /usr/bin/cp
MKDIR = /usr/bin/mkdir
RM    = /usr/bin/rm
ECHO  = /usr/bin/echo
TOUCH = /usr/bin/touch
endif

ifeq "$(OS)" "Linux"
OS_DIR        = linux-i32
CC = /usr/bin/g++
CPPFLAGS    = -g
LDFLAGS     = -g
AR    = /usr/bin/ar
CP    = /bin/cp
MKDIR = /bin/mkdir
RM    = /bin/rm
ECHO  = /bin/echo
TOUCH = /bin/touch
endif

ifeq "$(OS)" "SunOS"
OS_DIR        = sun-sparc
CC            = /usr/local/bin/g++
CPPFLAGS    = -g
LDFLAGS     = -g
AR    = /usr/ccs/bin/ar
CP    = /bin/cp
MKDIR = /bin/mkdir
RM    = /bin/rm
ECHO  = /bin/echo
TOUCH = /bin/touch
endif

ifeq "$(OS)" "IRIX64"
# SGI
OS_DIR=sgi-mips
CC=/usr/bin/CC
CPPFLAGS = -g -c -LANG:std -n32 -ptused
LDFLAGS = -v -g -LANG:std -n32 -ptused
AR    = /usr/bin/ar
CP    = /usr/bin/cp
MKDIR = /sbin/mkdir
RM    = /sbin/rm
ECHO  = /sbin/echo
TOUCH = /sbin/touch
endif
...

help:
        @-$(ECHO) "make all           - builds executable/library"
        @-$(ECHO) "make install       - installs components"
        @-$(ECHO) "make clean         - removes object files and executable/library"
        @-$(ECHO) "make clean_all     - removes all object files, executable/library, ..."

...

Also see YoLinux C/C++ gcc/g++ cross platform tips


Autoconf:


Software Test Systems:

Note that the following test frameworks are often used for Test Driven Development (TDD) and in Contiuous Integration (CI) implementations to provide a unit test infrastructure.

Test Frameworks:

Acceptance Test Frameworks:
  • FIT
  • Slim (FIT clone but coded for better integration with FitNesse)
  • FitNesse (Web/Wiki front-end to FIT and Slim)

Web testing:
  • iOpus: iMacros - Automate Firefox
  • Selenium - Web application testing system. Firefox plug-in
  • Watir - Automate web browser for web testing

Also see our Continuous Integration (CI) build server tutorials:
(Unit tests usually included with CI implementations)

Wikipedia list of unit testing frameworks


Automated Nightly / Continuous Build, Integration and Test Systems:

Automated Nightly/Continuous Build and reporting systems:

Commercial:


Bug/Change Tracking:

  • TRAC: Simple, web based, intuitive bug and change tracking. Has a good interface with Subversion. Click around and view a current project using TRAC.
  • Tigris.org: Scarab - From the Subversion crew. Interfaces with Subversion CM revision control system. Data entry, queries, reports, notifications to interested parties, collaborative accumulation of comments, dependency tracking. Web based.
  • Bugzilla - Database for bugs. Allows people to report bugs and assigns these bugs to the appropriate developers.
  • GNATS - Utilities to formulate and administer a database of Problem Reports grouped by site-defined "problem categories." Organizes the large volume of email that flows between end users and software maintainers by defining a database made up of archived and indexed email messages.
  • SeaPine.com: TestTrack Pro - Web based defect/bug tracker which integrates with Surround SCM, Visual SourceSafe, ClearCase, PVCS, Perforce, CVS, StarTeam, and SourceOffSite.
  • IBM/Rational: ClearQuest - works with their Clearcase change management system. Commercial product. Client application and web interface.


Development Libraries:

Cross Platform API's:


Software Install/Update systems:


Notes:

  • Running Red Hat 7.1 (glibc 2.2.2) but compiling for Red Hat 6.2 compatability.
    See RELEASE-NOTES
            export LD_ASSUME_KERNEL=2.2.5
    . /usr/i386-glibc21-linux/bin/i386-glibc21-linux-env.sh

  • To add libraries to be included during dynamic linking, add the entry to the file /etc/ld.so.conf OR add the the library path to the environment variable LD_RUN_PATH.

    Sample: /etc/ld.so.conf

    /usr/X11R6/lib
    /usr/lib
    ...
    ..
    /usr/lib/sane
    /usr/lib/mysql
    /opt/lib
    Add the library path to this file and then execute the command ldconfig to configure the linker run-time bindings.
    You can use the "-f file-name" flag to reference another configuration file if you are developing for different environments. See man page for command ldconfig.

  • To include the library during execution, add the library path to the environment variable LD_LIBRARY_PATH.
    (Linux/Solaris: LD_LIBRARY_PATH, SGI: LD_LIBRARYN32_PATH, AIX: LIBPATH, Mac OS X: DYLD_LIBRARY_PATH, HP-UX: SHLIB_PATH)

  • Direct loader to preload a specific shared library before all others: export LD_PRELOAD=/usr/lib/libXXX.so.x; exec program
    Also see:

  • Including a library in the compile statement: gcc src-file.c -lm -lpthread
    The libraries referenced in this example for inclusion during linking are the math library and the thread library. They are found in /usr/lib/libm.a and /usr/lib/libpthread.a.

    Note: The GNU compiler now has the command line option "-pthread" while older versions of the compiler specify the pthread library explicitly with "-lpthread". Thus now you are more likely to see gcc src-file.c -lm -pthread

  • ld.so - a.out dynamic linker/loader

  • Environment variable to highlight warnings, errors, etc: export CC="colorgcc"

  • Linux distros and releases:
    Red Hat/Fedora Kernel Glibc Libraries GCC
    FC 4 2.6.11-1.1369 glibc-2.3.5-10 4.0.0-8
    FC 3 2.6.9-1.667 glibc-2.3.3-74 3.4.2-6
    FC 2 2.6.5-1 glibc-2.3.3-27 3.3.3-7/3.4.0
    FC 1 2.4.22-1.2115 glibc-2.3.2-101 3.3.2-1
    RH 9.0
    glibc-2.3.2 3.2.2
    RH 8.0
    glibc-2.2.93 3.2
    RH 7.3
    glibc-2.2.5 2.96
    RH 7.2
    glibc-2.2.4 2.96
    RH 6.2
    glibc-2.1.3 2.91
    RH 5.x
    glibc-2.0
    RH 4.x
    libc5
    RHEL Kernel Glibc Libraries GCC
    RHEL6 2.6.32-279 2.12-1 4.4.6
    RHEL5 2.6.18-8 2.5-12 4.1.1-53
    RHEL4 2.6.9-5 2.3.4-2 3.4.3-9
    RHEL3 2.4.21-4 2.3.2-95.3 3.2.3-20
    CENTOS Kernel Glibc Libraries GCC
    Centos4 2.6.9-22 2.3.4-2.13 3.4.4-2
    Centos3 2.4.21-37 2.3.2-95.37 3.2.3-53
    SuSE Pro Kernel Glibc Libraries GCC
    10 2.6.13-15

    9.3 2.6.11 glibc-2.3.4-23 3.3.5-5
    9.2 2.6.8-24 glibc-2.3.3-118 3.3.4-11
    9.1 2.6.4-52 glibc-2.3.3-98 3.3.3-41
    9.0
    glibc-2.3.2 3.3.1
    8.2
    glibc-2.3.2 3.3
    8.1
    glibc-2.2.5 3.2
    SuSE Enterprise Kernel Glibc Libraries GCC
    9.0 2.6.5

  • How to generate a library:
    • Compile: cc -c ctest1.c ctest2.c
    • Create library "ctest.a": ar -cvq ctest.a ctest1.o ctest2.o
    • List files in library: ar -t ctest.a
    • Using library: cc -o executable-name prog.c ctest.a
    • Example files:
      • ctest1.c
        ctest1(int *i)
        {
        *i=5;
        }
      • ctest1.c
        ctest1(int *i)
        {
        *i=100;
        }
      • prog.c
        #include <stdio.h>
        main()
        {
        int x;
        ctest1(&x);
        printf("Valx=%d\n",x);
        }
    Historical note: After creating the library it was once necessary to run the command: ranlib ctest.a. This created a symbol table within the archive. Ranlib is now embedded into the "ar" command.

  • How to generate a shared object: (Dynamically linked object library file.)
        gcc -fPIC -c *.c
    gcc -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0 *.o
    Notes:
    • Option -fPIC: Compiler directive to output position independent code suitable for dynamic linking.
    • Pass options to linker: -Wl.
      In this example the options to be passed on to the linker are: "-soname libfoo.so.1".
    • Option -shared: Produce a shared object which can then be linked with other objects to form an executable.
    • Option -o: Output of operation. In this case the name of the shared object to be output will be "libfoo.so.1.0
    Man Pages:
    • gcc - GNU C compiler
    • ld - The GNU Linker

  • Unit test: Testing/Debugging C++ classes (this also applies to C functions)
    Create test main program which by default is not compiled. For debugging and test purposes have the main invoked with a compiler or makefile flag. Implementing this method allows the test program to always be available and in sync with the classes and/or functions within the file.
    See example C++ (ManageNumbers.cpp) program and test case main.
    • Regular compile: g++ -c ManageNumbers.cpp
    • Compile for test: g++ -DMAIN -c ManageNumbers.cpp
    Note: The GNU gcc group often uses the define flag "TEST".

    Create a target in the makefile for the unit test:

        ...
    testModule1: module1
    g++ -DMAIN -c ManageNumbers.cpp
    ...

    Also see unit test with CppUnit, a C++ Unit test framework

  • Internationalization:
    • Message translation see GNU "gettext".
    • If available: ./configure --with-included-gettext
    • Internationalized packages usually have many `po/LL.po' files, where LL gives an ISO 639 two-letter code identifying the language. (i.e. environment variable LANG=en)
    • catgets:
      • ./configure --with-catgets
      • See man page for C function catgets
    • Language codes are NOT the same as the country codes given in ISO 3166.
    • See man page for C functions setlocale, charsets, unicode
    • International character sets: Unicode.org


Links:

YoLinux Software Development Tutorials:


Links:


Books:

"Advanced Linux Programming"
by Mark Mitchell, Jeffrey Oldham, Alex Samuel, Jeffery Oldham
ISBN # 0735710430, New Riders

Good book for programmers who already know how to program and just need to know the Linux specifics. Covers a variety of Linux tools, libraries, API's and techniques. If you don't know how to program, start with a book on C.

Amazon.com
"Advanced UNIX Programming" Second Edition
by Marc J. Rochkind
ISBN # 0131411543, Addison-Wesley Professional Computing Series

Amazon.com
"Advanced Programming in the UNIX Environment" First Edition
by W. Richard Stevens
ISBN # 0201563177, Addison-Wesley Professional Computing Series

It is the C programmers guide to programming on the UNIX platform. This book is a must for any serious UNIX/Linux programmer. It covers all of the essential UNIX/Linux API's and techniques. This book starts where the basic C programming book leaves off. Great example code. This book travels with me to every job I go to.

Amazon.com
"Code Complete: A Practical Handbook of Software Construction"
by Steve McConnell
ISBN # 0735619670, Microsoft Press

This book teaches coding style and maturity to programmers without. It is software lessons, guidance and experience in a book. It will make you a better programmer by teaching you how to code with style and grace.

Amazon.com
"UNIX Network Programming, Volume 1: Sockets Networking API" Third Edition
by W. Richard Stevens, Bill Fenner, Andrew M. Rudoff, Richard W. Stevens
ISBN # 0131411551, Addison-Wesley Pub Co; 3 edition (October 22, 2003)

This book covers POSIX, IPv6, network APIs, sockets (elementary, advanced, routed, and raw), multicast, UDP, TCP, Threads, Streams, ioctl. In depth coverage of topics.

Amazon.com
"UNIX Network Programming, Volume 1: Networking APIs - Sockets and XTI" Second Edition
by W. Richard Stevens
ISBN # 013490012X, Prentice Hall PTR

This book covers network APIs, sockets + XTI, multicast, UDP, TCP, ICMP, raw sockets, SNMP, MBONE. In depth coverage of topics.

Amazon.com
"UNIX Network Programming Volume 2: Interprocess Communications"
by W. Richard Stevens
ISBN # 0130810819, Prentice Hall PTR

This book covers semaphores, threads, record locking, memory mapped I/O, message queues, RPC's, etc.

Amazon.com
"Advanced Unix Programming"
by Warren W. Gay
ISBN # 067231990X, Sams White Book Series

This book covers all topics in general: files, directories, date/time, libraries, pipes, IPC, semaphores, shared memory, forked processes and I/O scheduling. The coverage is not as in depth as the previous two books (Stevens Vol 1 and 2)

Amazon.com
"Linux Programming Bible"
by John Goerzen
ISBN # 0764546570, Hungry Minds, Inc

This covers the next step after "C" programming 101.

Amazon.com
"Gnome/Gtk+ Programming Bible"
by Arthur Griffith
ISBN # 0764546406, Hungry Minds, Inc

Covers programming desktop GUI applications with the Gnome/Gtk+ GDK API.

Amazon.com

   

    Bookmark and Share


Advertisements





 

Copyright © 2000 - 2014 by Greg Ippolito