Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem compiling the Fortran sample code #8

Open
ningli opened this issue Aug 19, 2021 · 0 comments
Open

problem compiling the Fortran sample code #8

ningli opened this issue Aug 19, 2021 · 0 comments

Comments

@ningli
Copy link

ningli commented Aug 19, 2021

I encountered problems compiling the p3dfft++ package on a workstation with GCC 8.4.1 and OpenMPI. The command lines:

./configure --prefix=$HOME/software/build/p3dfft3 --enable-gnu --enable-fftw --with-fftw=$HOME/software/build/fftw-3.3.9 --enable-fftwmeasure
make

The Fortran sample code failed to build with the following and many similar errors


../../build/libp3dfft.3.a(init.o): In function `MPI::Intracomm::Clone() const':
/usr/include/openmpi-x86_64/openmpi/ompi/mpi/cxx/intracomm_inln.h:23: undefined reference to `MPI::Comm::Comm()'

The problem seems to be that the MPI compiler wrappers do not reference all the necessary library files (might this have something to do with C++ binding get deprecated in MPI?). To compile Fortran code against the c++ library, ether mpif90 or mpicxx can be used, but neither handles the linking correctly.

The temporary fixes are:

  • If using mpif90 to link the Fortran sample code, pass the additional -lmpi_cxx flag which is not in the wrapper. I pass this extra flag using the LDFLAGS env variable to the configure script to fix everything
  • If using mpicxx to link the Fortran sample code, pass -lgfortran flag to pick up the Fortran symbols. In addition, passing -lmpi_mpifh is also required as the sample code still use the old include 'mpif.h' way to include the MPI symbols.

Not sure how these can be incorporated in the software distribution and automated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant