Skip to content

[openmpi] find_package(MPI) doesn't work correctly for debug configuration #18151

@dg0yt

Description

@dg0yt

Describe the bug

When trying to enable netcdf-c utilities with parallel hdf5 (work in progress), the following warning is issued to stderr:

CMake Warning at /home/dg0yt/Projekte/vcpkg/vcpkg/scripts/buildsystems/vcpkg.cmake:664 (_add_executable):
  Cannot generate a safe runtime search path for target ncgen because there
  is a cycle in the constraint graph:

    dir 0 is [/home/dg0yt/Projekte/vcpkg/vcpkg/installed/x64-linux/debug/lib]
      dir 1 must precede it due to runtime library [libmpi.so.40]
    dir 1 is [/home/dg0yt/Projekte/vcpkg/vcpkg/installed/x64-linux/lib]
      dir 0 must precede it due to runtime library [libmpi.so.40]

  Some of these libraries may not be found correctly.
Call Stack (most recent call first):
  ncgen/CMakeLists.txt:23 (ADD_EXECUTABLE)

I assume this is caused by the way how MPI is used with CMake. CMake's FindMPI.cmake relies on finding an MPIEXEC_EXECUTABLE via find_program. But even for debug builds, CMAKE_PROGRAM_PATH doesn't guide cmake to look for the tool in tools/openmpi/debug. So the release tools are found and used, leading to the mix release and debug configuration.

Environment

  • OS: Linux

To Reproduce

$ ./vcpkg install hdf5[parallel]
$ cat buildtrees/hdf5/*-dbg/CMakeCache.txt  | grep MPIEXEC_EXECUTABLE:
MPIEXEC_EXECUTABLE:FILEPATH=/home/dg0yt/Projekte/vcpkg/vcpkg/installed/x64-linux/tools/openmpi/bin/mpiexec

Expected behavior

$ ./vcpkg install hdf5[parallel]
$ cat buildtrees/hdf5/*-dbg/CMakeCache.txt  | grep MPIEXEC_EXECUTABLE:
MPIEXEC_EXECUTABLE:FILEPATH=/home/dg0yt/Projekte/vcpkg/vcpkg/installed/x64-linux/tools/openmpi/debug/bin/mpiexec

Additional context

Package installation layout for tools #17607

Metadata

Metadata

Assignees

Labels

category:port-bugThe issue is with a library, which is something the port should already support

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions