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

Missing symbols due to stealthy libmpi_cxx include in OpenMPI #1

Closed
phdum opened this issue May 5, 2020 · 1 comment
Closed

Missing symbols due to stealthy libmpi_cxx include in OpenMPI #1

phdum opened this issue May 5, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@phdum
Copy link
Member

phdum commented May 5, 2020

Prerequisites

Having a OpenMPI version that was compiled with cxx bindings.

Description

Certain versions of OpenMPI (including the most recent stable 4.0.x) still include cxx bindings, which can be optionally compiled to a separate library libmpi_cxx. Depending on the linux distribution these may or may not be built by default.

If they were build, the mpi.h header (superficially "c only") will by default also include all the cxx bindings.

From ompi/mpi.h (https://github.com/open-mpi/ompi/blob/v4.0.x/ompi/include/mpi.h.in):

#if !defined(OMPI_SKIP_MPICXX) && OMPI_BUILD_CXX_BINDINGS && !OMPI_BUILDING
#if defined(c_plusplus) || defined(__cplusplus)
#include "openmpi/ompi/mpi/cxx/mpicxx.h"
#endif
#endif

Then when we try to compile a program against our own mpi_c target, it complains of the unresolved symbols (since we are not linking against libmpi_cxx).

The solution would be to include

#define OMPI_SKIP_MPICXX

Somewhere before we import the mpi.h header.

The only question is: do we want to do this simply as a global definition in a header. Or do this in cmake, so that that recognizes if this will be a problem and adds the appropriate flag.

Finally, MPICH2 also cxx bindings. I did not check if they could cause problem there, but a similar issue could arise.

Versions

Current unstable branch: b6e6dd3

@phdum phdum added the bug Something isn't working label May 5, 2020
@phdum
Copy link
Member Author

phdum commented May 7, 2020

Resolved by #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant