gcc/g++ compiler in LFS

Anand Arumugam anand.arumug at gmail.com
Fri Nov 12 06:15:36 PST 2010


Message: 2
Date: Thu, 11 Nov 2010 09:32:24 -0500
From: Anand Arumugam <anand.arumug at gmail.com>
Subject: gcc/g++ compiler in LFS
To: lfs-support at linuxfromscratch.org
Message-ID:
       <AANLkTikt-3NDwEEdhcF0WJX+m9W9sc+eSAYBaa0a4rCc at mail.gmail.com<AANLkTikt-3NDwEEdhcF0WJX%2Bm9W9sc%2BeSAYBaa0a4rCc at mail.gmail.com>
>
Content-Type: text/plain; charset="iso-8859-1"

Hello All,

I just completed the installation of all the tools specified in chapter 5 of
LFS v6.7.

While installing file-5.04 after gcc pass-2, I noticed the presence of
i686-pc-linux-gnu folder when I ran .configure. I checked the
/mnt/lfs/tools/ folder and found this:

$ ls -l /mnt/lfs/tools/
total 40
drwxr-xr-x  2 lfs lfs 4096 Nov  9 20:22 bin
drwxr-xr-x  2 lfs lfs 4096 Nov  7 19:06 etc
*drwxr-xr-x  4 lfs lfs 4096 Nov  7 17:14 i686-lfs-linux-gnu
drwxr-xr-x  4 lfs lfs 4096 Nov  7 19:36 i686-pc-linux-gnu
*drwxr-xr-x 32 lfs lfs 4096 Nov  9 20:22 include
drwxr-xr-x  7 lfs lfs 4096 Nov  9 20:22 lib
drwxr-xr-x  4 lfs lfs 4096 Nov  7 19:06 libexec
drwxr-xr-x  7 lfs lfs 4096 Nov  9 20:22 man
drwxr-xr-x  2 lfs lfs 4096 Nov  7 19:06 sbin
drwxr-xr-x 11 lfs lfs 4096 Nov  9 20:22 share

I was of the impression that there should be no reference to '*
i686-pc-linux-gnu*'. The config.guess script which I ran to find out the
guessed name returned '*i686-lfs-linux-gnu*'. Both these folders have the
same contents.

./configure for file-5.04 gave the following output:

checking whether the gcc linker (/mnt/lfs/tools/i686-pc-linux-
gnu/bin/ld)
supports shared libraries... yes
checking for ld used by g++... /mnt/lfs/tools/i686-pc-linux-gnu/bin/ld
checking if the linker (/mnt/lfs/tools/i686-pc-linux-gnu/bin/ld) is GNU
ld... yes
checking whether the g++ linker (/mnt/lfs/tools/i686-pc-linux-gnu/bin/ld)
supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC
checking if g++ PIC flag -fPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking whether the g++ linker (/mnt/lfs/tools/i686-pc-linux-gnu/bin/ld)
supports shared libraries... yes

Does this mean I have to redo everything from "Adjusting the tool chain"
step?

Also in /mnt/lfs/tools/bin folder, I find

-rwxr-xr-x 1 lfs lfs 2725723 Nov  7 17:14 i686-lfs-linux-gnu-addr2line
-rwxr-xr-x 2 lfs lfs 2856241 Nov  7 17:14 i686-lfs-linux-gnu-ar
-rwxr-xr-x 2 lfs lfs 4035121 Nov  7 17:14 i686-lfs-linux-gnu-as
-rwxr-xr-x 1 lfs lfs 2703498 Nov  7 17:14 i686-lfs-linux-gnu-c++filt
-rwxr-xr-x 1 lfs lfs  488288 Nov  7 17:56 i686-lfs-linux-gnu-cpp
-rwxr-xr-x 2 lfs lfs  485385 Nov  7 17:56 i686-lfs-linux-gnu-gcc
-rwxr-xr-x 2 lfs lfs  485385 Nov  7 17:56 i686-lfs-linux-gnu-gcc-4.5.1
-rwxr-xr-x 1 lfs lfs   16119 Nov  7 17:56 i686-lfs-linux-gnu-gccbug
-rwxr-xr-x 1 lfs lfs   85427 Nov  7 17:56 i686-lfs-linux-gnu-gcov
-rwxr-xr-x 1 lfs lfs 3109651 Nov  7 17:14 i686-lfs-linux-gnu-gprof
-rwxr-xr-x 2 lfs lfs 3641292 Nov  7 17:14 i686-lfs-linux-gnu-ld
-rwxr-xr-x 2 lfs lfs 2759384 Nov  7 17:14 i686-lfs-linux-gnu-nm
-rwxr-xr-x 2 lfs lfs 3294785 Nov  7 17:14 i686-lfs-linux-gnu-objcopy
-rwxr-xr-x 2 lfs lfs 3748901 Nov  7 17:14 i686-lfs-linux-gnu-objdump
-rwxr-xr-x 2 lfs lfs 2856272 Nov  7 17:14 i686-lfs-linux-gnu-ranlib
-rwxr-xr-x 1 lfs lfs  577126 Nov  7 17:14 i686-lfs-linux-gnu-readelf
-rwxr-xr-x 1 lfs lfs 2752088 Nov  7 17:14 i686-lfs-linux-gnu-size
-rwxr-xr-x 1 lfs lfs 2728516 Nov  7 17:14 i686-lfs-linux-gnu-strings
-rwxr-xr-x 2 lfs lfs 3294776 Nov  7 17:14 i686-lfs-linux-gnu-strip
* -rwxr-xr-x 4 lfs lfs  570947 Nov  7 20:39 i686-pc-linux-gnu-c++
-rwxr-xr-x 4 lfs lfs  570947 Nov  7 20:39 i686-pc-linux-gnu-g++
-rwxr-xr-x 3 lfs lfs  565980 Nov  7 20:39 i686-pc-linux-gnu-gcc
-rwxr-xr-x 3 lfs lfs  565980 Nov  7 20:39 i686-pc-linux-gnu-gcc-4.5.1
*
Can some one help me figure out why the compilers gcc and g++ are prefixed
with i686-pc-linux-gnu and not i686-lfs-linux-gnu?

Thanks for your time.

Cheers,
Anand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://linuxfromscratch.org/pipermail/lfs-support/attachments/20101111/dd05d30d/attachment-0001.html

------------------------------

Message: 3
Date: Thu, 11 Nov 2010 15:07:59 +0000
From: Ken Moffat <ken at linuxfromscratch.org>
Subject: Re: gcc/g++ compiler in LFS
To: LFS Support List <lfs-support at linuxfromscratch.org>
Message-ID: <20101111150759.GA17895 at deepthought>
Content-Type: text/plain; charset=utf-8

On Thu, Nov 11, 2010 at 09:32:24AM -0500, Anand Arumugam wrote:
>
> I was of the impression that there should be no reference to '*
> i686-pc-linux-gnu*'. The config.guess script which I ran to find out the
> guessed name returned '*i686-lfs-linux-gnu*'. Both these folders have the
> same contents.
>
 The -lfs-linux-gnu programs are created in the cross-compile parts
of chapter 5, i.e. binutils pass 1 and gcc pass 1.  When we build
the pass 2 versions, they have the normal names (i686-pc-linux-gnu
in your case, x86_64-unknown-linux-gnu in mine).

>
> Does this mean I have to redo everything from "Adjusting the tool chain"
> step?
>

 No.  The i686-*-linux-gnu- programs are hard linked to the programs
in /tools/bin (and similarly in chapter 6 to the programs in
/usr/bin).  So, in the early parts of chapter 5 gcc and ld will be
hardlinked to the -lfs- versions, and after the pass 2 versions have
been installed they are linked to the -pc- versions.  You can prove
that with 'ls -i'.

 The only reason to redo everything would be if the programs in
/tools/bin were linked to host libraries in /usr/lib instead of the
libraries in /tools/lib.

?en

====> Thanks a lot for the clarification. I did verify the link of gcc and
g++ using 'which' and it was pointing to /tools/bin. I verified the path for
all commands after gcc pass-2 and bash installation. I was not entirely sure
because it was not mentioned in the book too.

-Anand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20101112/fcea25c0/attachment.html>


More information about the lfs-support mailing list