Re: building native cross compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



14.3.2011 18:31, Michael Zintakis kirjoitti:

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

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.
>
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. 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 :(

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

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

If one doesn't make Linux distros, one never needs to produce the target
C libraries for Linux targets because the already existing Linux distros
already have their target C libraries built and fully tested !

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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux