aix cross(?)compiler

Jędrzej Dudkiewicz
Thu Dec 22 17:36:00 GMT 2011

On Wed, Dec 14, 2011 at 6:10 PM, Kai Ruottu <> wrote:
> 14.12.2011 13:42, Jędrzej Dudkiewicz kirjoitti:
> Hard to say what the GNU binutils really support or not but trying them
> is always possible. So I tried the binutils-2.20.51 :
> [root@localhost build]# rs6000-ibm-aix4.3-as --version
> GNU assembler (Linux/GNU Binutils)
> Copyright 2010 Free Software Foundation, Inc.
> This program is free software; you may redistribute it under the terms of
> the GNU General Public License version 3 or later.
> This program has absolutely no warranty.
> This assembler was configured for a target of `rs6000-ibm-aix4.3'.

I tried it just now, this time on Solaris 11 (host:
i386-pc-solaris2.11), I'm using gcc provided by Oracle:

root@sol11x86:~/xcomp/build/gcc-4.6.0# gcc -v
Using built-in specs.
Target: i386-pc-solaris2.11
Configured with:
CXX=/ws/onnv-tools/SUNWspro/sunstudio12.1/bin/CC --prefix=/usr/gcc/4.5
--mandir=/usr/gcc/4.5/share/man --bindir=/usr/gcc/4.5/bin
--libdir=/usr/gcc/4.5/lib --sbindir=/usr/gcc/4.5/sbin
--enable-languages=c,c++,fortran,objc --enable-shared
--with-mpfr-include=/usr/include/mpfr --prefix=/usr/gcc/4.5
--mandir=/usr/gcc/4.5/share/man --infodir=/usr/gcc/4.5/share/info
--libexecdir=/usr/gcc/4.5/lib CFLAGS='-g -O2 '
Thread model: posix
gcc version 4.5.2 (GCC)

This is how I built binutils:

../../src/binutils-2.22/configure --prefix=/opt/xgcc/aix-4.3/binutils

Note, that gcc on AIX reports as:

Reading specs from /opt/freeware/lib/gcc-lib/powerpc-ibm-aix4.3.3.0/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --with-as=/usr/bin/as
--with-ld=/usr/bin/ld --disable-nls --enable-languages=c,c++
--prefix=/opt/freeware --enable-threads --disable-shared
Thread model: aix
gcc version 3.3.2

I tried building binutils using "--target=powerpc-ibm-aix4.3.3.0", but
results were identical to what I see now, so my guess is that it
doesn't really matter.

Ok, so binutils are built and installed. Now, gcc. I'm building gcc
4.6.0, as 4.6.2 reports an error almost identical to one in my first
message. This time mpc, mpfr and gmp are in gcc source directory. Here
we go:

export PATH=/opt/xgcc/aix-4.3/binutils/bin:$PATH

../../src/gcc-4.6.0/configure --prefix=/opt/xgcc/aix-4.3/gcc-4.6.0
--enable-static --with-build-sysroot=../../src/sysroot
--with-headers=../../src/sysroot/usr/include --with-gnu-as
--with-gnu-ld --enable-languages=c,c++ --disable-shared --disable-nls
--target=rs6000-ibm-aix4.3 --disable-multilib

During compilation there was an error saying that there is no
directory /src/sysroot/usr/include where headers for target system are
supposed to be - my guess is that I should have provided (is it proper
english?) an absolute path, but creating link gcc/src pointing to
../../../src helped - let's say that it's equal to providing absolute

Finally, compilation failed with the following:

Checking multilib configuration for libgomp...
Configuring in rs6000-ibm-aix4.3/libgomp
configure: loading cache ./config.cache
checking for --enable-version-specific-runtime-libs... no
checking for --enable-generated-files-in-srcdir... no
checking build system type... i386-pc-solaris2.11
checking host system type... rs6000-ibm-aix4.3
checking target system type... rs6000-ibm-aix4.3
checking for a BSD-compatible install... /usr/bin/ginstall -c
checking whether build environment is sane... yes
checking for rs6000-ibm-aix4.3-strip... rs6000-ibm-aix4.3-strip
checking for a thread-safe mkdir -p... /usr/bin/gmkdir -p
checking for gawk... gawk
checking whether gmake sets $(MAKE)... yes
checking for rs6000-ibm-aix4.3-gcc...
-B/opt/xgcc/aix-4.3/gcc-4.6.0/rs6000-ibm-aix4.3/lib/ -isystem
/opt/xgcc/aix-4.3/gcc-4.6.0/rs6000-ibm-aix4.3/include -isystem
checking for C compiler default output file name...
configure: error: in `/root/xcomp/build/gcc-4.6.0/rs6000-ibm-aix4.3/libgomp':
configure: error: C compiler cannot create executables
See `config.log' for more details.
gmake[1]: *** [configure-target-libgomp] Error 1
gmake[1]: Leaving directory `/root/xcomp/build/gcc-4.6.0'
gmake: *** [all] Error 2

First thing that is weird is that it states "Checking multilib
configuration for libgomp..." with "--disable-multilib" passed to
configure - this means, that I probably don't understand what it does

Anyway, config.log in rs6000-ibm-aix4.3/libgomp contains this (it's
the last error in this file):

configure:3666: checking for C compiler default output file name
configure:3688: /root/xcomp/build/gcc-4.6.0/./gcc/xgcc
-B/opt/xgcc/aix-4.3/gcc-4.6.0/rs6000-ibm-aix4.3/lib/ -isystem
/opt/xgcc/aix-4.3/gcc-4.6.0/rs6000-ibm-aix4.3/include -isystem
--sysroot=../../src/sysroot   -g -O2   conftest.c  >&5
collect2: library libg not found
configure:3692: $? = 1
configure:3729: result:
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU OpenMP Runtime Library"
| #define PACKAGE_TARNAME "libgomp"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU OpenMP Runtime Library 1.0"
| #define PACKAGE_URL ""
| #define PACKAGE "libgomp"
| #define VERSION "1.0"
| /* end confdefs.h.  */
| int
| main ()
| {
|   ;
|   return 0;
| }
configure:3735: error: in
configure:3738: error: C compiler cannot create executables

Again, my questions are: am I doing it right but it's simply hard to
build crosscompiler for this platform, or am I missing some vital part
of the process?

> Are the AIX 4.3 etc C-libraries freely available somewhere nowadays?
> Years ago I tried to find them but then IBM hadn't put them freely
> available like SGI with Irix stuff and Sun with Solaris2 stuff :-(

I tried looking for them but i failed miserably. So it's possible that
they are either well hidden or not available at all.
Jędrzej Dudkiewicz

I really hate this damn machine, I wish that they would sell it.
It never does just what I want, but only what I tell it.

More information about the Gcc-help mailing list