Skip to content

tests fail to build: mpi library not linked #47

Closed
@drew-parsons

Description

@drew-parsons

For the new v2.2.0, the handling of the fortran compiler was changed in commit #61c60f5 to keep the identity of the fortran compiler (CMAKE_Fortran_COMPILER) separate from the MPI fortran compiler (MPI_Fortran_COMPILER). Previously the mpi wrapper was also used as the plain fortran compiler.

That change makes sense. The serial and mpi variants of the fortran compiler should be handled separately. But it has a consequence on the tests in TESTING. These tests link against -lscalapack, but libscalapack requires libmpi. It's not automatically pulled in, the -lmpi need to be added when compiling the tests.

The tests are currently configured to use the standard compiler (implicitly, CMAKE_Fortran_COMPILER). Before commit #61c60f5, the identification with MPI_Fortran_COMPILER meant that mpifort added the required -lmpi. Now that CMAKE_Fortran_COMPILER is kept separate, gfortran is used without -lmpi, so tests fail to link, giving errors like (in the case of xclu from TESTING/LIN)

/usr/bin/gfortran -Wl,-z,relro -Wl,--as-needed -g -O2 -ffile-prefix-map=/build/scalapack-2.2.0=. -fstack-protector-strong -std=legacy -std=legacy CMakeFiles/xclu.dir/pcludriver.f.o CMakeFiles/xclu.dir/pcluinfo.f.o CMakeFiles/xclu.dir/pcgetrrv.f.o CMakeFiles/xclu.dir/pcmatgen.f.o CMakeFiles/xclu.dir/pmatgeninc.f.o CMakeFiles/xclu.dir/pclaschk.f.o CMakeFiles/xclu.dir/pclafchk.f.o -o ../xclu  -Wl,-rpath,/build/scalapack-2.2.0/build-mpich/lib ../../lib/libscalapack-mpich.so.2.2.0 /usr/lib/x86_64-linux-gnu/liblapack.so /usr/lib/x86_64-linux-gnu/libblas.so /usr/lib/x86_64-linux-gnu/libblas.so 
/usr/bin/ld: ../../lib/libscalapack-mpich.so.2.2.0: undefined reference to `MPI_Barrier'
/usr/bin/ld: ../../lib/libscalapack-mpich.so.2.2.0: undefined reference to `MPI_Waitall'
/usr/bin/ld: ../../lib/libscalapack-mpich.so.2.2.0: undefined reference to `MPI_Send'
/usr/bin/ld: ../../lib/libscalapack-mpich.so.2.2.0: undefined reference to `MPI_Comm_dup'
/usr/bin/ld: ../../lib/libscalapack-mpich.so.2.2.0: undefined reference to `MPI_Irecv'
/usr/bin/ld: ../../lib/libscalapack-mpich.so.2.2.0: undefined reference to `MPI_Isend'
...
collect2: error: ld returned 1 exit status
make[4]: *** [TESTING/LIN/CMakeFiles/xclu.dir/build.make:193: TESTING/xclu] Error 1

I guess the test configuration should be updated so that the tests get compiled using MPI_Fortran_COMPILER

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions