Skip to content

mpif90 shows an invalid command on Ubuntu 22.04 + gcc #11636

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

Open
perazz opened this issue May 2, 2023 · 0 comments
Open

mpif90 shows an invalid command on Ubuntu 22.04 + gcc #11636

perazz opened this issue May 2, 2023 · 0 comments

Comments

@perazz
Copy link

perazz commented May 2, 2023

System information

  • Ubuntu 22.04 (Docker image) + gcc 11.3.0 + gfortran + OpenMPI 4.1.2 via apt

Background information

Working on an MPI wrapper for the Fortran Package Manager

After installing OpenMPI via apt, mpif90 shows invalid library directory flags, which make them useless.

I'm using this very simple Dockerfile:

FROM ubuntu:22.04
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      git vim gcc gfortran wget openmpi-bin libopenmpi-dev

Issue

mpif90 -show reports a non-existent directory flag: -L/usr/lib/x86_64-linux-gnu/openmpi/lib/fortran/gfortran :

root@87c9773eedf2:~/fpm-dev# mpif90 -show
gfortran -I/usr/lib/x86_64-linux-gnu/openmpi/lib/../../fortran/gfortran-mod-15/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib/fortran/gfortran -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lopen-rte -lopen-pal -lhwloc -levent_core -levent_pthreads -lm -lz

That folder does not exist, nor as a symbolic link.

  • If I try to build a program with the command output by mpif90 -show, I get a bunch of undefined reference errors, because the MPI libraries can't be found
  • If I instead build using mpif90 as the compiler, the build succeeds.

The other wrappers i.e. mpicc report the correct directory:

root@87c9773eedf2:~/fpm-dev# mpicc -show
gcc -I/usr/lib/x86_64-linux-gnu/openmpi/include -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi
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