Multiple messages about MAIN_ with PGI 11.9

Recently, a cluster I use upgraded to PGI 11.9 and after that I started getting messages like this all over my makelogs:

/usr/local/sles11/pgi/linux86-64/11.9/lib/f90main.o: In function `main':
f90main.c:(.text+0x3c): undefined reference to `MAIN_'

They don’t seem to harm anything, but with a full make of our model, we end up with 10s, 100s of these.

Any idea of why these are occurring with 11.9 but not with earlier versions (as far as I can tell)? Or any idea of where to look? MVAPICH2? Our PGI install routine?

Please check your makefile (or other build system) to see if the files are being compiled with the -c flag.

It would help if you showed the command line of at least one compiler invocation that produces the error message.

Oddly, it seems to be occurring before any files are made. From my makelog:

for d in Config GMAO_Shared GEOSgcs_GridComp Applications; \
          do                     \
              echo Making install in $d ;\
              gmake -C $d -e install    ;\
              [ $? -ne 0 ] && exit      ;\
          done || exit 0;
Making install in Config
/usr/local/sles11/pgi/linux86-64/11.9/lib/f90main.o: In function `main':
f90main.c:(.text+0x3c): undefined reference to `MAIN_'
gmake[1]: Entering directory `/gpfsm/dnb31/mathomp4/Ganymed-1_0_UNSTABLE/GEOSagcm/src/Config'
GNUmakefile:31: Enabling build environment check
/bin/mkdir -p /discover/nobackup/mathomp4/Ganymed/GEOSagcm/Linux/bin /discover/nobackup/mathomp4/Ganymed/GEOSagcm/Linux/lib /discover/nobac
kup/mathomp4/Ganymed/GEOSagcm/Linux/include \
                 /discover/nobackup/mathomp4/Ganymed/GEOSagcm/Linux/etc /discover/nobackup/mathomp4/Ganymed/GEOSagcm/Linux/doc /discover/no
backup/mathomp4/Ganymed/GEOSagcm/Linux/Config

Following the logic printed out, it’s almost as if gmake itself triggers it?

This is only an uneducated guess (since the contents of the makefile or the commands issued by ‘make install’ have not been shown):

The make command is running the PGI compiler, which is one of many Fortran compilers that the makefile is supposed to work with, to figure out which flags to use with the subsequent compilations. The fact that the failure to link did not cause make to abort suggests this explanation.

Hmm. You’re probably right. I know our quite complex make system will include a file that runs “$FC --version” to figure out if you’re building with ifort and which version (and that used to cause warnings up the wazoo until PGI apparently added --version, bless you PGI), so maybe it’s running that in our make environment instead of a command line environment causing the issue?

I tried to whip up a nested example, but I can’t seem to trigger the MAIN_ using the same make style, e.g.:

.F90.o:
   $(FC) $(FOPTS) -c $<

and includes even with a truncated FC detection bit:

ifeq ($(word 1,$(shell $(FC) --version)), ifort)
   IFORT_VER := $(subst ., ,$(word 3,$(shell ifort --version)))
   IFORT_MAJOR := $(word 1,$(IFORT_VER))
   IFORT_MINOR := $(word 2,$(IFORT_VER))
endif

Ah well, it’s not hurting anything, just annoying my sense of cleanliness. If I ever figure it out, I’ll post it here.

I think I might have figured this out, at least a little. I think whenever our make system runs “mpif90 -V” or “mpif90 --version”, it throws the warning. To wit:

> pgfortran --version

pgfortran 11.10-0 64-bit target on x86-64 Linux -tp nehalem 
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.

> mpif90 --version

pgfortran 11.10-0 64-bit target on x86-64 Linux -tp nehalem 
Copyright 1989-2000, The Portland Group, Inc.  All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc.  All Rights Reserved.
/opt/pgi/linux86-64/11.10/lib/f90main.o: In function `main':
f90main.c:(.text+0x3c): undefined reference to `MAIN_'

So, apparently, when mpif90 gets the --version passed through, MVAPICH2 does something to trigger the warning.

Hi Matt,

It looks like mpif90 is invoking the linker instead of stopping when using “–version”. In the PGI pre-built MPICH libraries we added the following to the mpif90 script’s argument parsing:

        -V) # PGI ADDED
        #Pass this argument to the compiler as well. #PGI ADDED
         echo "mpif90 for $MPIVERSION" # PGI ADDED
         compileargs="$compileargs -V"
         DoLink=0       #PGI ADDED
         DoCompile=1    #PGI ADDED
         ;;

You might be able to add something similar to MVAPICH’s mpif90 script for “–version” so it doesn’t perform the link step.

  • Mat

Mat,

I think you are right. Looking at mpif90, it has this bit:

    -v)
    # Pass this argument to the compiler as well.
    echo "mpif90 for MVAPICH2 version $MPICH2_VERSION"
    # if there is only 1 argument, it must be -v.
    if [ "$#" -eq "1" ] ; then
        linking=no
    fi
    ;;

with linking=yes being the default. Of course, when built with PGI, -v triggers the verbose output which sort of defeats the purpose of this option. Obviously, then, passing -V or --version uses the default linking=yes path.

Well, it’s good to know the mystery is solved. I’m not sure it’s worth bothering the MVAPICH folks to “fix” this. Yes, adding --version would be possible, but -V is tricky. It has the potential of screwing up the -V_ver_ previous-version syntax of PGI when using mpif90 (since you want the linker to activate then).

Thanks for all the help,
Matt