From f085a57d1a29544faf358de9d76141fb6eabf978 Mon Sep 17 00:00:00 2001 From: Evan Miller Date: Sun, 9 Jul 2023 15:31:53 -0400 Subject: [PATCH] [mpi] Link MPI C++ libraries to fix OpenMPI --- CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d992c394..cf6cd34f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -321,6 +321,11 @@ if (LLAMA_MPI) set(c_flags ${c_flags} -Wno-cast-qual) set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${MPI_C_LIBRARIES}) set(LLAMA_EXTRA_INCLUDES ${LLAMA_EXTRA_INCLUDES} ${MPI_C_INCLUDE_DIRS}) + # Even if you're only using the C header, C++ programs may bring in MPI + # C++ functions, so more linkage is needed + if (MPI_CXX_FOUND) + set(LLAMA_EXTRA_LIBS ${LLAMA_EXTRA_LIBS} ${MPI_CXX_LIBRARIES}) + endif() else() message(WARNING "MPI not found") endif()