Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#43 closed defect (wontfix)

Document use of +ppu / -qextname on HPUX and AIX

Reported by: marq Owned by: Carlo Buontempo
Priority: minor Milestone: 1.0
Component: ROPP (all) Version: 0.8
Keywords: Cc: dave.offiler@…, carlo.buontempo@…, axel.vonengeln@…

Description

The usual convention for Fortran compilers is to modify the name the name of objects slightly from the name in the source code; probably the most common form of this name mangling is that an underscore is appended to the name of a Fortran object. As an example, a function or subroutine foo will get the name 'foo_'. Plain C does not do any name mangling; a C function bar will be visible as C object bar in a library. This convention ensures that C and Fortran name spaces can be kept more or less seperate; on the other hand, mixed language programming is still feasible by following the appropriate naming conventiones when calling functions in one language from a function in an other language (at least as long as advanced Fortran 90 features are excluded). The cfortran.h header file uses this mechanism to construct wrapper between C and Fortran (77) code.

However, a small number of Fortran compilers does not follow this convention, most notably, HPUX and IBM's XL compilers (e.g on AIX), by default, do no name mangling on Fortran routines. This becomes a problem if there are duplicate names in the Fortran and C name spaces. For example, a single library which provides the same function for both C and Fortran requires some compiler mechanism to keep the two language versions apart. Also note that if one library is compiled with underscores, and another without, a program calling routines from both libraries can not be linked against the two libraries successfully; there will always be unresolved externals. Thus, the same convention must be used for all libraries of a given project.

For the HPUX and IBM XL compilers, seperate namespaces can be enforced by setting (when running configure)

   CPPFLAGS=-Dextname

for the C compiler, and

   FFLAGS=+ppu FCFLAGS=+ppu

and

   FFLAGS=-qextname FCFLAGS=-qextname

for the native HPUX and XL compilers, respectively.

Some research has shown that the udunits library requires seperate C and Fortran name spaces, and therefore requires the extname settings on both platforms. The above settings are indeed enforced by the build system of udunits. Thus, all other libraries must be compiled with these options as well.

We can (and do) enforce that for all ROPP packages. However, all external libraries like netCDF and Lapack / lapack95 also must be compiled with this convention.

User must be made aware of this by putting the above into the installation documentation.

Change history (3)

comment:1 by marq, 19 years ago

Cc: axel.vonengeln@… added; carlo.buontempo@… removed
Milestone: 0.91.0
Priority: normallow
Version: 0.8

comment:2 by Dave Offiler, 18 years ago

Resolution: wontfix
Status: newclosed

The (Met Office) native HP-UX F90 compiler does not support F95 features on which ROPP code depends (notable allocating NULL() to pointer declarations). The decision has been taken not to support the native HP compiler under HP-UX (though NAG and G95 continue to be until the HP kit is removed).

No AIX systems are available to Met Office ROPP Development Team, so this platform cannot be formally supported.

Documentation on compiler settings is implicitly done via example configure scripts; the HP-Fortran ones define, for the C compiler:

CPPFLAGS="-DhpuxFortran"

which is suffcient to mix F90 & C code in e.g. netCDF; use of +ppu does not seem to be necessary with this CPPFLAGS option for cfortran.h

The AIX cannot be tested here.

I have saved the above text in the local ROPP_ROOT/archive as README.compilers. If the Helpdesk should receive enquiries on these (unsupported) compilers, this file can be consulted. We do not plan to include informaiton un unsupported compiler settings in the main distributed ROPP documentation.

comment:3 by Dave Offiler, 18 years ago

Version: 0.8
Note: See TracTickets for help on using tickets.