Sizeof missing when compiling with mpif90

I’m trying to compile a program that uses mpi with mpif90 from the portland group on OSX. I get the following error:

mpif90 -DUSEMPI -DHAVE_MPI_WTIME -g -o xbeach xbeach-xmpi.o xbeach-general_mpi.o [several .o files here …] xbeach-xbeach.o
Undefined symbols:
mpi_sizeof0dl”, referenced from:
_L.350_34_0_1 in xbeach-xmpi.o
[… several .o files here]

I get this error for the following symbols:
mpi_sizeof0dl” <- logicals?
mpi_sizeof0dch” <- complex?

I have one call to a sizeof function:
call MPI_Bcast(par,sizeof(par),MPI_BYTE,xmpi_master,xmpi_comm,ierror)
where par is of a derived type with quite a lot of variables (chars, reals, logicals) and a few pointers that are broadcasted separately.

I noticed that symbols like these are present in /opt/pgi/osx86-64/2011/mpi/openmpi/lib/libmpi_f90.a
I tried compiling with openmpi and gfortran and that works fine. Does anybody have a suggestion on how to solve this?

Kind regards,



We would need a simple program to show that. Can you provide us?
The precompiled OpenMPI that comes with PGI compiler is version 1.2.7. Perhaps it might be a bit old?


I was able to simplify it to this example:

program testbcast
use mpi
implicit none

logical :: a
integer :: ierror, rank, size

a = .true.
call mpi_init(ierror)
call mpi_sizeof(a, size, ierror)
call mpi_finalize(ierror)
end program testbcast

This is the output I get.

  • $ mpif90 ./testbc.F90
    NOTE: your trial license will expire in 2 days, 13.6 hours.
    NOTE: your trial license will expire in 2 days, 13.6 hours.
    Undefined symbols:
    mpi_sizeof0dl”, referenced from:
    MAIN in testbc.o
    ld: symbol(s) not found

The mpi_sizeof functions are made by the script in openmpi. I tested this program also with openmpi 1.5 from macports + gfortran 4.4 and that gives the same error.


This might be a bug in OpenMPI. There is an interface for mpi_sizeof for logical but the does not create a routine because lkinds is not there in

A workaround is to use mpi_type_size.

call mpi_type_size(MPI_LOGICAL, size, ierror)

You mentioned in the first post that you have used gfortran to compile Openmpi and that works for you. Which version of OpenMPI? On Mac OSX?


This simple example I made does not work for gfortran 4.4 + openmpi 1.5 +gcc44 (build with macports). My original code works with gfortran + openmpi but I don’t call the mpi_sizeof directly. I think it’s called by some mpi subroutine that I call with a derived type with a logical, or with a logical.

I am seeing the errors with pgi 12.4 on mac os x and openmpi 1.6

There is no resolution on this thread, so I’m assuming that pgi compilers do not work with openmpi anymore.

Hi srinath22,

As Hongyon notes, it looks to her as a problem with OpenMPI not generating “mpi_sizeof” routine. Unfortunately, I don’t know if this has been resolved by OpenMPI.

However, if this is a case where there is just a external reference and the routine is never called directly, you can add the flag “-Mnoref_externals” to eliminate these references.

I’ll ask Hongyon what the status of this is.

  • Mat

I still see that it has not been fixed in OpenMPI 1.6. It only happens with logical type. This is not a compiler issue.

call mpi_type_size(MPI_LOGICAL, size, ierror)


You should post this to the Open MPI community mailing list so that it can get fixed (I only stumbled across this via Google Alerts).