ExternalLibraries/MPI leads to link error in some cases

Issue #2049 closed
Frank Löffler created an issue

The MPI thorn does not properly set the list of libraries necessary to link against it when built. In particular, when built on a Debian stable (stretch) system, the 'rt' and 'util' libraries are pulled in by MPI, but not set in MPI_LIBS, leading to a Cactus link error in the end. Adding 'rt' and 'util' in general might not be the best idea, as this is very likely system-specific (to Linux in this case).

What needs to be done is to use information about the built library after it was built to set MPI_LIBS, as we cannot (always) predict which libraries MPI will pull in. This is complicated by the fact that those variables are set in detect.sh, and not build.sh, so build.sh would need means to set/change those variables. But since this is executed in a parallel make session usually, this requires some care.

Note that in case a pre-existing library is used, 'rt' and 'util' are correctly added to the required libs, because detect.sh actually queries the library. It cannot do that when building, because by that time it isn't built yet, and by the time it is, it is too late to tell Cactus at the moment.

I'll file this as a bug for the MPI thorn for now, but a better handling in Cactus in general is needed here. Also setting this as critical for the release, because it breaks the build on a major Linux distribution.

One might be tempted to temporarily "fix" this by adding 'rt' and 'util' to LIBS in debian.cfg. That is a bad idea, however, because Debian isn't a Linux-only distribution, and in general one might not even want to use OpenMPI there.

The same is true for adding 'rt' and 'util' to MPI_LIBS in build.sh, because that would only work on a system that has this library installed. On a Linux system, however, this solves the linking problem.

Ideally, we find some at least partial solution within only the MPI thorn for the current release, down-grade priority and assign to Cactus itself for a general solution. This has come up with other libraries in the past if I remember correctly.

Keyword:

Comments (3)

  1. Roland Haas
    • removed comment

    This is a general problem I think that shows up also for the names of the fortran mpi library that changes if the compiler supports f90 f2003 or newer.

    There are multiple suggested solutions (move configure back into CST stage or let build stage modify LIBS etc). I brlievd there are tickets for this.

  2. Frank Löffler reporter
    • changed status to resolved
    • removed comment

    For the moment, this is solved by detecting "linux" at build time, and adding those libraries in this to the mpi libraries in that case. This is not ideal, but the best that can be done short-term. Long-term I don't see why libraries when built by Cactus shouldn't be able to announce their flags at that time. Thorns depending on them wouldn't have been built at that time, or would rebuilt, so the issue is "only" to propagate this into the Cactus build system.

  3. Log in to comment