Errors when building powerpc-softfloat-linux-gnu libgfrotran

Bob Yan ccrg.yang@gmail.com
Tue Jan 8 15:12:00 GMT 2008


Thank you very much!

Your answer is very usefull to me.

This is the building process of powerpc-softfloat-linux-gnu tool chain:

1) build the binutils:
/home/yxb/binutils-2.18/configure --prefix=/home/yxb/install
--target=powerpc-softfloat-linux-gnu
--with-sysroot=/opt/host-powerpc-softfloat-linux-gnu

make all install

2) build the temp gcc
/home/yxb/gcc-4.0.0/configure --prefix=/home/yxb/install
--target=powerpc-softfloat-linux-gnu --enable-languages=c
--disable-threads --disable-shared --with-newlib

make all-gcc install-gcc

3) build the glibc
/home/yxb/glibc-2.3.6/configure --prefix=/home/yxb/install
--target=powerpc-softfloat-linux-gnu
--host=powerpc-softfloat-linux-gnu --enable-add-ons=linuxthreads
--with-headers=/usr/powerpc-softfloat-linux-gnu/include
--with-binutils=/home/yxb/install/powerpc-softfloat-linux-gnu/bin
--without-fp

make all install

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
--with-headers=/usr/powerpc-softfloat-linux-gnu/include
--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 --enable-c99 --enable-long-long
--with-newlib

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

>From 1) ~ 5), everything is ok, and the gcc, gfortran seams work well

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/build-gcc/gcc/xgcc -shared-libgcc -B/home/yxb/build-gcc/gcc/
-nostdinc++ -L/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/src
-L/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/src/.libs
-B/home/yxb/install/powerpc-softfloat-linux-gnu/bin/
-B/home/yxb/install/powerpc-softfloat-linux-gnu/lib/ -isystem
/home/yxb/install/powerpc-softfloat-linux-gnu/include -isystem
/home/yxb/install/powerpc-softfloat-linux-gnu/sys-include
-I/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/include/powerpc-softfloat-linux-gnu
-I/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/include
-I/home/yxb/gcc-4.0.0/libstdc++-v3/libsupc++ -g -O2 -D_GNU_SOURCE
-fno-implicit-templates -Wall -Wextra -Wwrite-strings -Wcast-qual
-fdiagnostics-show-location=once -c
/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
/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/include/powerpc-softfloat-linux-gnu/bits/ctype_base.h:48:
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:48:
error: '_L' 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:49:
error: '_N' 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:50:
error: '_X' 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:50:
error: '_N' 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:51:
error: '_S' 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:52:
error: '_P' 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:52:
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:52:
error: '_L' 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:52:
error: '_N' 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:52:
error: '_B' 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:53:
error: '_P' 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:53:
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:53:
error: '_L' 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:53:
error: '_N' 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:54:
error: '_C' 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:55:
error: '_P' 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:56:
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:56:
error: '_L' 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:56:
error: '_N' was not declared in this scope
make[3]: *** [codecvt.lo] Error 1
make[3]: Leaving directory
`/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory
`/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3'
make[1]: *** [all] Error 2
make[1]: Leaving directory
`/home/yxb/build-gcc/powerpc-softfloat-linux-gnu/libstdc++-v3'
make: *** [all-target-libstdc++-v3] Error 2


Would you please give me some sugestions?

Thank you very much!

Bob Yan


2008/1/7, Kai Ruottu <karuottu@mbnet.fi>:
> Bob Yan wrote:
> > Hi
> >
> > After I built powerpc-softfloat-linux-gnu gcc and gfortran compiler,
> > The c compiler works well and the gfortran show the error like this:
> >             ..../bin/ld: cannot find -lgfortranbegin
> >
> > I think it should work after install libgfortran, So I use the the
> > following configuration to build libgfortran which had been proved ok
> > when i built gcc and gfortran:
> >
> > # *********************************************************************
> > #!/bin/sh
> >
> > /home/yxb/gcc-4.0.0/configure --prefix=/home/yxb/install
> > --target=powerpc-softfloat-linux-gnu --disable-altivec
> > --with-float=soft --disable-nls --without-headers
> > --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 --enable-c99 --enable-long-long
> >
> > make all-target-libgfortran install-target-libgfortran
> >
> > # *********************************************************************
> >
> > Then the first error i met was that cannot find stdlib.h string.h ctype.h....
> >
> As default a GCC build for a "system" target - one which can have a
> "native GCC" for it - requires
> the target C library during the build! So the '--without-headers' is
> quite weird here.  Ok, you may get
> some kind of "stripped GCC" without any C++, Fortran etc. support, ie
> those 'libstdc++-v3',
> 'libgfortran' etc. support libraries not being produced, only the bare
> GCC parts in the subdirectory 'gcc'.
> And could then try this "brain damaged" GCC to compile the target C
> library and finally rebuild the
> final GCC with this existing target C library... Many "purists" or
> "bolsheviks" are following this "from
> scratch" approach because always vomiting when seeing names like
> "Fedora", "OpenSuSE", "Debian"
> etc. which are pproviding prebuilt glibcs for 'i386', 'x86_64', 'PPC',
> 'Sparc', 'MIPS*', 'HP-PA', 'm68k',
> 'ARM' etc. CPU architectures...  But the old "I can accept GoodYears
> temporalily in a new car although
> really wanting Michelins" approach is much, much easier !
>
> In order to get 'libstdc++-v3', 'libgfortran' etc. you must provide a C
> library for Linux/PPC for the
> build.  This can be a "hard-float" defaulted one during bootstraping,
> the goal being getting at least some
> GCC first, to be used to produce the "soft-float" C library (glibc in
> this case) next.  When having that
> soft-float model of glibc, you can replace the temporary bootstrap glibc
> with it and produce the final
> GCC with all its "extra libraries".  Having a "working" GCC during the
> glibc build is the assumption
> because for it too the "native" build is the default one, there is that
> "prebuilt hammer when producing
> a new hammer".  No reason to start where Linus & Co started when
> producing the first GCC and
> glibc for a new CPU port of Linux...
>
> Your '--with-libs=' hints that you have that "soft-float" model of glibc
> already, but you are pointing only
> to its libraries!  Why not to its headers via '--with-headers=' ?   Ok,
> these both options are obsolete :(
>
> The current suggestion is to use a "sysroot" where those '/lib',
> '/usr/lib' and '/usr/include' for the $target
> would be installed, ie into '$sysroot/lib', '$sysroot/usr/lib' and
> '$sysroot/usr/include'.  And then using the
> '--with-sysroot=$sysroot' when configuring binutils and GCC so that
> these would find the sysroot'ed
> headers and libraries there below the $sysroot...  My "standard" for a
> $sysroot is '/opt/host-$target',
> in your case that would be '/opt/host-powerpc-softfloat-linux-gnu',
> meaning "stuff for this alien $host".
>
> The traditional default place for the $target stuff is the $tooldir aka
> $prefix/$target for the target headers
> and libraries, but when there are only one 'lib' to be searched but two
> 'include's, this has leaded into a
> very big mess!  Even the GCC developers have had problems to "grok"
> those two include directories
> and what to do when there are two or more 'lib' directories for a
> $target, the developers usually being
> "native only" people :(  So their "solution" was that "sysroot'ed native
> GCC for the target on a cross host".
> With gcc-3.3.2 and earlier only the traditional scheme is possible, I
> don't remember the binutils version
> where the '--with-sysroot=' appeared.
>
> Also the target binutils, made for the $host but handling the $target
> stuff, will be put into the '$tooldir/bin',
> with bare 'as', 'ld', 'nm' etc. names. This 'tradition' continues even
> when using the '--with-sysroot=', the
> $sysroot is only for the stuff for that alien $target !
>
> > /home/yxb/gcc-4.0.0/configure --prefix=/home/yxb/install
> > --target=powerpc-softfloat-linux-gnu --disable-altivec
> >
> This makes the '/home/yxb/install/powerpc-softfloat-linux-gnu' being the
> traditional '$tooldir' where the
> target headers  ('include') and libraries ('lib') should be installed
> before starting the GCC build !   The
> 'sys-include' there should be a symlink to the 'include', both being
> seen as the same directory - this is
> the usual workaround for the current mess. And  in the 'lib' both the
> 'lib' and 'usr/lib' parts should be
> seen, the 'libc.so' and 'libpthread.so' scripts being edited to not have
> those absolute '/lib' and '/usr/lib'
> pathnames, but bare library names!  And when 'combining' the two 'lib's,
> all the usual symlinks to the
> '../../lib' should be fixed!
>
> The easy solution without using the '--with-sysroot=' would be to take
> its idea, to put the target stuff
> below some $sysroot and then symlink the '$sysroot/usr' things
> ('include' and 'lib') to be seen in the
> expected '$tooldir' (as 'include' and 'lib' there).  With the bare glibc
> almost all the 'target libraries' are
> already seen in the 'usr/lib', only the important 'libc.so.6' and
> 'ld-linux.so.2' or 'ld.so.1' in the Linux/PPC
> case, are not seen there... Adding two more symlinks to the '../../lib'
> isn't really that hard!   But if one
> needs also the X11, gtk (Gnome), KDE etc. target libraries and needs to
> build sources which expect
> a "native" build, then using the '--with-sysroot=' may be quite
> obligatory, as told it makes the cross GCC
> to look like a native GCC, converting those '-I/usr/X11R6/include' etc.
> things to mean the stuff below
> that $sysroot instead of using the native ones for the cross host!
>
> > make all-target-libgfortran install-target-libgfortran INCLUDES=-I/usr/include
> >
> If your $host platform isn't Linux/PPC, this INCLUDES points to totally
> wrong 'target headers' !
> In some SVR4 releases just as in some WinNT, WinCE, Solaris2 etc
> "commercial" opsyses there
> were CPU-specific '#ifdef's in the target headers, ie these being common
> for all those supported
> CPUs, for instance Alpha, MIPS, PPC and i386 in WinNT 4.0...  But in
> Linux each CPU variation
> has always had its own custom glibc headers :(   So you should have
> Linux/PPC headers where they
> are expected to be, in '$tooldir/include' (traditional) or
> '$sysroot/usr/include' (sysroot'ed).
>
> > make[2]: Entering directory `/home/yxb/build/gcc'
> > make GCC_FOR_TARGET="/home/yxb/build/gcc/xgcc -B/home/yxb/build/gcc/
> > -B/home/yxb/install/powerpc-softfloat-linux-gnu/bin/
> > -B/home/yxb/install/powerpc-softfloat-linux-gnu/lib/ -isystem
> > /home/yxb/install/powerpc-softfloat-linux-gnu/include -isystem
> > /home/yxb/install/powerpc-softfloat-linux-gnu/sys-include" \
> >
>
> Here you can see the default traditional search directories in $tooldir
> aka $prefix/$target !
>
> > make[2]: Entering directory
> > `/home/yxb/build/powerpc-softfloat-linux-gnu/libgfortran'
> > /bin/sh ./libtool --mode=compile /home/yxb/build/gcc/xgcc
> > -B/home/yxb/build/gcc/
> > -B/home/yxb/install/powerpc-softfloat-linux-gnu/bin/
> > -B/home/yxb/install/powerpc-softfloat-linux-gnu/lib/ -isystem
> > /home/yxb/install/powerpc-softfloat-linux-gnu/include -isystem
> > /home/yxb/install/powerpc-softfloat-linux-gnu/sys-include
> > -DHAVE_CONFIG_H -I. -I/home/yxb/gcc- 4.0.0/libgfortran -I.
> > -I/usr/include -iquote/home/yxb/gcc-4.0.0/libgfortran/io  -std=gnu99
> > -O2 -g -O2 -c -o environ.lo `test -f 'runtime/environ.c' || echo
> > '/home/yxb/gcc-4.0.0/libgfortran/'`runtime/environ.c
> > /home/yxb/build/gcc/xgcc -B/home/yxb/build/gcc/
> > -B/home/yxb/install/powerpc-softfloat-linux-gnu/bin/
> > -B/home/yxb/install/powerpc-softfloat-linux-gnu/lib/ -isystem
> > /home/yxb/install/powerpc-softfloat-linux-gnu/include -isystem
> > /home/yxb/install/powerpc-softfloat-linux-gnu/sys-include
> > -DHAVE_CONFIG_H -I. -I/home/yxb/gcc- 4.0.0/libgfortran -I.
> > -I/usr/include -iquote/home/yxb/gcc-4.0.0/libgfortran/io -std=gnu99
> > -O2 -g -O2 -c /home/yxb/gcc-4.0.0/libgfortran/runtime/environ.c -o
> > environ.o
> > In file included from /usr/include/stdlib.h:436,
> >                  from /home/yxb/gcc-4.0.0/libgfortran/runtime/environ.c:32:
> > /usr/include/sys/types.h:88: error: two or more data types in
> > declaration specifiers
> > /usr/include/sys/types.h:88: warning: useless type name in empty declaration
> >
> The native headers in '/usr/include' aren't for Linux/PPC or how?  They
> may be for "Linux"
> but for 'i386' or 'x86_64 & i386'....
> > configure:3601: checking for i686-pc-linux-gnu-ar
> > configure:3634: checking for ar
> > configure:3673: checking for i686-pc-linux-gnu-as
> > configure:3706: checking for as
> > configure:3745: checking for i686-pc-linux-gnu-dlltool
> > configure:3778: checking for dlltool
> > configure:3817: checking for i686-pc-linux-gnu-ld
> > configure:3850: checking for ld
> > configure:3889: checking for i686-pc-linux-gnu-nm
> > configure:3922: checking for nm
> > configure:3961: checking for i686-pc-linux-gnu-ranlib
> > configure:3994: checking for ranlib
> > configure:4033: checking for i686-pc-linux-gnu-windres
> > configure:4066: checking for windres
> > configure:4105: checking for i686-pc-linux-gnu-objcopy
> > configure:4138: checking for objcopy
> > configure:4177: checking for i686-pc-linux-gnu-objdump
> > configure:4210: checking for objdump
> > configure:4256: checking for powerpc-softfloat-linux-gnu-ar
> > configure:4328: checking for powerpc-softfloat-linux-gnu-as
> > configure:4400: checking for powerpc-softfloat-linux-gnu-dlltool
> > configure:4472: checking for powerpc-softfloat-linux-gnu-ld
> > configure:4544: checking for powerpc-softfloat-linux-gnu-nm
> > configure:4616: checking for powerpc-softfloat-linux-gnu-ranlib
> > configure:4688: checking for powerpc-softfloat-linux-gnu-windres
> > configure:4806: checking whether to enable maintainer-specific
> >
> This hints your $host being a 'i686-pc-linux-gnu' system, not a
> 'powerpc-pc-linux-gnu'
> or something "compatible with the $target", in which case the native
> $host stuff would be
> ok also for the $target...
>
>
>



More information about the Gcc-help mailing list