6 msgtop-level configure options, --help
2 msgAnother Gcc 4.2.2 Bug
2 msgGcc Patch Archive?
10 msgCompile gcc from source on a 64 bit OS ?
4 msgRe: help compiling GCC in Fedora 8
10 msgconfigure: error: No support for this target/ho...
5 msgCan `cpp' strip off comments in C source code?
2 msgQuestion On Testsuite 12/22/07
2 msgQuestion: How dose Gcc choose which Ld and As t...
2 msgneed an explanation on assembly generated by va...
3 msgI can not resolve 'error: conflicting types for...
8 msga question about code optimization
7 msgAn error when trying to gmake install GCC 3.4.6...
2 msgRE: Initialization of a static member of a temp...
9 msgvoid pointer and map
3 msgAnother Gcc-4.1.2 Bug On Solaris 9 12/20/07

Help with building/using GCC cross compiler to ...
\ Jeff Heisz (20 Dec 2007)
. \ Jeff Heisz (24 Dec 2007)

1 msgBootstrapping gcc-4.2.2 with binutils-2.18
2 msginline assembly and segment registers
1 msgMultiple names for gcc inline assembly constrai...
Subject:Help with building/using GCC cross compiler to AIX 5.2
Group:Gcc-help
From:Jeff Heisz
Date:20 Dec 2007


Salient details:

Goal: use GCC cross-compiler on x86-Linux system to build application
for multiple non-Linux platforms and operating systems (so this
is not related to the conventional Linux toolchain)

Sucesses: can successfully compile programs for x86-linux (easy),
ppc64-linux, sparc-solaris

Toolkits: GCC-3.4.6, binutils-2.17, autoconf-2.60, automake-1.9.6
libtool 1.5.22, SuSE Linux 10.2

Problem:

Stuck on the next target, powerpc-aix. I have a copy of the include
and lib directories for AIX 5.2 (much like I've done for the other
successful platforms). I've gone through and fixed all of the soft
links to hard /usr directories (again, as I did for the others, only
this time there's a *lot*).

So, ideally it should have worked, since I was bouyed by successes
on the other platforms. Of course, I know that I'm moving deeper
into dangerous territory. I've run into two failures:

1) Can't completely build GCC-3.4.6. I configure as following:

./configure --prefix=/xbuild/cross/powerpc-aix \
--host=i686-pc-linux-gnu \
--build=i686-pc-linux-gnu \
--target=powerpc-ibm-aix5.2 \
--with-gnu-as --with-gnu-ld \
--with-sysroot=/xbuild/cross/powerpc-aix/sysroot \
--enable-multilib \
--enable-languages=c

where I've put the AIX include/lib trees in that target
sysroot directory. When I build GCC, it fails right at the
end while building libgcc because it doesn't look at
my sysroot directory and instead has gone straight
to the local /usr (which is Linux and doesn't link so
well). Here's the bit that's the problem (from the middle
of the link):

libgcc/pthread/ppc64/gthr-gnat.o libgcc/pthread/ppc64/unwind-c.o -lc
`case libgcc_s_pthread_ppc64 in *pthread*) echo -L/usr/lib/threads
-lpthreads -lc_r /usr/lib/libc.a;; *) echo -lc ;; esac` ; rm -f
tmp-libgcc_s_pthread_ppc64.a ; powerpc-ibm-aix5.2-ar -X32_64 -X32_64
rc tmp-libgcc_s_pthread_ppc64.a pthread/ppc64/shr.o ; mv
tmp-libgcc_s_pthread_ppc64.a libgcc_s_pthread_ppc64.a ; rm -f
pthread/ppc64/shr.o

I modified the t-aix52 config template to remove the
/usr/lib/libc.a part and it built, but I'm doubting it was
successful because:

2) With the change, I'm able to successfully build and link (!) our
applications,
including indirect links to third-party products. However, the end
results can't
execute in AIX. Here's what happens when I run a program that was built
using the resulting cross-compiler:

# ./test
exec(): 0509-036 Cannot load program ./test because of the following errors:
0509-150 Dependent module libpthread.a(shr_xpg5_64.o) could
not be loaded.
0509-022 Cannot load module libpthread.a(shr_xpg5_64.o).
0509-026 System error: A file or directory in the path name
does not exist.

And here's the compilation/link step

powerpc-ibm-aix5.2-gcc -O2 -Wall -Wno-strict-aliasing -g -maix64 -o test test.o
-lpthread -ldl -lm

So, I'm stumped. I've tinkered with several things but I'm thinking
that the problems
are related. This codebase will build directly on an AIX machine so
it's obviously
the cross-compiler, but I can't figure out what's wrong (and the other cases did
finally work once I cleared the problems with soft links, etc.).

Anybody have any suggestions?

jmh


© 2004-2008 readlist.com