This is the mail archive of the mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: more Linux --> AIX cross compiler questions

Hello once again!  Well, I checked out my
gcc-2.95/objdir/powerpc-ibm-aix4.3.1/libiberty/config.log file for
libiberty errors and now the linker says it can't read the "libg.a" file
from AIX due to an unrecognized file format.  Here is the actual error:

configure:1749: checking whether the C compiler
(/mnt/disk2/build/gcc-2.95/objdir/gcc/xgcc -B/mnt/disk2/buil
d/gcc-2.95/objdir/gcc/ -B/mnt/disk2/aixcross/powerpc-ibm-aix4.3.1/bin/ -g
-O2 ) works
configure:1765: /mnt/disk2/build/gcc-2.95/objdir/gcc/xgcc
-B/mnt/disk2/build/gcc-2.95/objdir/gcc/ -B/mnt/dis
k2/aixcross/powerpc-ibm-aix4.3.1/bin/ -o conftest -g -O2   conftest.c  1>&5
-ibm-aix4.3.1/lib/libg.a: file fo
rmat not recognized; treating as linker script
-ibm-aix4.3.1/lib/libg.a:1: parse
collect2: ld returned 1 exit status
configure: failed program was:

#line 1760 "configure"
#include "confdefs.h"

[root@unixgw libiberty]#

I copied libg.a from my AIX 4.3.1 /usr/lib directory to my Linux box and
the linker could find the file o.k.

Any ideas?



Alex Smith <> on 08/19/99 12:17:12 PM

To:   Tom Williams/HQ/dssi
Subject:  Re: more Linux --> AIX cross compiler questions

Hi Tom, I created a Solaris 7 x86 -> AIX 4.2.1 and a Linux -> AIX 4.2.1
very little problems using gcc 2.95.  I did run into some problems like you
with getting links instead of the real stuff (be sure to check your include
dir, IBM put quite a few links in there too).  The config that I found
best (flawlessly) was:
cd  $objdir
$gccdir/configure --host=$YOURHOST --target=$yourtarget  --with-gnu-as
--with-gnu-ld --with-headers=$LOCATIONOFAIXINCLUDEDIR
The only issue I had was resolving the dynamic linking of libc.a (yes
right the .a file)  On AIX there are no .so files, but the .a's are all
dynamically linked.  After I built my compiler and tried to run the
on my AIX boxes I would get:
exec(): 0509-036 Cannot load program testcpp because of the following
        0509-022 Cannot load library libc.a[shr.o].
        0509-026 System error: A file or directory in the path name does
not exist.
This is because the linked in Dynamic library path was
/usr/local/powerpc-ibm-aix4.2.1.0/lib.  The location were the AIX libraries
install to.  I tried to work this out in my specs file, but I couldn't get
it to
work.  I fixed this by adding -Wl,-rpath /usr/lib to my build options .
Ideally you would put -rpath /usr/lib in the link section of your specs
for you cross compiler.
I hope this will be a useful heads up.  Let me know if you figure out the
 On Thu, 19 Aug 1999, you wrote:
> Thanks for all of your help.  Well, it turns out the
> 'gcc-2.95/objdir/powerpc-ibm-aix4.3.1/libiberty/config.log' showed a link
> error when trying to link a test program during the libiberty build.  I
> some investigation and found that when I copied (or tried to copy) the
> libs to my Linux box, the libs I copied still had the symbolic links to
> actual libs back on AIX.  For example, /usr/lib/libc.a was linked to
> /usr/ccs/lib/libc.a and so on.  Of course, those /usr/ccs directories
> exist on Linux, so I'm going to get the *real* AIX libraries and make
> they are properly installed on my Linux box.  Then, I'll push the
> cross-compiler car back up the hill and see if it rolls down all the way
> this time!!!!!!!
> I'm not sure if linking system libraries from /usr/lib to other
> is a common practice in other Unix systems, but I will forewarn other
> compiler builders out there:  BE SURE YOU ARE COPYING THE CORRECT HEADERS
> with the header files being linked to different directories.  I guess I
> didn't do such a thorough job with the libs.
> Peace......
> Tom
> Ian Lance Taylor <> on 08/19/99 09:57:55 AM
> To:
> cc:   Tom Williams/HQ/dssi,
> Subject:  Re: more Linux --> AIX cross compiler questions
>    From: "Kai Ruottu" <>
>    Date: Thu, 19 Aug 1999 17:35:18 +0000
>     Otherwise than Ian Lance Taylor wrote earlier, the 'powerpc-aix4.3-ld
> --help'
>    will give the option '-rpath-link' as one of the 'supported'... But
> doesn't it
>    work, as Ian wrote ? This should be the right option for linking, when
>    '-rpath' or '-rpath-link' is needed for the shared libs to be found at
> the
>    'wrong' non-native places with a cross-toolset. But is the
>    working only with ELF-targets and the AIX's XCOFF-tools don't use
> The --help option to ld tends to give the same set of options no
> matter which target you use.  The --rpath-link option does work on ELF
> and SunOS.  However, it has no effect on AIX.  The --rpath-link
> documentation in the linker manual mentions this.
> I actually don't think --rpath-link is needed on AIX.  On ELF, the
> --rpath-link option is used because one shared library can refer
> directly to another, and the linker wants to try to track down the
> referenced shared library in order to give appropriate warnings if
> some shared library or symbol is not defined.  AIX shared libraries
> are very different from ELF shared libraries, and I'm not sure that an
> AIX shared library can actually refer to another shared library.
> In other words, I don't think there is any plausible meaning for
> --rpath-link on AIX, so I think the linker is correct to ignore it.
> The -L and --rpath options do work on AIX (on AIX, --rpath is a GNU
> extension).
> I would normally use the -L and -rpath options to handle shared
> libraries which are found in different places on the host and target
> systems.  The --rpath-link option is for the special case when one
> shared library refers to another shared library which is not included
> directly in the link, and the referenced shared library is in a
> different place on the host and target systems.  If you don't have a
> case in which one shared library refers to another which is not
> included directly in the link, there is no reason to use the
> --rpath-link option.
> Ian
> ------
> Want more information?  See the CrossGCC FAQ,
> Want to unsubscribe? Send a note to
Alex Smith
ESM Software Engineer
Modules Team
Axent Technologies, Inc.
(801) 227-3711

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]