%general-entities; ]> $LastChangedBy$ $Date$ GCC-&gcc-version; GCC-&gcc-version; Introduction to GCC The GCC package contains GNU compilers. This package is useful for compiling programs written in C, C++, Fortran, Java, Objective C, Objective C++, and Ada. You should ensure you actually need one of these additional compilers (C and C++ are installed in LFS) before you install them. Additionally, there are instructions in the BLFS book to install , which can be used instead of the Java provided by the GCC package. Many consider the Iced Tea version to be a more robust Java environment than the one provided by GCC. &lfs70_checked; If you are upgrading GCC from any other version prior to &gcc-version;, then you must be careful compiling 3rd party kernel modules. You should ensure that the kernel and all its native modules are also compiled using the same version of GCC that you use to build the 3rd party module. This issue does not affect native kernel (and kernel modules) updates, as the instructions below are a complete reinstallation of GCC. If you have existing 3rd party modules installed, ensure they are recompiled using the updated version of GCC. As always, never update the kernel headers from the ones used when Glibc was compiled during LFS. Package Information Download (HTTP): Download (FTP): Download MD5 sum: &gcc-md5sum; Download size: &gcc-size; Estimated disk space required: &gcc-buildsize; Estimated build time: &gcc-time; GCC Dependencies Recommended 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. At the AdaCore download page, choose your platform and 2010, then select the file to download. You probably want the x86-linux or x86_64-linux file. GNAT GPL 2010 Package Information Download (HTTP): User Notes: Installation of GNAT Before unpacking and changing into the GCC build directory, first unpack the GNAT tarball and change into the newly created directory and install GNAT by running the following command: make ins-all prefix=<Your build directory>/gnat The GNAT compiler can be invoked by executing the gcc binary installed in <Your build directory>/gnat/bin. You may now remove the GNAT source directory: cd .. && rm -rf gnat-2010-i686-gnu-linux-libc2.3-bin Prepare to compile GCC by placing the GNAT version of gcc at the beginning of the PATH variable by using the following commands: PATH_HOLD=$PATH && export PATH=<Your build directory>/gnat/bin:$PATH_HOLD Installation of GCC Install GCC by running the following commands: The installation process may overwrite your existing GCC gcc and c++ compilers 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 are confident the build was successful. You can compare your test results with those found at . You may also want to refer to the information found in the GCC section of Chapter 6 in the LFS book (). The instructions below perform a make bootstrap instead of just a plain make intentionally. Even though it is assumed that the current version of GCC is installed in LFS, because this installation includes the Ada compiler as an installed language, a bootstrap is required. The GNAT compiler must be used for stage1 of the bootstrap in order to build Ada. If the process didn't use a bootstrap you could end up having a gcc installed on the system that was produced by a foreign compiler. sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in && sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in && sed -i 's/Standard/Types/' gcc/ada/uintp.adb && mkdir ../gcc-build && cd ../gcc-build && ../gcc-&gcc-version;/configure \ --prefix=/usr \ --libexecdir=/usr/lib \ --with-system-zlib \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --disable-multilib \ --enable-bootstrap \ --enable-clocale=gnu \ --enable-languages=c,c++,ada,fortran,java,objc,obj-c++ && make bootstrap && make -k check && ../gcc-&gcc-version;/contrib/test_summary Now, as the root user: make install && ln -v -sf ../usr/bin/cpp /lib && ln -v -sf gcc /usr/bin/cc && chown -v -R root:root \ /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include \ /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/ada{lib,include} The libffi interface header is installed in a location where other packages will not be able to find it. If you included Java as one of the installed languages, create a symbolic link in /usr/include to remedy this: ln -v -sf `find /usr/lib/gcc -name ffitarget.h` /usr/include You should now become the unprivileged user and remove the GNAT installation and perform other cleanups: rm -rf <Your build directory>/gnat export PATH=$PATH_HOLD && unset PATH_HOLD Command Explanations The two sed commands are the same ones used during the build of LFS. The third one fixes an issue with the ADA build. 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 parameters are required to build the C++ libraries to published standards. --disable-multilib: This parameter ensures that files are created for the specific architecture of your computer. --enable-bootstrap: This parameter is used so that a bootstrap installation is performed. --enable-clocale=gnu: This parameter is a failsafe for incomplete locale data. --enable-languages=c,c++,ada,fortran,java,objc,obj-c++: This command identifies which languages to build. You may modify this command to remove undesired languages. make -k check: This command runs the test suite without stopping if any errors are encountered. ../gcc-&gcc-version;/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 -v -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 -v -sf gcc /usr/bin/cc: This link is created as some packages refer to the C compiler using an alternate name. chown -v -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 the root user and group . Omit the command changing the Ada directories if you did not include Ada as one of the installed languages. Contents Installed Programs Installed Libraries Installed Directories addr2name.awk, fastjar, gcj, gcj-dbtool,gcjh, gfortran, gij, gjnih, gnat, gnatbind, gnatbl, gnatchop, gnatclean, gnatfind, gnatkr, gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref, gprmake, grepjar, grmic, grmiregistry, gtreelang, jcf-dump, jv-convert, jv-scan and architecture specific names for gcj and gcjh libffi.{so,a}, libgcj.{so,a}, libgfortran.{so,a}, libgfortranbegin.a, libgij.{so,a}, libobjc.{so,a} and numerous other run-time libraries and executables in /usr/lib/gcc /usr/include/c++/&gcc-version;/{gcj,gnu,java,javax,org}, /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/ada{include,lib}, /usr/lib/gcj-&gcc-version;, /usr/lib/security, and /usr/share/java Some program and library names and descriptions are not listed here, but can be found at as they were initially installed during the building of LFS. Short Descriptions addr2name.awk emulates some of the functionality of addr2line. addr2name.awk fastjar is an archive tool for Java archives. fastjar gcj is an ahead-of-time compiler for the Java language. gcj gcj-dbtool is a tool for creating and manipulating class file mapping databases. gcj-dbtool gcjh generates header files from Java class files. gcjh gfortran is the Fortran compiler invoked by gcc. gfortran gij is the GNU interpreter for Java bytecode. gij gjnij is used to generate JNI header files from class files. Running it is equivalent to running gcjh -jni. gjnih gnat is the Ada compiler invoked by gcc. gnat gnatbind is used to bind compiled objects. gnatbind gnatbl is the Ada linker. gnatbl gnatchop is useful for renaming files to meet the standard Ada default file naming conventions. gnatchop gnatclean is used to remove files associated with a GNAT project. gnatclean gnatfind is the GNAT definition/use finder. gnatfind gnatkr is used to determine the crunched name for a given file, when crunched to a specified maximum length. gnatkr gnatlink is used to link programs and build an executable file. gnatlink gnatls is the compiled unit browser. gnatls gnatmake is an automatic make facility. gnatmake gnatname will list the files associated with a GNAT project. gnatname gnatprep is the GNAT external preprocessor. gnatprep gnatxref is the GNAT cross-referencer. gnatxref gprmake is a tool used to create Makefiles that support compilation by multiple languages. gprmake grepjar searches jar files for a pattern. grepjar grmic generates stubs for Remote Method Invocation. grmic grmiregistry starts a remote object registry on the current host. grmiregistry gtreelang is largely a cut down version of C, designed to showcase the features of the GCC code generation back end. Only those features that are directly supported by the GCC code generation back end are implemented. Features are implemented in a manner which is easiest and clearest to implement. Not all or even most code generation back end features are implemented. The intention is to add features incrementally until most features of the GCC back end are implemented in Treelang. gtreelang jcf-dump prints information about Java class files. jcf-dump jv-convert converts files from one encoding to another. jv-convert jv-scan prints information about Java source files. jv-scan