aix crosscompiler

Kai Ruottu kai.ruottu@wippies.com
Tue Jan 24 12:29:00 GMT 2012


24.1.2012 9:33, Jędrzej Dudkiewicz kirjoitti:
> Hi,
>
> I'm still trying to build crosscompiler for AIX (build on Solaris 11
> for AIX 4.3). I'm building binutils using the following:
>
> ../../src/binutils-2.22/configure --prefix=/opt/xgcc/aix-4.3/binutils
> --target=rs6000-ibm-aix4.3 --with-sysroot=/root/xcomp/src/sysroot/
>
> and gcc using:
>
> ../../src/gcc-trunk-2012-01-23/configure
> --prefix=/opt/xgcc/aix-4.3/gcc-4.7

As you can see the $prefix used with binutils was different!  The
rule is that they must be same, or otherwise one must somehow fix
this error so that the right binutils will be found...

> --enable-static --disable-multilib
> --disable-nls --disable-shared
> --with-build-sysroot=/root/xcomp/src/sysroot/

In the same way the '--with-sysroot=/root/xcomp/src/sysroot/' would
be expected here, both '--with-sysroot='s pointing to the same place!

> --with-headers=/root/xcomp/src/sysroot/usr/include/

If one uses the '--with-sysroot=' then the '--with-headers=' should
not be used to tell where the standard headers for the target will
be copied! No copying at all, what is in the (in your case) :

   /root/xcomp/src/sysroot/usr/include/

is enough...

> --with-gnu-as
> --with-gnu-ld --enable-languages=c,c++ --target=rs6000-ibm-aix4.3
> --with-cpu=powerpc
 >
> Compilation fails with the following:
>
> In file included from
> /root/xcomp/build/gcc-trunk-20120123/rs6000-ibm-aix4.3/libstdc++-v3/include/bits/atomic_ba
> se.h:37:0,
>                   from
> /root/xcomp/build/gcc-trunk-20120123/rs6000-ibm-aix4.3/libstdc++-v3/include/atomic:41,
>                   from
> /root/xcomp/src/gcc-trunk-2012-01-23/libstdc++-v3/include/precompiled/stdc++.h:100:
> /root/xcomp/build/gcc-trunk-20120123/./gcc/include/stdint.h:72:29:

I would expect your '/root/xcomp/src/sysroot/usr/include' having
'stdint.h' and it being used or if it was 'fixed' during the
'fixincludes' build phase, the :

/root/xcomp/build/gcc-trunk-20120123/./gcc/include-fixed/stdint.h

being used...

> error: conflicting declaration 'typedef short
>   int int_fast16_t'
> In file included from
> /root/xcomp/build/gcc-trunk-20120123/./gcc/include-fixed/sys/types.h:64:0,
>                   from
> /opt/xgcc/aix-4.3/gcc-4.7/rs6000-ibm-aix4.3/sys-include/sys/lc_core.h:36,
>                   from
> /opt/xgcc/aix-4.3/gcc-4.7/rs6000-ibm-aix4.3/sys-include/sys/localedef.h:43,

The "copied" headers in '$prefix/$target/sys-include' were used, not the
expected '$sysroot/usr/include' ones!

>                   from
> /root/xcomp/build/gcc-trunk-20120123/./gcc/include-fixed/ctype.h:131,
>                   from
> /root/xcomp/build/gcc-trunk-20120123/rs6000-ibm-aix4.3/libstdc++-v3/include/cctype:44,
>                   from
> /root/xcomp/src/gcc-trunk-2012-01-23/libstdc++-v3/include/precompiled/stdc++.h:36:
> /opt/xgcc/aix-4.3/gcc-4.7/rs6000-ibm-aix4.3/sys-include/sys/inttypes.h:143:18:
> error: 'int_fast16_t' has a previous declaration as 'typedef int32_t
> int_fast16_t'
>
> My understanding is that configure failed to pick these definitions
> from sysroot? Is this caused by missing switch in configure invocation
> or some more profound problem?

Yes, the target headers and libraries in $sysroot should be used totally
untouched but some headers may be fixed and then be put into the
'$BUILD/gcc/include-fixed' and used instead of the originals. Generally
the expected configure & build method for newbies is that :

  - the used $prefix must be the same for both binutils and GCC and be
    told via '--prefix=$prefix

  - the used $sysroot must be the same for both binutils and GCC and be
    told via '--with-sysroot=$sysroot'

Experienced builders may change these basic prerequisites via special
extra configure options to compensate the "custom" choices. Your
'--with-build-sysroot=' is one of these, aimed for something special
which only very few people know what it is... I myself had to consult
the configure options at 'gcc.gnu.org' in order to see what it is for :

--with-build-sysroot=dir
   Tells GCC to consider dir as the system root (see --with-sysroot)
   while building target libraries, instead of the directory specified
   with --with-sysroot. This option is only useful when you are already
   using --with-sysroot. You can use --with-build-sysroot when you are
   configuring with --prefix set to a directory that is different from
   the one in which you are installing GCC and your target libraries.

And still its aim was left quite fuzzy :-(

Why on earth you cannot first try the configure and build with the
rules aimed for the newbies but are trying these special configure
options?



More information about the Gcc-help mailing list