public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Zintakis <michael.zintakis@googlemail.com>
To: Kai Ruottu <kai.ruottu@wippies.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: building native cross compiler
Date: Mon, 14 Mar 2011 18:03:00 -0000	[thread overview]
Message-ID: <4D7E586C.30702@googlemail.com> (raw)
In-Reply-To: <4D7E4EFE.8040200@wippies.com>


>> My target system is Linux, though it would come
>> with two known variants - LFS (Linux from scratch) and Fedora. It will
>> be used with both architectures (i586/i686 and ppc).
>
> Targeting to known and existing targets like Fedora/i686 and Fedora/PPC
> is easy as a pie : Just build binutils, copy the existing target glibc
> and finally the GCC.
So, if I drop the glibc source in the gcc source tree I should be OK 
with cross-compiler building is that what you are suggesting?

> But a "from scratch" target may involve really
> weird attitudes which will disable using any "bootstrap" components
> like a temporary replacement glibc for the still unexisting "totally
> self built" target system, the "LFS". The famous "crosstool" method
> takes it "heretic" to use anything from anything existing in any phase,
> only the bare pristine sources are allowed! This is equal to making a
> hammer without using any existing hammer during the production, only
> a piece of iron and stones tied to sticks... When producing a complete
> GCC with libgcc, libstdc++ etc. requires the target C library during
> the GCC build for a system target, not being allowed to use some
> suitable existing one, makes things really complicated :(
I am not sure what you mean by the above!

> So cross GCCs for targets like 'i686-fedora14-linux' and
> 'powerpc-fedora3-linux' are easy as a pie to build but for targets like
> 'i686-mydistro-linux' and 'powerpc-mydistro-linux' it would be very
> hard to produce tools if one is not allowed (politically) to bootstrap
> the first GCCs with the Fedora or something glibcs, thinking them
> being only "some" glibcs for the generic 'i686-linux-gnu' and
> 'powerpc-linux-gnu' target cases...
I will bootstrap the first compiler - GCC1, which is then going to be 
used to build GCC2 (the cross-compiler) and GCC2 will then have to build 
the entire target system (including another copy of gcc - GCC3, which 
will be solely used to build software on the target system only). I have 
no alternative with this, unfortunately!

> Just as well as the equivalent
> prebuilt Debian, Ubuntu, SuSE etc glibcs for i686 and PPC... Producing
> glibcs with fully working GCCs is the default, the default for a glibc
> build is a native build and nobody says that one is not allowed to have
> any stuff in '/lib', '/usr/include' and '/usr/lib' then (some existing
> old glibc)...
I assume you understand that my host system will *always* be x86_64 and 
will *always* be Fedora - just in case I wasn't clear with this. So, can 
I build glibc for system other than the host one or is this rapidly 
becoming chicken-and-egg scenario?


>>  From what I gather by reading the INSTALL (and FAQ) files from the
>> source archives I would need to build glibc separately, after I built
>> binutils, use the same prefix and probably specify the "--with-headers"
>> option as well. I take it glibc won't be relying on the GCC
>> cross-compiler otherwise we have a chicken-and-egg scenario on our 
>> hands?
>
> Maybe the "proprietary" targets like Sparc/Solaris, AIX, SVR4 etc. and
> "custom" ones like FreeBSD, NetBSD, OpenBSD, Cygwin, MinGW etc. could
> serve as models for normal targets for cross binutils, GCC and GDB. They
> already have their own original fully tested headers and library
> binaries without sources or with sources but no sanity to reinvent the
> wheel by trying to produce something identical for the existing...
LFS does have sources (and I presume headers too), but in order to build 
it I need GCC2 fully functioning, which is what I am trying to do as 
both host and target systems are different.

>> There are a couple of paragraphs from the same file which I am not 
>> sure of:
>>
>> "You must first build the library (`make'), optionally check it
>> (`make check'), switch the include directories and then install (`make
>> install'). The steps must be done in this order. Not moving the
>> directory before install will result in an unusable mixture of header
>> files from both libraries, but configuring, building, and checking the
>> library requires the ability to compile and run programs against the old
>> library."
>>
>> Do I need to do this as i am building with a specific prefix and, I take
>> it, my original system won't be affected (I won't be chrooted yet). If I
>> do need to follow that what does the 'switch the include directories' 
>> mean?
>>
>> "You may also need to reconfigure GCC to work with the new library.
>> The easiest way to do that is to figure out the compiler switches to
>> make it work again (`-Wl,--dynamic-linker=/lib/ld-linux.so.2' should
>> work on GNU/Linux systems) and use them to recompile gcc."
>>
>> Do I need to do that too? If so, should I specify the --dynamic-linker
>> path to "prefix/target/lib/ld-linux.so.2"?
>
> All this stuff has nothing to do with producing a normal cross GCC for a
> normal already existing target like a Linux distro, Fedora, SuSE, Ubuntu
> etc. !
So, I should disregard this then...

  reply	other threads:[~2011-03-14 18:03 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 14:56 Michael Zintakis
2011-03-11 16:00 ` Ian Lance Taylor
2011-03-11 16:56   ` Michael Zintakis
2011-03-11 18:57     ` Ian Lance Taylor
2011-03-11 20:47       ` Michael Zintakis
2011-03-11 21:21         ` Ian Lance Taylor
2011-03-11 23:44           ` Michael Zintakis
2011-03-12  0:06             ` Ian Lance Taylor
2011-03-13 14:23               ` Michael Zintakis
2011-03-13 18:45                 ` Ian Lance Taylor
2011-03-13 22:10                   ` Michael Zintakis
2011-03-14  0:34                     ` Ian Lance Taylor
2011-03-14  0:51                       ` Michael Zintakis
2011-03-14  1:01                         ` Ian Lance Taylor
2011-03-14  1:30                           ` Michael Zintakis
2011-03-14  1:39                             ` Ian Lance Taylor
2011-03-14  1:47                               ` Michael Zintakis
2011-03-14  1:55                                 ` Michael Zintakis
2011-03-14  2:01                                   ` Ian Lance Taylor
2011-03-14  2:08                                     ` Michael Zintakis
2011-03-14  3:48                                     ` Michael Zintakis
2011-03-14 15:26                                       ` Ian Lance Taylor
2011-03-14 15:49                                         ` Michael Zintakis
2011-03-14 16:00                                           ` Michael Zintakis
2011-03-14 16:25                                             ` Ian Lance Taylor
2011-03-14 16:34                                               ` Michael Zintakis
2011-03-14 16:02                                           ` Ian Lance Taylor
2011-03-14 16:31                                             ` Michael Zintakis
2011-03-14 17:23                                               ` Kai Ruottu
2011-03-14 18:03                                                 ` Michael Zintakis [this message]
2011-03-14 19:07                                                   ` Kai Ruottu
2011-03-14 19:25                                                     ` Michael Zintakis
2011-03-14 20:20                                               ` Ian Lance Taylor
2011-03-14 20:35                                                 ` Michael Zintakis
2011-03-14 21:12                                                   ` Ian Lance Taylor
2011-03-15  2:25                                                     ` Michael Zintakis
2011-03-15  4:23                                                       ` Ian Lance Taylor
2011-03-15  5:01                                                         ` Mick McCreath
2011-03-16 17:26                                                           ` Michael Zintakis
2011-03-20 15:48                                                           ` Michael Zintakis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D7E586C.30702@googlemail.com \
    --to=michael.zintakis@googlemail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=kai.ruottu@wippies.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).