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

CMake configuration file missing dependency to MPI::MPI_C #17

Closed
sdebionne opened this issue Oct 25, 2019 · 11 comments
Closed

CMake configuration file missing dependency to MPI::MPI_C #17

sdebionne opened this issue Oct 25, 2019 · 11 comments

Comments

@sdebionne
Copy link

The CMake configuration files generated at installation with boostorg/boost_install have an imported target that is missing a dependency to the underlying MPI library. The symptoms are an invalid linking order and the associated undefined symbols errors.

@pdimov, what would be the right way to have something like find_dependency(MPI) and target_link_libraries(Boost::mpi PUBLIC MPI::MPI_C) added to the config file? Shall we add a test for MPI to the boost_install test suite?

@pdimov
Copy link
Member

pdimov commented Oct 25, 2019

Yes, adding a test will certainly be a required part of the solution.

@aminiussi
Copy link
Member

As for now, there still might be a problem with open MPI:

When including mpi.h, most the OpenMPI distribution I've found so far insist on detecting a C++ compiler, thus including the legacy C++ headers, which in turn brings in some (unused) C++ MPI symbols.

And I think OpenMPI is the most widespread MPI implementation.

I'm planing to explicitly prohibit that by default (#73) but untill then... (I'll try to do it this we at least on develop).

I have no experience with boostorg/boost_install yet.

@pdimov
Copy link
Member

pdimov commented Oct 25, 2019

I'll transfer this issue to boost_install.

@pdimov pdimov transferred this issue from boostorg/mpi Oct 25, 2019
@pdimov
Copy link
Member

pdimov commented Oct 25, 2019

As far as I can see, what's needed is 63c74f6.

It's not possible to use PUBLIC for an imported library, only INTERFACE linking is allowed, but I hope CMake does the right thing with those.

I don't have a way to test that at present; it's on the feature/add-mpi-dependency branch. I'll merge it to develop upon confirmation that it works.

@sdebionne
Copy link
Author

I had a look at Boost.Iostreams that also have dependencies to third party libraries (zlib, bzip2) and it looks like it might have the same issue. I have open an issue #18 (in parallel to your issue transfer).

It's not possible to use PUBLIC for an imported library, only INTERFACE linking is allowed, but I hope CMake does the right thing with those.

I think it does the right thing.

@pdimov
Copy link
Member

pdimov commented Oct 25, 2019

Looking at the documentation of FindMPI,

  • shouldn't the correct target be MPI::MPI_CXX?
  • seems that targets are only available in CMake 3.10, not sure whether we need to care about that though.

@pdimov
Copy link
Member

pdimov commented Oct 25, 2019

Yes, find_dependency(MPI) finds just MPI_CXX for me by default, and does not declare MPI::MPI_C.

@pdimov
Copy link
Member

pdimov commented Oct 26, 2019

Almost done; the MPI tests just fail because of boostorg/mpi@8619d7b#commitcomment-35672247.

@pdimov
Copy link
Member

pdimov commented Oct 27, 2019

Merged to develop.

@sdebionne
Copy link
Author

@pdimov Thank you very much! I'll try to find some time to contribute a test.

@pdimov
Copy link
Member

pdimov commented Oct 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants