r1031 - trunk

archaic at linuxfromscratch.org archaic at linuxfromscratch.org
Thu May 4 16:20:02 PDT 2006


Author: archaic
Date: 2006-05-04 17:20:01 -0600 (Thu, 04 May 2006)
New Revision: 1031

Added:
   trunk/all_of_gcc_during_lfs.txt
Log:
Added: all_of_gcc_during_lfs.txt

Added: trunk/all_of_gcc_during_lfs.txt
===================================================================
--- trunk/all_of_gcc_during_lfs.txt	                        (rev 0)
+++ trunk/all_of_gcc_during_lfs.txt	2006-05-04 23:20:01 UTC (rev 1031)
@@ -0,0 +1,430 @@
+AUTHOR: Randy McMurchy <randy_at_linuxfromscratch_dot_org>
+
+DATE: 2006-05-04
+
+LICENSE: Creative Commons Attribution-NonCommercial-ShareAlike License
+         http://creativecommons.org/licenses/by-nc-sa/1.0/
+
+SYNOPSIS: Installing all the GCC compilers while building LFS
+
+DESCRIPTION: This hint will guide you through the installation of any or all
+the GCC compilers while building an LFS system. These instructions target
+the 4.0.x series of GCC as there have been significant changes since the
+3.x.x series. Prior to the 4.x.x series, only the Ada compiler could not be
+installed during Chapter 6 of an LFS build. See my
+http://www.linuxfromscratch.org/hints/downloads/files/ada_install_during_lfs.txt
+hint for instructions to install the Ada compiler during an LFS build if you
+are using a version of GCC prior to 4.x.x.
+
+ATTACHMENTS: None
+
+REQUIRED DOWNLOADS: 
+
+1. The GCC tarball for whatever version of GCC called for in LFS. This will
+be a file named something similar to gcc-4.0.3.tar.bz2
+
+2. http://anduin.linuxfromscratch.org/sources/BLFS/svn/g/gnat-3.15p-i686-pc-redhat71-gnu-bin.tar.bz2
+(not required if your host system has an existing Ada compiler, or you don't
+plan on installing the GCC Ada compiler)
+
+3. A GMP tarball if you plan on installing the Fortran 95 compiler. See
+http://www.linuxfromscratch.org/blfs/view/svn/general/gmp.html for download
+locations.
+
+4. An MPFR tarball if you plan on installing the Fortran 95 compiler. See
+http://www.mpfr.org/mpfr-current/ for download locations.
+
+PREREQUISITES:
+
+You must have a csh shell installed on the host system if you plan on
+installing the Ada compiler and you don't already have an existing Ada
+compiler on the host system. Instructions for installing the Tcsh package
+can be found at:
+http://www.linuxfromscratch.org/blfs/view/svn/postlfs/tcsh.html
+
+HINT:
+
+=========
+CONTENTS:
+=========
+
+        1.  Introduction
+        2.  The Treelang compiler
+        3.  The Fortran 95 compiler
+              GMP installation
+              MPFR installation
+              GCC installation
+        4.  The Ada compiler
+        5.  Package dependencies
+              csh shell installation
+        6.  Installing the GNAT Ada compiler
+        7.  Configuring the PATH variable
+        8.  Chapter 5 GCC-Pass1 Modifications
+        9.  Reconfiguring the PATH variable
+        10. Chapter 5 GCC-Pass2 Modifications
+        11. Chapter 5 Ncurses modifications
+        12. Chapter 6 GCC Modifications
+        13. Chapter 6 Ncurses modifications
+        14. Closing
+
+================
+1. INTRODUCTION:
+================
+
+The default installation during LFS only installs a C and C++ compiler. If
+you know that you'll need additional compilers after LFS is built, it is
+easier to just build the additional compilers during LFS. So, you say to
+yourself, when I get to the GCC installation in Chapter 6 of LFS, I'll just
+add additional compilers to the configure script command and I'll build them
+then. This won't work for the Ada, Fortran 95 or Treelang compilers. For
+these three compilers, you cannot wait until the GCC installation in Chapter
+6 to decide you want/need to install them (Fortran 95 is a slight exception
+to this). At this point of Chapter 6, you are in a chroot environment
+working with whatever is installed in the /tools directory you created in
+Chapter 5 and there are not adequate tools, nor any real way to add them,
+to compile Ada and Treelang.
+
+In summary, if you need to install the Ada, Fortran 95 or Treelang compilers
+during Chapter 6 of an LFS build, you'll need to do some extra work. The
+Java and Objective C compilers can be installed by simply adding them to the
+list of compilers in the configure script parameter, --enable-languages=...
+
+In order to install the GCC Ada compiler, you must have an existing Ada 
+compiler available so GCC can boostrap its version of Ada. If your host has 
+an existing Ada compiler, you can omit some of this hint and simply use the 
+updated Chapter 5 and Chapter 6 GCC installation instructions. More on this 
+in the appropriate sections later in the hint.
+
+=========================
+2. THE TREELANG COMPILER:
+=========================
+
+Note that this information about the Treelang compiler has not been tested,
+but I feel it should work. In my most recent build of GCC during LFS,
+Treelang failed to build, and I just didn't have it in me to start over. The
+fix seems so trivial, and I don't need the Treelang compiler, so I just
+moved on.
+
+You probably don't need the Treelang compiler. It is only good for
+developers who are developing a new compiler for GCC. However, if you wish
+to build it during a build of LFS, simply install the Flex package at the
+end of Chapter 5 of LFS. Best I could tell, Treelang failed to build for me
+because Flex wasn't available at the point where you install GCC in Chapter
+6.
+
+I might have been able to build Flex before GCC in Chapter 6, but it simply
+wasn't worth trying. Before GCC is installed in Chapter 6, you're still
+using the GCC built in Chapter 5, and things are somewhat wierd at this
+point. More on this in the Fortran 95 section.
+
+Anyway, install Flex at the end of Chapter 5 while building LFS and Treelang
+will probably build okay in Chapter 6. Instructions for installing Flex can
+be found in Chapter 6 of the LFS book.
+
+==========================
+3. THE FORTRAN 95 COMPILER
+==========================
+
+Starting with version 4.x.x of GCC, there is no longer support for the
+Fortran 77 series of compilers. Fortran 95 is now included with GCC. In
+order to build the Fortran 95 compiler, the system must have the GMP and
+MPFR packages installed. See the "REQUIRED DOWNLOADS" section above for
+links to information about these packages.
+
+Installing these packages in Chapter 5 may end up producing undesireable
+results as GCC may look for bits of these packages later in a /tools
+directory which won't exist any longer. So, it is safer to install these
+packages in Chapter 6. Installation of packages is somewhat wierd before GCC
+is installed in Chapter 6, but using the extra parameters shown below seemed
+to get GMP, MPFR and Fortran 95 installed correctly.
+
+Both of these packages should be built after Binutils and before GCC in
+Chapter 6. GMP should be installed first.
+
+----------------
+GMP Installation
+----------------
+
+The BLFS book shows to use these two parameters passed to the configure
+script: --enable-cxx and --enable-mpbsd. This will not work at this point of
+Chapter 6. I didn't test using just the --enable-mpbsd alone, so it may or
+may not work here. For certain, you cannot use the --enable-cxx parameter as
+configure will bitch loudly about a C++ compiler not being available. Even
+though C++ was installed in Chapter 5, at this point of Chapter 6 the
+toolchain has already been readjusted. Apparently, this makes the Autotools
+look for dependencies in /usr instead of /tools. So, don't use --enable-cxx
+when building GMP (as mentioned, I also left off --enable-mpbsd) and things
+should be fine.
+
+-----------------
+MPFR Installation
+-----------------
+
+The installation of MPFR must also be slightly modified at this point for
+a good installation. I found that I had to add --with-gmp-include=/usr/include
+to the configure script so MPFR could find GMP's library interface header.
+Here are the commands I used to install MPFR:
+
+./configure --prefix=/usr \
+            --enable-thread-safe \
+            --enable-shared \
+            --with-gmp-include=/usr/include
+make
+make html
+make check
+make install
+
+----------------
+GCC Installation
+----------------
+
+At this point (GMP and MPFR installations complete), you can add the f95
+language to the --enable-languages switch on GCC's configure and expect it
+to successfully build Fortran 95. However, you also need to add a couple
+more parameters to the configure script so that configure can find the two
+packages you just installed. I'm not certain, but apparently it must look
+in /tools for these packages, so parameters are added to configure to tell
+it to look in /usr. Add these two parameters to GCC's configure script:
+
+        --with-mpfr=/usr
+        --with-gmp=/usr
+
+The complete command I used to install all the compilers was:
+
+../gcc-4.0.3/configure \
+        --prefix=/usr \
+        --libexecdir=/usr/lib \
+        --enable-shared \
+        --enable-threads=posix \
+        --enable-__cxa_atexit \
+        --enable-clocale=gnu \
+        --with-mpfr=/usr \
+        --with-gmp=/usr \
+        --enable-languages=c,c++,objc,f95,ada,java
+
+====================
+4. THE ADA COMPILER:
+====================
+
+Starting with version 4.x.x of GCC, the Ada installation is simpler, but it
+still requires an initial boostrap using an existing Ada compiler. If you
+have an Ada compiler on the host system you're building LFS on, there 
+isn't much required before you can just build GCC.
+
+========================
+5. PACKAGE DEPENDENCIES:
+========================
+
+As previously mentioned, if you already have an existing Ada compiler on the
+host system, you won't need to install the GNAT binary Ada compiler. You can
+skip to step 7 and configure your path.
+
+If you don't have an existing Ada compiler, you'll need to install the GNAT 
+binary version available from the URL shown in the "REQUIRED DOWNLOADS"
+section at the beginning of the hint.
+
+The GNAT binary version installation requires a csh shell to run the 
+configuration script.
+
+----------------------
+csh shell installation
+----------------------
+
+If you don't have a csh shell available on the host system, follow the 
+instructions found at: 
+http://www.linuxfromscratch.org/blfs/view/svn/postlfs/tcsh.html
+
+This must be done before starting your LFS build, from another terminal
+before continuing if you are in the middle of something using your existing
+terminal, or using your existing terminal and ensure you install the csh
+on your host system, and not in /tools.
+
+====================================
+6. INSTALLING THE GNAT ADA COMPILER:
+====================================
+
+You'll need to install the GNAT Ada compiler before starting the Chapter 5 
+GCC-Pass1 instructions in the LFS book. This is right after the Binutils-Pass1 
+installation.
+
+Here's the simple installation procedure for the GNAT Ada compiler:
+
+1. Download the tarball:
+
+http://anduin.linuxfromscratch.org/sources/BLFS/svn/g/gnat-3.15p-i686-pc-redhat71-gnu-bin.tar.bz2
+
+2. Issue the following commands to unpack the tarball and configure the
+installation:
+
+tar xf gnat-3.15p-i686-pc-redhat71-gnu-bin.tar.gz
+cd gnat-3.15p-i686-pc-linux-gnu-bin
+./doconfig
+
+(answer "3" at the first prompt asking what type of installation you desire, 
+and answer "/tools/gnat" when prompted for an installation path)
+
+3. Issue the following command to install the GNAT compiler:
+
+./doinstall
+
+You should check and ensure that the /tools/gnat directory was created and
+populated with files.
+
+=================================
+7. CONFIGURING THE PATH VARIABLE:
+=================================
+
+You'll need to modify the PATH variable so that the newly installed GNAT 
+compiler is used to bootstrap GCC. Issue the following commands:
+
+PATH_HOLD=$PATH
+export PATH=/tools/gnat/bin:$PATH_HOLD
+
+Ensure your PATH variable was changed properly:
+
+echo $PATH
+
+And if you have the 'which' command installed on your host:
+
+which gcc
+
+NOTE: if you're using an existing Ada compiler from your host, make the 
+appropriate substitutions above so this compiler is invoked by the 'gcc'
+command.
+
+=====================================
+8. CHAPTER 5 GCC-PASS1 MODIFICATIONS:
+=====================================
+
+There's some changes required to the Chapter 5 installation of GCC-Pass1.
+
+1. You'll need to unpack the gcc-ada tarball along with the gcc-core tarball
+so the GCC Ada sources are available. Alternatively, just unpack the combined
+GCC tarball which contains all the compilers.
+
+2. Modify the ./configure command to pass --enable-languages=c,ada
+(Note the addition of ",ada")
+
+Except for the changes shown above, follow the commands as outlined in the
+Chapter 5 GCC-Pass1 instructions in LFS.
+
+If desired, remove the /tools/gnat directory at the conclusion of the
+Chapter 5 GCC-Pass1 instructions, as the GNAT compiler won't be required any
+longer. All remaining GCC installations are done using the now existing GCC
+version of Ada.
+
+===================================
+9. RECONFIGURING THE PATH VARIABLE:
+===================================
+
+Now that you are done with the GNAT compiler, put your PATH variable back
+like it was using the following commands:
+
+export PATH=$PATH_HOLD
+unset PATH_HOLD
+
+Ensure your PATH variable was changed properly:
+
+echo $PATH
+
+And if you have the 'which' command installed on your host:
+
+which gcc
+which gnat
+
+=====================================
+10. CHAPTER 5 GCC-PASS2 MODIFICATIONS:
+=====================================
+
+There's some changes required to the Chapter 5 installation of GCC-Pass2.
+
+1. You'll need to unpack the gcc-ada tarball along with the gcc-core and 
+gcc-g++ tarballs so the GCC Ada sources are available. Alternatively, just 
+unpack the combined GCC tarball which contains all the compilers.
+
+2. Modify the ./configure command to pass --enable-languages=c,c++,ada
+(Note the addition of ",ada")
+
+Except for the changes shown above, follow the commands as outlined in
+the Chapter 5 GCC-Pass2 instructions in LFS.
+
+===================================
+11. CHAPTER 5 NCURSES MODIFICATIONS:
+===================================
+
+Remove the --without-ada switch in the Chapter 5 installation of the Ncurses
+package if you desire for Ncurses to be Ada-aware and build the Ada hooks.
+I'm not real sure this is required in Chapter 5, but I've never bothered to
+test and see. I just remove the switch and let it build the Ada components.
+
+===============================
+12. CHAPTER 6 GCC MODIFICATIONS:
+===============================
+
+There's some changes required to the Chapter 6 installation of GCC.
+
+1. You'll need to unpack the gcc-ada tarball along with the gcc-core and 
+gcc-g++ tarballs so the GCC Ada sources are available. Alternatively, just 
+unpack the combined GCC tarball which contains all the compilers. At this
+point also decide if you'd like to install additional (or all) compilers.
+There's nothing keeping you from installing all of the compilers included
+in the GCC source tarball (providing you followed the other instructions in
+this hint for Fortran 95 and Treelang). Do remember to also unpack the
+testsuite tarball if you used the individual compiler tarballs.
+
+2. Modify the ./configure command to pass --enable-languages=c,c++,ada
+(Note the addition of ",ada")
+
+***** Alternatively, use --enable-languages=all, or add any other additional
+***** compilers on the --enable-languages= parameter.
+
+3. After the "make install" step, issue the following command:
+
+chown -v -R root:root /usr/lib/gcc/i686-pc-linux-gnu/4.0.3/adainclude
+
+Except for the changes shown above, follow the commands as outlined in the
+Chapter 6 GCC instructions in LFS.
+
+===================================
+13. CHAPTER 6 NCURSES MODIFICATIONS:
+===================================
+
+If you installed an Ada compiler and you didn't use a parameter to the
+Ncurses configure script to prevent it from building the Ncurses Ada
+components, issue the following command to change the ownership of some
+installed files to the root user.
+
+chown -v -R root:root /usr/lib/ada/adainclude
+
+===========
+14. CLOSING:
+===========
+
+Following these easy instructions allows you to install the full suite of
+GCC compilers during your LFS build, eliminating the time-consuming and 
+perhaps risky process of reinstalling C and C++ later on during your BLFS
+adventure.
+
+ACKNOWLEDGEMENTS:
+
+The LFS community
+
+CHANGELOG:
+
+[2005-03-12]
+    * Original draft
+
+[2005-03-13]
+    * Added instructions to change the ownership of the Ada interface header 
+      include files to root
+
+[2005-03-14]
+    * Fixed typo
+    * Modified the Chapter 5 instructions to not use forced static build
+
+[2006-05-03]
+    * Updated for the LFS-6.2 version, including installing the 4.0.3
+      compiler. Added instructions to install all the compilers, not just
+      the Ada compiler.
+
+




More information about the hints mailing list