From ba9633b74bfd6774e7f0d26b975fafdc0fe23aa0 Mon Sep 17 00:00:00 2001 From: Ranjith Ramakrishnan Date: Fri, 5 Aug 2022 13:59:20 -0700 Subject: [PATCH] Use function to find all libraries with absl prefix rather than hard coding the library names Some absl libraries are missing in the list and results in error while loading rdci binary Use cmake logic to find all the absl libraries required instead of hard coding them. Similar implemenation was done in rdc server side Change-Id: Ia04bcd137f892c2577a4a458b92ca212d42aef80 --- rdci/CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/rdci/CMakeLists.txt b/rdci/CMakeLists.txt index 2af6705731..ec4a8f18d4 100644 --- a/rdci/CMakeLists.txt +++ b/rdci/CMakeLists.txt @@ -99,13 +99,19 @@ if (DEFINED ENV{ROCM_RPATH}) set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_SKIP_RPATH TRUE) - # Run path can only include direct refer library, here is the indirect libs + # Run path can only include direct refer library, include the indirect libs # required by gRPC - set (RDCD_EXTRA_LIB absl_str_format_internal absl_strings absl_throw_delegate - absl_bad_optional_access absl_strings absl_throw_delegate absl_int128 - absl_strings_internal absl_raw_logging_internal address_sorting - gpr upb ssl crypto ) - + # Get all absl library and re2 + file(GLOB grpc_libs "${GRPC_ROOT}/lib*/lib*.so") + foreach(src_file ${grpc_libs}) + get_filename_component(lib_name "${src_file}" NAME_WLE) + STRING(REGEX REPLACE "^lib" "" lib_name ${lib_name}) # strip out lib + if(lib_name MATCHES "absl.*" OR lib_name STREQUAL "re2") + set(RDCD_EXTRA_LIB ${RDCD_EXTRA_LIB} ${lib_name}) + endif() + endforeach() + # Set other library + set(RDCD_EXTRA_LIB ${RDCD_EXTRA_LIB} address_sorting gpr upb ssl crypto) endif() target_link_libraries(${RDCI_EXE} ${RDCD_EXTRA_LIB} pthread dl rdc_bootstrap)