Java .NET Integration

Porting enterprise applications from Windows to HP-UX11i for Intel® Itanium® 2

Overview

Mainsoft for UNIX and Linux enables Independent Software Vendors and IT development organizations to port Windows applications to UNIX platforms, including HP-UX PA RISC and HP-UX 11i v2 for Intel Itanium 2. Mainsoft and HP engineering teams partnered together to offer Mainsoft for UNIX and Linux for HP-UX 11i on Itanium 2.

This paper helps software development organizations to better plan their software porting project from Windows to HP-UX 11i Itanium 2 or from HP-UX 11 PA-RISC to HP-UX 11i Itanium 2 by sharing Mainsoft expertise in compiling and deploying Visual C++ applications on HP-UX 11i Itanium 2.

Planning your application-porting

Mainsoft for UNIX and Linux 5, itself, is an application consisting of approximately 7 million lines of C++ code, including millions of lines of Windows code. Mainsoft for UNIX and Linux has supported HP-UX on PA-RISC starting with HP-UX 9. The project, from start to shipping a general availability version of Mainsoft for UNIX and Linux 5 for HP-UX 11i on Itanium 2, required 3 months of development and testing. This paper is based on this experience of porting Mainsoft for UNIX and Linux 5 from HP-UX 11i for PA-RISC to HP-UX 11i for Itanium-2.

During this project, Mainsoft adapted Mainsoft for UNIX and Linux to run and scale on HP-UX 11i and HP made modifications to the operating system environment, to the C++ compiler, and the development tools to support an effective migration of Visual C++ Windows applications to HP-UX 11i.

Mainsoft recommends planning the porting phase rather than going through an ad-hoc process of trials and errors. In order to support this porting planning process, we describe below the technical issues that should be considered when porting a Windows application to HP-UX 11i for Itanium 2.

3rd party software

Every porting project depends on the availability of development tools and software infrastructure on the target platform.

A large number of commercial software is already available on the HP-UX 11i operating environment; Mainsoft for UNIX and Linux required the following 3rd party software, which we found available and fully functional on HP-UX 11i for Itanium 2:

  • Rational ClearCase
  • Java
  • Samba
  • Apache HTTP Server 1.3.X
  • Open SSL

The following 3rd party software was not yet available as of June 2003:

  • InstallShield
  • Data Direct ODBC drivers (only the Oracle ODBC driver was available)

Porting your application

Compiler and OS patches

It is recommended to install the compiler and OS patches listed in Appendix A and Appendix B, in order to benefit from the modifications made by the HP engineering teams for Mainsoft for UNIX and Linux for HP-UX 11i for Itanium 2.

Compatibility with HP-UX PA-RISC libraries

On PA-RISC, the original compiler did not support new ANSI C++ standards, including namespace lookup and advanced templates. When the compiler introduced these new features, a new C++ Application Binary Interface (ABI) was also introduced. In order to compile under the new ANSI mode, the compilation flag, -AA, had to be explicitly turned on. This divided the HP-UX PA-RISC applications into two families: the new ANSI one (compiled with -AA) and the others (compiled without -AA ). These two families were not binary compatible, and two different modules could not reside within the same application.

On Itanium 2, the ANSI flag is now turned on by default. As a result, special care should be taken not to mix modules. In addition, the fact that -AA mode is default may affect your link line: if your application was previously compiled without the -AA and linked with the libraries: Csup, std and stream, then, on Itanium 2, you would like to change your link line by replacing the above libraries with the following ones: std_v2, Csup_v2 (your new link line will contain the following: -lstd_v2 -lCsup_v2 ).

If you compiled your PA-RISC application without -AA, and still like to do so on Itanium 2, then you might consider using the -AP flag in order to turn off the -AA default behavior.

Compiler Flags

The flag +Daportable , which was common in PA-RISC in order for the binaries to be runnable on older PA-RISC architecture, is no longer relevant and should be removed.

In addition, the correct flag for turning on debugging information is no longer +objdebug. Instead, use -g .

Shared library naming convention

The shared library naming convention on Itanium 2 is different than that of PA-RISC. On PA-RISC, general names for libraries, libxxx.sl, are used, whereas on Itanium 2, the libraries are named libxxx.so. This will affect both build systems and all code that loads shared libraries at runtime (e.g. calls to dlopen() or shl_load() ). This might also affect other production scripts.

Virtual table layout

The virtual table layout that the HP-UX for Itanium 2 C++ compiler generates is different than that on PA-RISC. HP has made a decision to use the same Application Binary Interface (ABI) as g++ for Itanium. The exact ABI description can be found at www.codesourcery.com . If your application relies on the exact layout of the virtual table, modifications to the code will probably be necessary. An example of such an application is an application that calls COM interfaces in C rather than in C++.

On HP-UX for PA-RISC (and on most UNIX platforms as well as on Windows) the virtual table of a C++ object contains, among other things, pointers to the methods. So, if you have explicitly built a virtual table in your code, the following syntax should work fine:

pObject->lpVtable->Method()

On HP-UX for Itanium 2, a function pointer is actually a pointer to a function descriptor (which is a structure of size 16 bytes). As an optimization, the virtual table on HP-UX for Itanium 2 contains an array of function descriptors instead of function pointers. Therefore, in theory, the syntax:

pObject->lpVtable->Method()

should be replaced by the following:

(* (Function type*) &(pObject->lpVtable->Method_descriptor)) (arguments);

The specific issues of COM in C have been solved more elegantly, and a specific knowledge base article is available at http://dev.mainsoft.com/Default.aspx?tabid=55.

Optimizing your application

HP-UX 11i v1.6 versus HP-UX 11i v2

In order to obtain optimal performance for mission-critical, enterprise software applications, on the Itanium 2 architecture, Mainsoft recommends deploying on HP-UX 11i v2, which was announced by HP on May 19th, 2003 (http://www.hp.com/hpinfo/newsroom/press/2003/030519a.html) .

In order to reduce time-to-market, the port can be done on HP-UX 11i v1.6, which is already available, using Mainsoft for UNIX and Linux 5.0.2 and the Stingray components and then deploying on HP-UX11i v2 for optimized performances.

New HP-UX 11i for Itanium thread library

The implementation of the thread library has changed significantly between HP-UX 11i on PA-RISC and HP-UX 11i on Itanium 2. The new feature added is support for process scope threads.

We ran into scenarios causing thread starvation (many threads were trying to acquire a mutex, and some of the threads were never allowed access). In order to workaround this problem you would like to compile your application with the flag: -DPTHREAD_COMPAT_MODE .

Also note that the performance of the thread library is different than the HP-UX for PA-RISC, and you might have to repeat any performance tuning phases you previously made on your application.

HP is planning to introduce additional changes in the thread library in HP-UX 11i v2.

It is recommended that you contact HP directly to determine if OS or compiler updates are available that resolve any of the HP-UX 11i v1.6 issues we encountered.

Use Itanium 2 optimizer more conservatively

The optimizer for the HP-UX for Itanium 2 compiler is more aggressive than the PA-RISC compiler, and makes more assumptions about the behavior of the analyzed code, even in the default optimization mode. Thus, valid code that worked on PA-RISC can sometimes fail on Itanium 2. In order to avoid this, it is highly recommended to use +Ointeger_overflow=conservative when optimizing.

This recommendation holds for HP-UX 11i v2, as well.

Disabling TCP optimizations

Due to a bug in the TCP stack of HP-UX 11i v1.6 for Itanium 2, which causes the machine to crash, we needed to disable TCP optimizations done by the TCP stack.

To disable the TCP optimizations

  • Open a shell as root.
  • Enter the following command:

ndd -set /dev/sockets socket_caching_tcp 0

HP plans to fix this issue in HP-UX 11i v2.

Leveraging Mainsoft Porting Expertise

In completing the port of Mainsoft for UNIX and Linux 5 to HP-UX 11i for Itanium 2, Mainsoft Consulting and Development teams have obtained a high level of expertise and knowledge related to HP-UX 11i. To assist you with achieving a successful deployment on this new platform, Mainsoft has porting experts available to provide an array of consulting services. Please contact Mainsoft at info@mainsoft.com for additional information.

Appendix A

OS Patches

Patch number Name
PHSS_28702 U2comp/plugin library patch
PHSS_28969 fdm cumulative patch
PHSS_28970 A.05.50 C++ library patch
PHSS_28971 Linker + fdp cumulative patch
PHSS_28972 Math library patch
PHSS_28973 Itanium 2 Assembler updates
PHSS_28975 milli.a cumulative patch
PHCO_29111 Thread library patch

Patch number Package version Name
PHSS_26651 B.11.22.03 Graphics3D cumulative patch
PHSS_28876 B.11.22.04 Xserver cumulative patch

Appendix B

Compiler versions

Compiler Version Package/Patch Name
C++ A.05.36 B3910B
C++ A.05.50 PHSS_28700
C A.05.36 B3910B
C A.05.50 PHSS_28701

Install the C compiler before you install the C++ compiler.

You must already have compiler version A.05.36 installed in order to install compiler version A.05.50 (the required version), which is available as a patch for both compilers.