public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Michael Zintakis <michael.zintakis@googlemail.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: building native cross compiler
Date: Mon, 14 Mar 2011 16:31:00 -0000	[thread overview]
Message-ID: <4D7E42CA.3000206@googlemail.com> (raw)
In-Reply-To: <mcrlj0h3d2j.fsf@google.com>


>>>> ../../../gcc/libgcc/../libdecnumber/decContext.c:33:43: fatal error: string.h: No such file or directory
>>>>     
>>>>         
>>> The question now is whether you have a C library for your target system.
>>>   
>>>       
>> Please elaborate Ian - what do you mean?
>>     
>
> A C library contains things like <stdio.h>, <string.h>, and the
> associated functions like fopen, strcpy, etc.  GCC does not provide a C
> library.
>
> You've described your target in terms of processor, but not in terms of
> operating system.  Some operating systems have a C library.  Some do
> not.  Either way, you're going to need one if you want to write C code.
> And you're going to cross-compiler your C library in order to
> cross-build programs that run on your target system.
>   
Yes, apologies - I hit the send button a little bit too fast before 
thinking it through. 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).

 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?

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"?

"You can install glibc somewhere other than where you configured it
to go by setting the `install_root' variable on the command line for
`make install'.  The value of this variable is prepended to all the
paths for installation.  This is useful when setting up a chroot
environment or preparing a binary distribution.  The directory should be
specified with an absolute file name."

Same here - I assumed when specifying the prefix that will be enough 
(without specifying 'install_root') or is it?

Finally, in the same file there is mention that I would also need the 
header files for the Linux arch (presumably the target arch as I already 
have the host ones installed) - is that really a requirement?

Also, I take it it is not possible to build glibc at the same time I 
build GCC (i.e. by dropping the source tree into the GCC main tree), right?

MZ

  reply	other threads:[~2011-03-14 16:31 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 [this message]
2011-03-14 17:23                                               ` Kai Ruottu
2011-03-14 18:03                                                 ` Michael Zintakis
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=4D7E42CA.3000206@googlemail.com \
    --to=michael.zintakis@googlemail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=iant@google.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).