These classnotes are depreciated. As of 2005, I no longer teach the classes. Notes will remain online for legacy purposes

UNIX01/Application Building Under UNIX

Classnotes | UNIX01 | RecentChanges | Preferences

Showing revision 1
As we have seen, traditionally UNIX applications are distributed as source. The main reason for this, and the reason it has persisted, is because UNIX implimentations are vendor specific. A library version installed on some path under UNIX A may not be the same version or installed in the same path under UNIX B. Applications distributed as source with clever install and build scripts can adapt as needed when installed on practically and arbitrary UNIX.

  • If you wonder why this is, recall the debate about whether to use /usr for userspace applications and /home for home directories or to use /opt for userspace applications and /usr# for home directories.

The one problem with this model is that there are many different ways to write build scripts, so one project might not build quite like the other.

That being said, there is one method which is used most commonly with only minor variations. Thus, once you've learned the fundamentals of it, you will be able to easily build and install the vast majority of the applications out there.

gcc, g++, f77, etc

One of the most liberating strengths UNIX systems generally have is a wide variety of computer language compilers already included with the system. Compilers for everything from C, C++, Objective-C, Fortran, Java Bytecode, etc., can be found in a modern UNIX system.

This is not only a plus for application developers (who needn't spend additional time, effort and money tracking down and buying the compilers they need), it is very helpful to the system administrator who must have version X of application Y and doesn't want to wait for their UNIX vendor to ship it to them.

The most common suite of compilers come from the GNU project (which should come as no surprise) in the form of the GNU Compiler Collection (GCC, http://gcc.gnu.org/). The GNU Compiler Collection contains front ends for C, C++, Objective-C, Fortran, Java, and Ada, as well as libraries for these languages.

This compiler collection can be optimized for many different architectures (especially Intel-class machines) which can result in zippy binaries that are tightly integrated with your hardware.

We will now briefly examine each of the elements of the GCC group. For more information than we will cover here, consult the GCC man and info pages.

gcc

gcc is the front end for the C programming language. gcc originally was the only compiler in this collection, and stood for "GNU C Compiler". If I had a C program "program_a.c" and I wished the compile a binary from it, I would issue:
 gcc -o program_a program_a.c

g++

g++ is the fron end for the C++ programming language.

Classnotes | UNIX01 | RecentChanges | Preferences
This page is read-only | View other revisions | View current revision
Edited July 24, 2003 6:43 pm (diff)
Search:
(C) Copyright 2003 Samuel Hart
Creative Commons License
This work is licensed under a Creative Commons License.