GCC-3.4.3

Introduction to GCC

The GCC package contains GNU compilers. This is useful for compiling programs written in C, C++, Fortran, Java, Objective C and Ada.

Package Information

Additional Downloads

GCC Dependencies

Recommended

DejaGnu-1.4.4

[Note]

Note

If you plan to compile Ada, you will need to install GNAT temporarily to satisfy the circular dependency when you recompile GCC to include Ada.

Package Information

GNAT Dependencies

Required

Tcsh-6.14.00

Installation of GNAT

Install GNAT by running the following commands:

./doconfig

The above script will ask you how and where you would like to install GNAT. To avoid conflicts with the system gcc, the package will be installed in a separate directory, that can later be removed from the system.

In response to the questions asked by the doconfig script, enter 3 in response to the first question and /opt/gnat in response to the second question.

To finish the install, run the following command as the root user:

./doinstall

The GNAT compiler can be invoked by executing the gcc binary installed by the above script.

You may now remove the GNAT source directory:

cd .. &&
rm -rf gnat-3.15p-i686-pc-linux-gnu-bin

Prepare to compile GCC by placing the GNAT gcc at the beginning of the PATH variable by using the following commands:

PATH_HOLD=$PATH &&
export PATH=/opt/gnat/bin:$PATH

Installation of GCC

Install GCC by running the following commands:

[Important]

Important

The installation process may overwrite your existing GCC compiler and libraries. It is highly recommended that you have the Tcl, Expect and DejaGnu packages installed before beginning the build so you can run the full suite of tests.

Do not continue with the make install command until you're confident the build was successful. You can compare your test results with those found at http://gcc.gnu.org/ml/gcc-testresults/. There's also an i686 platform test result produced by an LFS-6.1 system at http://linuxfromscratch.org/~randy/gcc343_test.txt. You may also want to refer to the information found in the GCC-Pass 2 section of Chapter 5 in the LFS book ( ../../../../lfs/view/stable/chapter05/gcc-pass2.html).

patch -Np1 -i ../gcc-3.4.3-no_fixincludes-1.patch &&
patch -Np1 -i ../gcc-3.4.3-linkonce-1.patch &&
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &&
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-3.4.3/configure --prefix=/usr --libexecdir=/usr/lib \
    --enable-shared --enable-threads=posix --enable-__cxa_atexit \
    --enable-clocale=gnu --enable-languages=c,c++,objc,f77,ada,java &&
make bootstrap &&
make -C gcc gnatlib-shared &&
make -C gcc gnattools &&
make -k check &&
../gcc-3.4.3/contrib/test_summary

Now, as the root user:

make install &&
ln -v -sf ../usr/bin/cpp /lib &&
ln -v -sf gcc /usr/bin/cc &&
ln -v -sf g77 /usr/bin/f77 &&
chown -v -R root:root \
    /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include &&
chown -v -R root:root \
    /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/ada{lib,include}

There is a bug in the installation of the libffi interface headers. The architecture specific ffitarget.h file is not installed. If you included Java as one of the installed languages, install the missing file using the command below. Substitute for the [arch] in the command with the appropriate directory path for your system.

install -v -m644 ../gcc-3.4.3/libffi/src/[arch]/ffitarget.h \
    /usr/include

As the root user, remove the GNAT installation:

rm -rf /opt/gnat

Now, as the unprivileged user, restore your old PATH:

export PATH=$PATH_HOLD &&
unset PATH_HOLD
[Note]

Note

Some of the Java programs installed by the GCC package conflict (have the same names) with programs from the JDK-1.5.0 package. If you installed the Java language from the GCC package but you wish to use the programs from the JDK as the defaults, ensure $JAVA_HOME/bin is listed before /usr/bin in your PATH variable.

Command Explanations

sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in: This command suppresses the installation of libiberty.a as the version provided by Binutils is used instead.

mkdir ../gcc-build; cd ../gcc-build: The GCC documentation recommends building the package in a dedicated build directory.

--enable-shared --enable-threads=posix --enable-__cxa_atexit: These commands are required to build the C++ libraries to published standards.

--enable-clocale=gnu: This command is a failsafe for incomplete locale data.

--enable-languages=c,c++,objc,f77,ada,java: This command identifies which languages to build. You may modify this command to remove undesired languages.

make -C gcc gnatlib-shared: This command builds the Ada shared and static libraries. Skip this step if you have not enabled Ada as one of the languages.

make -C gcc gnattools: This command builds the Ada development tools and binaries. Skip this step if you have not enabled Ada as one of the languages.

make -k check: This command runs the test suite without stopping should any errors be encountered.

../gcc-3.4.3/contrib/test_summary: This command will produce a summary of the test suite results. You can append | grep -A7 Summ to the command to produce an even more condensed version of the summary. You may also wish to redirect the output to a file for review and comparison later on.

ln -sf ../usr/bin/cpp /lib: This command creates a link to the C PreProcessor as some packages expect it to be installed in the /lib directory.

ln -sf gcc /usr/bin/cc; ln -sf g77 /usr/bin/f77: These links are created as some packages refer to the C and Fortran compilers using an alternate name.

chown -R root:root /usr/lib/gcc/i686-pc-linux-gnu/...: If the package is built by a user other than root, the ownership of the installed include and adalib directories (and their contents) will be incorrect. These commands change the ownership to root:root. Omit the command changing the Ada directories if you did not include Ada as one of the installed languages.

Contents

Installed Programs: addr2name.awk, cc, c++, cpp, f77, g++, g77, gcc, gccbug, gcj, gcjh, gcov, gij, gnat, gnatbind, gnatbl, gnatchop, gnatclean, gnatfind, gnatkr, gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref, gpr2make, gprcmd, grepjar, jar, jcf-dump, jv-convert, jv-scan, rmic, rmiregistry and architecture specific names for c++, g++, gcc, gcc-3.4.3, gcj, and gcjh
Installed Libraries: lib-org-w3c-dom.[so,a], lib-org-xml-sax.[so,a], libffi-2.00-beta.so, libffi.[so,a], libfrtbegin.a, libg2c.[so,a], libgcc_s.so, libgcj.[so,a], libobjc.[so,a], libstdc++.[so.6,a], libsupc++.a, and numerous other run-time libraries and executables in /usr/lib/gcc
Installed Directories: /usr/include/c++, /usr/include/gcj, /usr/include/gnu, /usr/include/java, /usr/include/javax, /usr/lib/gcc, /usr/lib/security, /usr/share/gnat, and /usr/share/java

Short Descriptions

Some program and library descriptions are not listed here, but can be found at ../../../../lfs/view/stable/chapter06/gcc.html#contents-gcc.

addr2name.awk

emulates some of the functionality of addr2line.

f77

is a symlink to g77, created for compatibility purposes.

g77

is the Fortran compiler invoked by gcc.

gcj

is an ahead-of-time compiler for the Java language.

gcjh

generates header files from Java class files.

gij

is the GNU interpreter for Java bytecode.

gnat

is the Ada compiler invoked by gcc.

gnatbind

is used to bind compiled objects.

gnatbl

is the Ada linker.

gnatchop

is useful for renaming files to meet the standard Ada default file naming conventions.

gnatclean

is used to remove files associated with a GNAT project.

gnatfind

is the GNAT definition/use finder.

gnatkr

is used to determine the crunched name for a given file, when crunched to a specified maximum length.

gnatlink

is used to link programs and build an executable file.

gnatls

is the compiled unit browser.

gnatmake

is an automatic make facility.

gnatname

will list the files associated with a GNAT project.

gnatprep

is the GNAT external preprocessor.

gnatxref

is the GNAT cross-referencer.

gpr2make

is a tool used to create Makefiles that support compilation by multiple languages.

gprcmd

is a utility used by Makefile.generic to handle multi-language builds. It provides a set of commands so that the Makefiles do not need to depend on Unix utilities not available on all targets.

grepjar

searches jar files for a pattern.

jar

is an archive tool for Java archives.

jcf-dump

prints information about Java class files.

jv-convert

converts files from one encoding to another.

jv-scan

prints information about Java source files.

rmic

generates stubs for Remote Method Invocation.

rmiregistry

starts a remote object registry on the current host.

Last updated on 2005-08-01 13:29:19 -0600