eschnett/MPItrampoline

Building shared and static libraries at once

Opened this issue · 4 comments

Currently the default behaviour is to only build static libraries. It might be good build both static and shared libraries since then if libmpi.so is in the default search path it is not selected over the library from MPItrampoline (MPItrampoline would shadow libmpi.so and libmpi.a).

I am using the default cmake settings here (I think). These seem to be to build static libraries only be default, and build shared libraries when the cmake option -DBUILD_SHARED_LIBS=ON is given.

Are you asking for a way to build shared libraries, or are you asking to change the default behaviour?

Well, it is much more common to find MPI as a shared library, so in this case I think a change in the default is a good idea. Doing both builds would help cover yourself (but we could also do this in our build process, leveraging -DBUILD_SHARED_LIBS=ON and -DBUILD_SHARED_LIBS=OFF)

I realize I'm not testing shared libraries in the CI setup. Indeed it's failing for the Fortran 2008 bindings (see https://github.com/eschnett/MPItest/runs/5112540330?check_suite_focus=true), although those are very incomplete and almost certainly not used in practice yet. Will have to debug before changing the default.

Building MPItrampoline as shared library does not work on macOS for the Fortran MPI bindings. I would like to keep the default as is (static) to keep things consistent across operating systems.