How do I compile 32-bits source code in Tru64?

How do I compile 32-bits source code in Tru64?

Post by Jim Li » Tue, 16 Apr 2002 17:51:57



Dear All,

I have a 32-bits Linux program. I want to port to Tru64.
How do I compile 32-bits source code in Tru64?
I have compaq C/C++ complier and gcc complier in Tru64.
I know -xtaso_short -taso flag can change pointer from 64-bits
to 32-bits in compaq C/C++ complier. But my application's
RPC function still can't work. In addition, how to change
"long" type to 32-bits?

Thank you!

Jim (J. J. Liu)

 
 
 

How do I compile 32-bits source code in Tru64?

Post by Jesse Marli » Wed, 17 Apr 2002 05:51:18



> Dear All,

> I have a 32-bits Linux program. I want to port to Tru64.
> How do I compile 32-bits source code in Tru64?
> I have compaq C/C++ complier and gcc complier in Tru64.
> I know -xtaso_short -taso flag can change pointer from 64-bits
> to 32-bits in compaq C/C++ complier. But my application's
> RPC function still can't work. In addition, how to change
> "long" type to 32-bits?

I think the preferred way to handle this would be to make it work
the same on either platform.  If you need 64 bit or 32 bit values
then define them in a central place and have them set accordingly
per the architecture.  It would definitely be easier to port using
gcc because most of the compiler directives would be available in
either architecture.  For example #pragma pack(x), which allows you
to set the default packing.  This will be important when writing
structures over a network or to disk where you want the structure
to be the same size on each architecture.

#pragma pack(1)

struct rpc_struct
{
   myint32 command;     /* 4 bytes */
   char flag;
   char filler[3];      /* This aligns us to an 8 byte boundary, which
                           is important for DGUX, but not for linux. */
   myint32 status;      /* 4 bytes */
   char filler[7];      /* Align to 8 byte boundary. */
   myint64 last_status; /* 8 bytes. */

Quote:};

/* Restore to natural alignment */

#if arch == TRU64
#pragma pack(8)
#else
#pragma pack(4)
#endif

Some of the above is pseudo-code, but the idea is to make the code sharable
between the architectures and platform dependent only when absolutely
necessary.  The typedefs make our structure the same size on either platform.
This would be important if you were sending data from DGUX->Linux or
vice-versa.

Hope this helps.

> Thank you!

> Jim (J. J. Liu)



 
 
 

1. Compiling 64-bit code on 32-bit machine

Hello,

From the Solaris 7 64-bit Developer's Guide FAQ:

  Can I build a 64-bit application on a system running the 32-bit
  operating system?

    Yes, provided you have the 64-bit library packages installed. However,
    it is not possible to run the 64-bit application on a system running
    the 32-bit operating system.

1.  What are the names of the 64-bit libraries?  How can I ensure
    only those libraries are used during a compile and not any 32-bit
    ones?

2.  What compilers can generate 64-bit code on 32-bit machines?  
    Does GNU CC?

3.  What compiler flags are used to instruct a 64-bit compile?  for
    which compiler?

I realize I wouldn't be able to test the generated 64-bit code on a
32-bit machine.   Perhaps the answers should go in the solaris FAQ.

Thanks,
Sam

2. Setting java file type for apache

3. Can Linux G++ create DOS flat 32 bit DPMI code?

4. new PS/2 mouse support needed [Intellimouse]

5. Compiling 32 bit code in aix5.1

6. Help ! X SVGA with MAG DX17F

7. 64-bit instructions in 32-bit code

8. Rsync between Solaris and Linux

9. code to determine 64-bit vs 32-bit binaries?

10. 32-bit code on 64-bit RS/6000

11. Calling 16-bit PM code from 32-bit PM Kernel Driver

12. Solaris 9 installed with 32 & 64 bit supports but boots in 32 bit mode

13. Subagent works when compiled in 32 bits, not in 64 bits