Loading...

hints@linuxfromscratch.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Updating a hint William Immendorf Mon Dec 22 00:05:11 2008

I am updating a hint that is very useful for LFS. It is attached.
AUTHOR: William Immendorf <[EMAIL PROTECTED]>

DATE: 2008-12-20

LICENSE: Creative Commons Attribution-Noncommercial-Share Alike 3.0 United 
States License
         http://creativecommons.org/licenses/by-nc-sa/3.0/us/

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.x.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 Randy's
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.3.2.tar.bz2

2. The 2005 version of the GNAT compiler found on the AdaCore site. The
download location (https://libre.adacore.com/dynamic/download_page) requires
that you create an account on the AdaCore site before you can download the
package. Nothing is required other than a valid email address. Ensure you
download the 2005 version of the GNAT compiler. The 2006 version will not work.
The file name you need is: gnat-gpl-2005-i686-gnu-linux-gnu-libc2.3-bin.tar.gz. 
(not required if your host system has an existing Ada compiler, or you don't
plan on installing the GCC Ada compiler)

3. A Zip tarball if you are building the Java comp. See
http://www.info-zip.org/Zip.html#Sources for download locations.

4. An Unzip tarball if you are building the Java comp. See
http://www.info-zip.org/UnZip.html#Downloads for download locations.

PREREQUISITES:

None

HINT:

=========
CONTENTS:
=========

        1.  Introduction
        2.  The Treelang compiler
        3.  The Fortran compiler
              GMP installation
              MPFR installation
              GCC installation
        4.  The Ada compiler
        5.  Package dependencies
        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 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 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 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:
=========================

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, you'll need to install the Bison and Flex
packages before starting the Chapter 6 build of GCC.

=========================
3. THE JAVA COMPILER
=========================

gjar, a part of gcj, needs Zip and Unzip to build. Use BLFS instructions for 
both.


====================
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.

====================================
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 from the Adacore site.

2. Unpack the tarball and change directories into the root of the source tree.

3. Issue the following command to install the GNAT compiler:

make ins-all prefix=/tools/gnat

You should check and ensure that the /tools/gnat directory was created and
populated with files. The GNAT source tree can then be removed.

=================================
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.3.2/adainclude
(modify the GCC version number in the path shown above)

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:

* Jim Gifford for the tip about using the existing Makefile to install GNAT.
* The LFS community for creating and maintaining such a cool project.


CHANGELOG:

[2007-07-01]
    * Updated the Gnat download instructions
    * Updated the requirements to install the 'treelang' language
    * Updated the GMP installation instructions

[2006-05-18]
    * Changed the GNAT installation to use the existing Makefile, which
      eliminates the need to install Tcsh.

[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.

[2005-03-14]
    * Fixed typo
    * Modified the Chapter 5 instructions to not use forced static build

[2005-03-13]
    * Added instructions to change the ownership of the Ada interface header 
      include files to root

[2005-03-12]
    * Original draft

-- 
http://linuxfromscratch.org/mailman/listinfo/hints
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page