From 060f11df25fec4943c1b02e12969559445517660 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 27 Dec 2022 12:43:58 +0100 Subject: [PATCH] fix the link issue on grpc --- debian/patches/link-grpc.diff | 49 +++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 50 insertions(+) create mode 100644 debian/patches/link-grpc.diff diff --git a/debian/patches/link-grpc.diff b/debian/patches/link-grpc.diff new file mode 100644 index 00000000..382f4d57 --- /dev/null +++ b/debian/patches/link-grpc.diff @@ -0,0 +1,49 @@ +Index: llvm-toolchain-snapshot_16~++20221227120055+36d70a6aea6b/cmake/Modules/FindGRPC.cmake +=================================================================== +--- llvm-toolchain-snapshot_16~++20221227120055+36d70a6aea6b.orig/cmake/Modules/FindGRPC.cmake ++++ llvm-toolchain-snapshot_16~++20221227120055+36d70a6aea6b/cmake/Modules/FindGRPC.cmake +@@ -82,11 +82,30 @@ else() + endif() + endif() + if(NOT TARGET grpc++) +- find_library(GRPC_LIBRARY grpc++ ${GRPC_OPTS} REQUIRED) ++ find_library(GRPCPP_LIBRARY grpc++ ${GRPC_OPTS} REQUIRED) + add_library(grpc++ UNKNOWN IMPORTED GLOBAL) +- message(STATUS "Using grpc++: " ${GRPC_LIBRARY}) +- set_target_properties(grpc++ PROPERTIES IMPORTED_LOCATION ${GRPC_LIBRARY}) ++ message(STATUS "Using grpc++: " ${GRPCPP_LIBRARY}) ++ set_target_properties(grpc++ PROPERTIES IMPORTED_LOCATION ${GRPCPP_LIBRARY}) + target_include_directories(grpc++ INTERFACE ${GRPC_INCLUDE_PATHS}) ++ ++ # On some distro (ex: Debian/Ubuntu), libgrpc++ doesn't have direct references ++ # to it dependencies. Needs to link against gpr, grpc and absl_synchronization ++ find_library(GPR_LIBRARY gpr ${GRPC_OPTS} REQUIRED) ++ add_library(gpr UNKNOWN IMPORTED GLOBAL) ++ message(STATUS "Using gpr: " ${GPR_LIBRARY}) ++ set_target_properties(gpr PROPERTIES IMPORTED_LOCATION ${GPR_LIBRARY}) ++ ++ find_library(GRPC_LIBRARY grpc ${GRPC_OPTS} REQUIRED) ++ add_library(grpc UNKNOWN IMPORTED GLOBAL) ++ message(STATUS "Using grpc: " ${GRPC_LIBRARY}) ++ set_target_properties(grpc PROPERTIES IMPORTED_LOCATION ${GRPC_LIBRARY}) ++ ++ find_library(ABSL_SYNCHRONIZATION_LIBRARY absl_synchronization ${GRPC_OPTS} REQUIRED) ++ add_library(absl_synchronization UNKNOWN IMPORTED GLOBAL) ++ message(STATUS "Using absl_synchronization: " ${ABSL_SYNCHRONIZATION}) ++ set_target_properties(absl_synchronization PROPERTIES IMPORTED_LOCATION ${ABSL_SYNCHRONIZATION_LIBRARY}) ++ ++ + if (ENABLE_GRPC_REFLECTION) + find_library(GRPC_REFLECTION_LIBRARY grpc++_reflection ${GRPC_OPTS} REQUIRED) + add_library(grpc++_reflection UNKNOWN IMPORTED GLOBAL) +Index: llvm-toolchain-snapshot_16~++20221227120055+36d70a6aea6b/clang/cmake/modules/AddGRPC.cmake +=================================================================== +--- llvm-toolchain-snapshot_16~++20221227120055+36d70a6aea6b.orig/clang/cmake/modules/AddGRPC.cmake ++++ llvm-toolchain-snapshot_16~++20221227120055+36d70a6aea6b/clang/cmake/modules/AddGRPC.cmake +@@ -7,5 +7,5 @@ function(generate_clang_protos_library L + + add_clang_library(${LibraryName} ${ProtoSource} + PARTIAL_SOURCES_INTENDED +- LINK_LIBS PUBLIC grpc++ protobuf) ++ LINK_LIBS PUBLIC grpc++ protobuf gpr grpc absl_synchronization) + endfunction() diff --git a/debian/patches/series b/debian/patches/series index 2771fe7a..875a634e 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -146,3 +146,4 @@ revert-update-doc.diff unwind-force-pthread-dl.diff force-sse2-compiler-rt.diff bolt-disable-emit-relocs.patch +link-grpc.diff