porting an application on 64-bit AIX version 5

Hi all,
I am facing problem in porting to 64 bit AIX especially with compiling options to compile and run under 64 bit kernel.Can any one put some light on the issue
thanks in advance
vishal

You may as well have asked:
"I'm having some problems with AIX, can you tell me why?"

What is the environment, AIX level and application?
What compiler are you using, vendor and level?
Did it work in 32bit?
Did it work on AIX or are you porting from some other OS?
What is the problem?
What command are you using?
What is the error or problem you see?

Do you see you asked a rather vague question?

  1. Has the application run in any other 64 bit environment (UltraSparc, DEC-Alpha, PA-RISC2, Itanium2 etc)?

  2. Does it *have* to be a 64 bit application? 32 bit apps will work with 64 bit kernel, if your program is not using >2gig of memory it's pointless being a 64 bit app.

  3. Does it compile in 32 bit mode will *all* warnings on? If gcc, this would be "-Wall -Werror"?

  4. Typical errors are:

a) not using socklen_t
b) incorrect printf style va_args
c) expecting an int to hold a pointer
d) va_args in general

  1. Are all your dependent libraries available as 64 bit?

  2. What errors are you getting?

i will try being more clear...the application already runs on 32 bit and has also run on many 64bit boxes like ZSUSE.basically i am not able to find out what compiler options are needed to compile and run 64-bit appns on AIX kernel -5.like for eg on solaris 64 bit i am able to do
cc -xarch=generic64 -O -o foo64 foo.c
for running say fooc. but how do i accomplish that on AIX 64.

Which c compiler are you using gcc, xlc or something else?

i have both the compilers installed i.e gcc and xlc
i tried using
gcc -q64
bt it didnt worked.......can you put some infor on options for either or both compilers

I thought gcc was "-m64"

GCC RS/6000 and PowerPC Options 

-mcpu=cpu-type -mtune=cpu-type -mpower -mno-power -mpower2 
-mno-power2 -mpowerpc -mpowerpc64 -mno-powerpc -maltivec 
-mno-altivec -mpowerpc-gpopt -mno-powerpc-gpopt -mpowerpc-gfxopt 
-mno-powerpc-gfxopt -mnew-mnemonics -mold-mnemonics -mfull-toc 
-mminimal-toc -mno-fp-in-toc -mno-sum-in-toc -m64 -m32 -mxl-call 
-mno-xl-call -mpe -msoft-float -mhard-float -mmultiple -mno-multiple 
-mstring -mno-string -mupdate -mno-update -mfused-madd -mno-fused-madd 
-mbit-align -mno-bit-align -mstrict-align -mno-strict-align -mrelocatable 
-mno-relocatable -mrelocatable-lib -mno-relocatable-lib -mtoc -mno-toc 
-mlittle -mlittle-endian -mbig -mbig-endian -mcall-aix -mcall-sysv 
-mcall-netbsd -maix-struct-return -msvr4-struct-return -mabi=altivec 
-mabi=no-altivec -mprototype -mno-prototype -msim -mmvme -mads 
-myellowknife -memb -msdata -msdata=opt -mvxworks -G num -pthread 

xlc uses "-q64".

Try building...

#include <sys/types.h>
#include <stdio.h>
#include <limits.h>

#ifndef _LP64
#error not _LP64
#endif

also don't forget to look at the COFF object header to see what sort of object you have built.

gcc -m64 isnt working,says no such option
and for xlc -q64 it says
xlc: cannot retrieve message number 1501-221
any idea?

Vishal,
Your nls path is not set, that is why your not able to see message.
I did porting a application on AIX 5.3. I used

xlc_r -q64 -qwarn64

try to use these options.

hey great,
can you tell me some points on porting application to 64 bit.It is a combination of 32-bit and 64-bit executables,was running fine on 32-bit AIX but we need to run that on 64 bit.What are the main changes we need to make.

how do i differentiate between an AIX 64 bit and AIX 32 bit using a single command.
I tried versions of uname but it only gives some arbitrary results.for other OS uname -m did work but for AIX it aint working.
any help?

Not in the same process, in a single process all loaded binaries have to be either 32bit or 64bit.

Other than that, operating systems like Irix and Solaris use a differenet lib path variable in 64 bit compared to 32 bit. What AIX does is have both 32 bit and 64 bit code in a single shared library, the shared library is actually a normal archive file with a "shr.o" for 32 bit, and a "shr64.o" for 64 bit, both the linker and loader are supposed to sort out what is expected based on the current "mode".

You can always check what compilation environment is available to you by means of the sysconf() function.

_SC_XBS5_ILP32_OFF32 Implementation provides a C-language compilation environment
with 32-bit int, long, pointer and off_t types.
_SC_XBS5_ILP32_OFFBIG Implementation provides a C-language compilation environment
with 32-bit int, long and pointer types and an off_t type
using at least 64 bits.
_SC_XBS5_LP64_OFF64 Implementation provides a C-language compilation environment
with 32-bit int and 64-bit long, pointer and off_t types.
_SC_XBS5_LPBIG_OFFBIG Implementation provides a C-language compilation environment
with an int type using at least 32 bits and long, pointer
and off_t types using at least 64 bits.

Man sysconf for further information.

use following command

#bootinfo -K, if it is 64-bit kernel it will give you 64.

further you can run #file <filename> command on AIX to see whether
the binary it 32-bit or 64-bit. If you have both in one library ared
with ar command then try following commands

dump <binaryfilename>
nm <binaryfilename>

use man pages to learn more about these commands, there are options to
see the symbols too (i.e. 32-bit symbols and 64-bit symbols)

Hello..

I have curently have my Pro C code working on the AIX 4.3.3 which is a 32 bit system. The Oracle version is 8.1. Currently IBM xlc compiler is installed on this box.

Now we have moved the code into a new box (AIX 5.3.3) which is a 64 bit system. The Oracle has been upgraded to 10g..

I tried to recompile the code with the gcc compiler, but was facing some major issues in doing so. So we have now decided to go for the IBM xlc compiler. Now my main concern is that would the 32 bit code be able to compile on the new box? What all changes would I need to do so as to point to the 64 bit libs.

Any help in this regard would be highly appreciated.

Thanks
Megha