Errors when building powerpc-softfloat-linux-gnu libgfrotran

Kai Ruottu
Tue Jan 8 17:55:00 GMT 2008

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

More information about the Gcc-help mailing list