public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Kai Ruottu <karuottu@mbnet.fi>
To: Bob Yan <ccrg.yang@gmail.com>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Errors when building powerpc-softfloat-linux-gnu libgfrotran
Date: Tue, 08 Jan 2008 17:55:00 -0000	[thread overview]
Message-ID: <4782A93E.1020200@mbnet.fi> (raw)
In-Reply-To: <7119e3eb0801070825ucb63aeeoe086b46d27f0b95f@mail.gmail.com>

Bob Yan wrote:
> 3) build the glibc
> /home/yxb/glibc-2.3.6/configure --prefix=/home/yxb/install
>   
The goal in building glibc usually is to make it suitable to be 
installed onto the target
system, ie it provides the "native" glibc there. So  the  normal value 
for  $prefix is the
'/usr', ie the option should be '--prefix=/usr' !  One doesn't think 
where this glibc
would be installed on the cross host system but where it would be 
installed on the
target system.  So there is always a full 1-to-1 similarity between the 
glibc on the
cross host and on the target system.  When the target system already 
exists like the
case is with something like Fedora 8 / PPC, the target glibc comes from 
it. When
the target system doesn't exist yet, one produces the glibc for it with 
the cross GCC
on the cross host. But it will be made mainly for the target system, the 
$sysroot place
is the one  where it will appear  in its 1-to-1  scheme with the  
becoming target system.

Your $prefix installs the glibc into the  '/home/yxb/install/...',  in 
'include', 'lib', 'etc',
'bin',... there.  This kind of glibc is a "cross only version", usually 
a "just for a fun"
experimental one which will not be installed onto any real target system 
as its "runtime"
(the shared parts)...
> --with-headers=/usr/powerpc-softfloat-linux-gnu/include
>   
This then should point to the Linux kernel headers - if someone doesn't 
yet know this
about the glibc configure & build,  here it was told....

> make all install
>   
If the '--prefix=/usr' was used, this command would overwrite the native 
glibc and
crash the host system totally!   So one must be very careful in the 
'make install' command !
The right install command would be like :

  make install_root=$sysroot  install

This puts the produced glibc into the '$sysroot/...'  and 
'$sysroot/usr/...' directories...

> 4) build the full gcc
> /home/yxb/gcc-4.0.0/configure --prefix=/home/yxb/install
> --target=powerpc-softfloat-linux-gnu --disable-altivec
> --with-float=soft --disable-nls
>   
Looks being ok this far ...

> --with-headers=/usr/powerpc-softfloat-linux-gnu/include
>   
When one has that self-made "right" glibc after the step 3, of course it 
should be used now!
So this is wrong :(
> --enable-languages=c,c++,f95 --with-cpu=405 --disable-multilib
> --disable-threads --disable-shared --enable-static
> --enable-__cxa-atexit --enable-clocale=gnu
> --with-libs=/home/yxb/install/lib
This '--with-libs=' points to the place where those target libs are,
so basically it is "right". But generally the "cross only version" of
glibc should have been built to be installed into the $tooldir or
'$prefix/$target' where the values are those used in the binutils and
GCC configures. Ie using a '--prefix=$prefix/$target' in the glibc
configure. When NOT using the '--with-sysroot=' in the binutils and GCC
configures, ie using the "traditional" install scheme for the crosstoolchain.

The alternative then is to use the '--with-sysroot=$sysroot' in the
binutils and GCC configure and then build the glibc for installation
into this $sysroot, via that 'make install_root=$sysroot install' after
configuring the glibc sources using the '--prefix=/usr'...

Two choices for the installation scheme, the traditional into the
$tooldir and the new one into $tooldir (stuff for running on the $host
and targeted to handle stuff for the $target) and $sysroot (stuff for
the $target).


> --enable-c99 --enable-long-long
> --with-newlib
>   
The C library is glibc, not "newlib", so this last option is wrong!

> make all-gcc install-gcc
>
> 5) build the libgfortran
>
> ln -s /home/yxb/install/include
> /home/yxb/install/powerpc-softfloat-linux-gnu/include
>
> /home/yxb/gcc-4.0.0/configure --prefix=/home/yxb/install
> --target=powerpc-softfloat-linux-gnu
> --host=powerpc-softfloat-linux-gnu --with-float=soft
> --with-headers=/usr/powerpc-softfloat-linux-gnu/include
> --with-binutils=/home/yxb/install/powerpc-softfloat-linux-gnu/bin
> --without-fp
>
> make all-target-libgfortran install-target-libgfortran
>   
Too complicated, generally the headers from the self-made glibc should 
have been in
this '/home/yxb/install/powerpc-softfloat-linux-gnu/include' already 
when producing the
earlier GCC parts!  This extra 'make' command might be required in order 
to get the
'libgfortran' though... I would expect the 
'--enable-languages=c,c++,f95' taking care
about both 'libstdc++-v3' and 'libgfortran' when those 'c++' and 'f95' 
are there!
> But  when I build the libstdc++-v3, some errors come :
>
> 6) build the libstdc++-v3
>
> /home/yxb/gcc-4.0.0/configure --prefix=/home/yxb/install
> --target=powerpc-softfloat-linux-gnu
> --host=powerpc-softfloat-linux-gnu --with-float=soft
> --with-headers=/usr/powerpc-softfloat-linux-gnu/include
> --with-binutils=/home/yxb/install/powerpc-softfloat-linux-gnu/bin
> --without-fp
>
> make all-target-libstdc++-v3 install-target-libstdc++-v3
>
> Here is the errors:
>
> /home/yxb/gcc-4.0.0/libstdc++-v3/src/codecvt.cc -o codecvt.o
> /home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/include/powerpc-softfloat-linux-gnu/bits/ctype_base.h:46:
> error: '_U' was not declared in this scope
> /home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/include/powerpc-softfloat-linux-gnu/bits/ctype_base.h:47:
> error: '_L' was not declared in this scope
>   
This may come from using the '--with-newlib' earlier... All these 
"reconfigures" : for libgfortran
and for libstdc++-v3 after the original for GCC aren't what is expected, 
a single configure&build
should be enough for GCC, libstdc++-v3 and libgfortran. After the target 
glibc is in its right place
(for that "cross only glibc") in the $prefix/$target, 'include' and 
'lib' there. And not forgetting to
make that symlink "sys-include -> include" !   The 'fixinc' phase checks 
the 'sys-include', not the
'include' for the "target headers possibly needing fixing for GCC"...

  reply	other threads:[~2008-01-07 22:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-07 23:02 Bob Yan
     [not found] ` <4781ECE6.3030700@mbnet.fi>
2008-01-08 15:12   ` Bob Yan
2008-01-08 17:55     ` Kai Ruottu [this message]
2008-01-08 19:17       ` Kai Ruottu
2008-01-08 19:25       ` Bob Yan

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=4782A93E.1020200@mbnet.fi \
    --to=karuottu@mbnet.fi \
    --cc=ccrg.yang@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    /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).