Skip to content

static libraries, F90 module, and alignment warnings #13043

Open
@MJRutter

Description

@MJRutter

If I try to use static libraries with the F90 module, lots of warning messages about alignment result whenever code is compiled. These disappear with the F08 module. Is the use of static libraries and F90 fully supported?

OpenMPI 5.0.6 source download (and several earlier versions), Ubuntu 24.04, GCC 13.3, x86_64

$ FC=gfortran CC=gcc CXX=g++ ./configure --enable-static --prefix=/scratch/OMPI
$ make -j 4
$ make install
$ /scratch/OMPI/bin/mpif90 -static hello.mpi.f90 

gives many warnings from ld starting

/bin/ld: warning: alignment 8 of normal symbol `mpi_fortran_weights_empty_' in /scratch/OMPI/lib/libmpi.a(ompi_mpi_init.o) is smaller than 16 used by the common definition in /tmp/cc4e0CUZ.o
/bin/ld: warning: NOTE: alignment discrepancies can cause real problems.  Investigation is advised.

The example code was

program hello
  use mpi
  integer npe,mype,ierr
  call mpi_init(ierr)
  call mpi_comm_rank(mpi_comm_world, mype, ierr)
  call mpi_comm_size(mpi_comm_world, npe, ierr)
  write(*,101) mype,npe
101   format(' Hello F90 parallel world, I am process ',I3,' out of ',I3)
  call mpi_finalize(ierr)
end program hello

Switching to "use mpi_f08" seems to resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions