Languages Supported by GCC
3.2 Installing GNU Compiler
In most cases, GCC comes with all Linux distributions. However you can download the latest version, and build and install it according to your requirements. You may also need to build your compiler if you are building a cross-compiling development system. The best way to build a new version of the compiler is to have some pre-installed and pre-configured Linux distribution on your system that will be used to build the new compiler. For the purpose of writing this book, we have used Red Hat 7.1 but the process is the same on any distribution of Linux. The installation process is done in multiple steps. After downloading, you have to untar the source code and build it in a directory. This directory should be separate from the source code directory tree. The building process includes configuration and compiling stages. Once you have successfully created the new compiler, you can install it in a directory of your choice. It is advised to keep this installation directory separate from the location where the original compiler is installed.3.2.1 Downloading
You can download the latest version of GCC from ftp:ftp.gnu.orggnugcc. I down- loaded GCC 3.0.4 and it is about 17.5 MB. You can also find a mirror site near you to get GCC. A list of mirror sites is available on http:www.gnu.orgorderftp.html.3.2.2 Building and Installing GCC
The GCC installation process can be divided into four steps for simplicity and understand- ing.1. Download and extract 2. Configure
3. Build 4. Install
3.2.2.1 Download and Extract First create a directory where you will unpack the source code. Use the tar command to unpack the code. For our purpose, I have created a directory gcc3 to compile and build the GCC compiler. The untar process looks like the following and it creates a directory gcc- 3.0.4 under gcc3 directory. [rootlaptop gcc3] tar zxvf gcc-3.0.4.tar.gz gcc-3.0.4 gcc-3.0.4INSTALL gcc-3.0.4INSTALLindex.html gcc-3.0.4INSTALLREADME gcc-3.0.4INSTALLspecific.html gcc-3.0.4INSTALLdownload.html gcc-3.0.4INSTALLconfigure.html Installing GNU Compiler 49 gcc-3.0.4INSTALLbuild.html gcc-3.0.4INSTALLtest.html gcc-3.0.4INSTALLfinalinstall.html gcc-3.0.4INSTALLbinaries.html gcc-3.0.4INSTALLgfdl.html gcc-3.0.4.cvsignore gcc-3.0.4COPYING gcc-3.0.4COPYING.LIB gcc-3.0.4ChangeLog gcc-3.0.4MAINTAINERS gcc-3.0.4Makefile.in gcc-3.0.4README This is a partial output of the command. Most of the output is truncated to save space. 3.2.2.2 Running configure Script After uncompressing the source code, the first thing is to run the configure script. This script is found in gcc3gcc-3.0.4 directory. You can specify three major things when you run the configure script. 1. Build machine. This is the machine where you compile and build the compiler. 2. Host machine. This is the machine where compiler will be installed. This is usually the same as the build machine.3. Target machine. This is the machine for which the newly built compiler will generate
executable code. If you are building a native compiler, this is the same machine as the host machine. If you are building a cross-compiler, this machine will be different than the host machine. Each of these machines names are used in the following format: CPUname-CompanyName-SystemName For example, if you want to build a compiler that will run on a sparc processor made by Sun Microsystems and on SunOS 4.1 operating system, the command line for configure script will be as follows: .configure –host=sparc-sun-sunos4.1 Please see a list of supported systems at http:gcc.gnu.orgonlinedocsgcc-3.0.4 gcc_4.html . For a native compiler a compiler that runs on the same machine where it is built and gen- erates code for the same machine, you don’t need to specify any options on the command line when you run the configure script. However, if you are building a cross-compiler, you must specify the target machine. Similarly, if you are building a compiler that will be installed on some other machine, you have to specify the host machine.Parts
» the linux development platform 2003
» Requirement Gathering Life Cycle of a Software Development Project
» Writing Functional Specifications Life Cycle of a Software Development Project
» Creating Architecture and Design Documents
» Implementation and Coding Life Cycle of a Software Development Project
» Testing Life Cycle of a Software Development Project
» Technical documentation developed during the development process. This includes
» Technical documentation prepared for technical support staff. This includes technical
» End-user manuals and guides. This is the documentation for the end user to assist the
» Software Releases Support and New Features
» Hardware Platform Components of a Development System
» Operating System Components of a Development System
» Editors Components of a Development System
» Compilers and Assemblers Components of a Development System
» Debuggers Components of a Development System
» Version Control Systems Components of a Development System
» Selection Criteria for Hardware Platform Selection Criteria for Software Development Tools
» Creating Deadlines Managing Development Process
» Managing the Development Team
» Resolving Dependencies Managing Development Process
» Libraries Linux Development Platform Specifications LDPS and Linux
» Open Source Developers Network at http:www.osdn.org
» Extensibility What to Look for in an Editor
» References and Resources the linux development platform 2003
» Target machine. This is the machine for which the newly built compiler will generate
» Post-Installation Tasks Installing GNU Compiler
» Compiling to Intermediate Levels
» Compilation with Debug Support
» Compilation with Optimization Compiling a Program
» Compiling Source Code for Other Languages
» Linking a program Assembling a Program
» Creating Libraries the linux development platform 2003
» Standard Libraries the linux development platform 2003
» Compiling Fortran Programs the linux development platform 2003
» Smalltalk Oberon Other Compilers
» The target 2. Dependencies Basic Terminology
» The explicit rules 2. The implicit rules
» Input Files Introduction to GNU make
» Typical Contents of a Makefile
» Running make Introduction to GNU make
» Shell to Execute Commands Include Files
» The ftp server The The dnsresolver
» FTPOBJS OBJS Another Example of Makefile
» Explicit Rules The make Rules
» Implicit Rules The make Rules
» Defining Variables Types of Variables
» Pre-Defined Variables Automatic Variables
» Makefile in The Top Directory
» Makefile in common-dir Directory
» Makefile in the ftp-dir Directory
» Makefile in the tftp-dir Directory Makefile in the dns-dir Directory
» Building Everything Working with Multiple Makefiles and Directories
» The ifdef Directive Control Structures and Directives
» The ifndef Directive Control Structures and Directives
» Compilation Getting the Latest Version and Installation
» Most Commonly Used gdb Commands
» Passing Command Line Arguments to the Program Being Debugged
» The step and finish Commands
» Introduction to GDB Working with the Stack
» Displaying Program Variables Displaying Variables
» Automatic Displaying Variables with Each Command
» Displaying Environment Variables Displaying Variables
» Modifying Variables Displaying Variables
» Disabling Break Points Enabling Break Points
» Debugging Optimized Code the linux development platform 2003
» Debugging Running Processes the linux development platform 2003
» The kdbg Debugger Other Open Source Debuggers
» The ddd Debugger Other Open Source Debuggers
» The xxgdb Debugger Other Open Source Debuggers
» CVS Policies the linux development platform 2003
» Project Management and Communication
» Remote Repositories Checking out a Project
» Finding the Status of a Project
» Finding Differences Using the CVS Client
» Resolving Conflicts Using the CVS Client
» Checking the Project Back In Adding Files to a Project
» Removing Files from a Project
» Tags and Releases Using the CVS Client
» System Requirements Introduction to jCVS
» Installation Instructions Introduction to jCVS
» Using jCVS Introduction to jCVS
» Installing pcl-cvs Using Emacs with CVS
» Using pcl-cvs Using Emacs with CVS
» Have a shell account on the CVS server. 2. Create a publicprivate key pair on the client.
» Selecting Coding Styles Using indent Utility
» Formatting Braces Using indent Utility
» Formatting Declarations Using indent Utility
» Breaking Long Lines Using indent Utility
» Summary of Options Using indent Utility
» Using sed Utility Using cscope and cbrowser
» Generating C Function Prototypes from C Source Code Using cproto
» Using ltrace and strace Utilities
» Value 2. Type Name Using the nm Utility
» Using the ranlib Utility Using the strip Utility
» Using the strings Utility Using the addr2line Utility
» Host Machine Introduction to the Cross-Platform Development Process
» Target Machine Introduction to the Cross-Platform Development Process
» Cross Platform Development Cycle
» Embedded Systems and Moving Parts
» Embedded Systems and Power Consumption
» Embedded Operating Systems What are Embedded Systems?
» Knowledge of Target System Hardware
» Software Emulators Cross Compilations
» Using gdbserver with GNU Debugger
» Attaching to a Running Process Using gdbserver
» Arcom SBC-GX1 Board Hardware Used for Cross-Platform and Embedded Systems
» Artesyn PMPPC Mezzanine Card
» References the linux development platform 2003
» Java Compiler Java Virtual Machine
» Kaffe the linux development platform 2003
» The Jboss Java Development System
» Getting and Installing Java SDK from Sun Creating jar Files
» Creating Source Code File Compiling Java Code
» Running Java Applications Building Java Applications
» Using gcj to Build Java Applications
» Building Applets the linux development platform 2003
» Testing Applets with Netscape
» Jikes for Java the linux development platform 2003
Show more