%general-entities; ]> $LastChangedBy$ $Date$ GCC-&gcc-version; Introduction to <application><acronym>GCC</acronym></application> The GCC package contains GNU compilers. This is useful for compiling programs written in C, C++, Fortran, Java, Objective C and Ada. Package Information Download (HTTP): Download (FTP): Download size: &gcc-size; Estimated Disk space required: &gcc-buildsize; Estimated build time: &gcc-time; Additional Downloads Required Patch: Required Patch: Test Suite: <application><acronym>GCC</acronym></application> Dependencies Recommended Installation of <application><acronym>GCC</acronym></application> 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 Download (HTTP): Download (FTP): Download size: &gnat-size; Estimated Disk space required: &gnat-buildsize; Estimated build time: &gnat-time; <application><acronym>GNAT</acronym></application> dependencies Required Installation of <application><acronym>GNAT</acronym></application> 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: ./doinstall The GNAT compiler can be invoked by executing the gcc binary installed by the above script. 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 Return to Installation of <application><acronym>GCC</acronym></application> Install GCC by running the following commands: 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, as well as unpacking the GCC testsuite tarball before beginning the build. 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 . There's also an i686 platform test result produced by an LFS (6.0-testing-20041003) system at . You may also want to refer to the information found in the GCC-Pass 2 section of Chapter 5 in the LFS book. Some of the Java programs installed by the GCC package conflict (have the same names) with programs from the package. If you're installing the Java language from the GCC package but you wish to use the programs from the JDK as the defaults, ensure [JDKpath]/bin is listed before /usr/bin in your PATH variable. patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch && patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch && sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in && mkdir ../gcc-build && cd ../gcc-build && ../gcc-&gcc-version;/configure --prefix=/usr --libexecdir=/usr/lib \ --enable-shared --enable-languages=c,c++,objc,f77,ada,java \ --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu && make bootstrap && make -C gcc gnatlib-shared && make -C gcc gnattools && make -k check && ../gcc-3.4.1/contrib/test_summary && make install && ln -sf ../usr/bin/cpp /lib && ln -sf gcc /usr/bin/cc && ln -sf g77 /usr/bin/f77 && chown -R root:root /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include You may remove the GNAT installation and restore your old PATH: rm -rf /opt/gnat && export PATH=$PATH_HOLD 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-languages=c,c++,objc,f77,ada,java: This command identifies which languages to build. You may modify this command to remove undesired languages. --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. 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.1/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/&gcc-version;/include: If the package is built by a user other than root, the ownership of the installed include directory (and its contents) will be incorrect. This command changes the ownership to root:root. Contents The GCC package contains addr2name.awk, c++, cpp, g++, g77, gcc, gccbug, gcj, gcjh, gcov, gij, gnat, gnatbind, gnatbl, gnatchop, gnatclean, gnatfind, gnatkr, gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref, grepjar, jar, jcf-dump, jv-convert, jv-scan, rmic, rmiregistry and GCC libraries. Description The programs and libraries whose descriptions are missing here have been described in the LFS GCC-&gcc-version; page. addr2name.awk addr2name.awk emulates some of the functionality of addr2line. g77 g77 is the Fortran compiler invoked by gcc. gcj gcj is an ahead-of-time compiler for the Java language. gcjh gcjh generates header files from Java class files. gij gij is the GNU interpreter for Java bytecode. gnat gnat is the Ada compiler invoked by gcc. gnatbind gnatbind is used to bind compiled objects. gnatbl gnatbl is the Ada linker. gnatchop gnatchop is useful for renaming files to meet the standard Ada default file naming conventions. gnatclean gnatclean is used to remove files associated with a GNAT project. gnatfind gnatfind is the GNAT definition/use finder. gnatkr gnatkr is used to determine the crunched name for a given file, when crunched to a specified maximum length. gnatlink gnatlink is used to link programs and build an executable file. gnatls gnatls is the compiled unit browser. gnatmake gnatmake is an automatic make facility. gnatname gnatname will list the files associated with a GNAT project. gnatmem gnatmem is the GNAT utility that monitors dynamic allocation and deallocation activity in a program. gnatprep gnatprep is the GNAT external preprocessor. gnatxref gnatxref is the GNAT cross-referencer. grepjar grepjar searches jar files for a pattern. jar jar is an archive tool for Java archives. jcf-dump jcf-dump prints information about Java class files. jv-convert jv-convert converts files from one encoding to another. jv-scan jv-scan prints information about Java source files. rmic rmic generates stubs for Remote Method Invocation. rmiregistry rmiregistry starts a remote object registry on the current host.