Skip to content

MPI not linked during build? #66

@drhpc

Description

@drhpc

This issue covers apparently very basic build trouble on the path to package ScaLAPACK for pkgsrc, so I hope an issue is warranted. I do have changes to suggest, too, convering handling of dependencies (.pc file), but first the current version should at least build …

I might be too obvious, but I have trouble building scalapack 2.2.0. CMake lokates my compiler/MPI setup just fine:

$ mkdir b
$ cd b
$ cmake -DMPI_BASE_DIR=$(dirname $(dirname $(which mpicxx))) -DBUILD_SHARED_LIBS=on ..
[…]
-- Found MPI_C: /stuff/sw/env/gcc-10.3.0/pkgsrc/cvs-20210222/lib/libmpi.so (found version "3.0") 
-- Found MPI_Fortran: /stuff/sw/env/gcc-10.3.0/pkgsrc/cvs-20210222/lib/libmpi_usempif08.so (found version "3.0") 
-- Found MPI: TRUE (found version "3.0")  
-- Found MPI_LIBRARY : TRUE 
-- --> MPI C Compiler : /stuff/sw/env/gcc-10.3.0/pkgsrc/cvs-20210222/bin/mpicc
-- --> C Compiler : /stuff/sw/env/gcc-10.3.0/pkgsrc/cvs-20210222/bin/mpicc
-- --> MPI Fortran Compiler : /stuff/sw/env/gcc-10.3.0/pkgsrc/cvs-20210222/bin/mpif90
-- --> Fortran Compiler : /usr/bin/gfortran

But it doesn't even try to link to MPI, apparently:

[ 69%] Building Fortran object TESTING/LIN/CMakeFiles/xslu.dir/pslafchk.f.o
[ 69%] Linking Fortran executable ../xslu
/usr/bin/ld: ../../lib/libscalapack.so: undefined reference to `ompi_mpi_op_sum'
/usr/bin/ld: ../../lib/libscalapack.so: undefined reference to `MPI_Bcast'
/usr/bin/ld: ../../lib/libscalapack.so: undefined reference to `MPI_Op_create'
/usr/bin/ld: ../../lib/libscalapack.so: undefined reference to `MPI_Pack_size'
/usr/bin/ld: ../../lib/libscalapack.so: undefined reference to `MPI_Send'
/usr/bin/ld: ../../lib/libscalapack.so: undefined reference to `ompi_mpi_packed'

and, obviously

$ ldd lib/libscalapack.so 
        linux-vdso.so.1 (0x00007ffe647b2000)
        libopenblas.so.0 => /stuff/sw/env/gcc-10.3.0/pkgsrc/cvs-20210222/lib/libopenblas.so.0 (0x00007f4f73090000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4f73057000)
        libgfortran.so.5 => /usr/lib/libgfortran.so.5 (0x00007f4f72ea0000)
        libm.so.6 => /lib/libm.so.6 (0x00007f4f72ddc000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f4f72dd7000)
        libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f4f72dbf000)
        libquadmath.so.0 => /usr/lib/libquadmath.so.0 (0x00007f4f72d81000)
        libc.so.6 => /lib/libc.so.6 (0x00007f4f72bf6000)
        /lib/ld-linux-x86-64.so.2 (0x00007f4f75245000)

Shouldn't there be a reference to libmpi?

I also don't see e.g. MPI_LIBRARIES, MPI_LINK_FLAGS, or anything like that used in CMakeLists.txt. I guess it is supposed to make more use of the MPI compiler wrappers? How is this supposed to work? (Note: Don't be fooled by the cvs-20210222 name, it is a current checkout of the pkgsrc tree, which I am trying to add scalapack to.)

When I tried to hack in use of MPI_LIBRARIES, the main MPI symbols were resolved, but I still had some missing ones at some stage. So, before I dive too deep, I hoped to get some clarification that the build should normally just work or that I'm doing something wrong. I did have a working draft installation of scalapack-2.1.0 before. I might have to revisit why that worked.

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