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

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

Re: AIX to Solaris Cross Compiler

Alex Smith wrote:

> I have been trying to build a cross compiler to AIX 4.2.1 from Solaris 7
> x86.  I have gotten the same result with gcc 2.8.1 and gcc 2.95.  I can
> build the compiler and libraries without any trouble.  (Thus raising my
> hopes)  However, when I try to use my compiler to cross compile a test
> program it cannot resolve several simple symbols that are found in libc.a.

 Your basic assumptions may be wrong...

 What I remember having seen about AIX is that all its binaries are dynamic --
they use the shared libs always. No 'static' binaries... So you should link
against the shared libs always. In Linux, Solaris, SVR4 etc. these are the 
'.so' ones. For which purpose you have the '.a' ones in AIX is then a 

>  The only thing I can think of is that I either need to grab
> the libraries from a location other than /lib, or I am missing some weird
> AIX file (though I have never know IBM or AIX to do anything like that
> before :~) that ties every thing together.  

 For other systems one normally needs to define the dynamic linker and the 
directory where the shared libs are, using something like the following from
a i486-linux-gnu-target toolset:

 %{!dynamic-linker:-dynamic-linker \
	--rpath-link /usr/local/i486-linux-gnu/lib}}

in the '*link:' in 'specs'.

 For AIX you have to find the dynamic-linker somewhere and include it with the 
target libs, including the '.so' ones... And then add the 
dynamic-linker/rpath-link definitions into specs. The '-dynamic-linker xxxx' 
tells where it should search it at run-time (in AIX), when the '--rpath-link'
tells where it should search it and the another library stuff at link time (in 

 These are the preliminary tasks before starting to debug the install...

 The linker option '-verbose' should be useful when trying again. It shows the
tries and succeedings when linking. Just use '-Wl,-verbose' in the GCC command
line to give the option to linker...

> /usr/local/powerpc-ibm-aix4.2.1.0/lib/libc.a(shr.o)(.tc+0x0): : undefined
> reference to `environ'
> /usr/local/powerpc-ibm-aix4.2.1.0/lib/libc.a(shr.o)(.tc+0x0): : undefined
> reference to `_exit'
> /usr/local/powerpc-ibm-aix4.2.1.0/lib/libc.a(shr.o)(.tc+0x0): : undefined
> reference to `open'

 If you get it to search the shared libs instead, and still get every possible
symbol undefined, perhaps there is a bug in the AIX/powerpc config files and it
expect the library symbols having the '_' prefix (the macro 'USER_LABEL_PREFIX' 
or something in the config files). Just look your C-library file with 

   powerpc-ibm-aix4.2.1.0-nm | more

to see how the names are there... If the three previous ones are as 
'_environ', '__exit' and '_open' there, changing the
  #define USER_LABEL_PREFIX ""
  #define USER_LABEL_PREFIX "_"
in the proper config file and rebuilding the compiler will help...

 Ok, these should be enough for starting to debug the install...

Cheers, Kai
New CrossGCC FAQ:
To remove yourself from the crossgcc list, send
mail to with the
text 'unsubscribe' (without the quotes) in the
body of the message.

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