Re: Help with building/using GCC cross compiler to AIX 5.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok, I've been playing with it a little more and the two problems are
definitely related.  I tried a simpler test program and got a complaint
about libc.a not having shr.o.  I then put /usr/lib *explicitly* on my
LIBPATH and both the simple and more complicated programs ran
correctly.

So, I think it's definitely back to the fact that I had to remove the
/usr/lib/libc.a details from the original GCC build and the resulting
executables are not automatically reading /usr/lib.  So, somehow
I need to modify the template or the link sequences to have /usr/lib
included in the link sequence without going to the /usr/lib on the
build machine (Linux).

Any suggestions?

jmh

On Dec 20, 2007 4:58 PM, Jeff Heisz <jmheisz@xxxxxxxxx> wrote:
> 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
>

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux