Install grpc lib to rdc folder

Install the grpc lib to rdc/grpc/lib and add miss libraries.

Add “--no-as-needed” and all extra grpc libraries in rdci/rdcd as
RUNPATH will only search direct dependencies.

Change-Id: I596acb2eb3a7228d703e79db64699bc20d0e7c09
This commit is contained in:
Bill(Shuzhou) Liu
2021-01-21 14:23:30 -05:00
parent 51efe26442
commit 07d4d5376e
4 changed files with 55 additions and 19 deletions
+14 -7
View File
@@ -89,17 +89,24 @@ link_directories(${RSMI_LIB_DIR} "${GRPC_ROOT}/lib" "${GRPC_ROOT}/lib64")
## Set RUNPATH if ROCM_RPATH is defined and passed by the environment
## RUNPATH should help to run "rdcd" without the usage of ldconfig
if (DEFINED ENV{ROCM_RPATH})
set (GRPC_RUNPATH "\$ORIGIN/../../grpc/lib:\$ORIGIN/../../grpc/lib64")
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags")
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${GRPC_RUNPATH}")
set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set (CMAKE_SKIP_BUILD_RPATH TRUE)
endif ()
set (GRPC_RUNPATH "\$ORIGIN/../lib:\$ORIGIN/../grpc/lib:\$ORIGIN/../grpc/lib64")
set (CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags -Wl,--no-as-needed -Wl,-z,origin")
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}:${GRPC_RUNPATH}")
set (CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set (CMAKE_SKIP_BUILD_RPATH TRUE)
# Run path can only include direct refer library, here is 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)
endif()
add_executable(${SERVER_DAEMON_EXE} "${SERVER_SRC_LIST}")
# target_include_directories(${SERVER_DAEMON_EXE} PUBLIC ${RSMI_INC_DIR})
target_link_libraries(${SERVER_DAEMON_EXE} pthread rt grpc grpc++
target_link_libraries(${SERVER_DAEMON_EXE} ${RDCD_EXTRA_LIB} pthread rt grpc grpc++
cap grpc++_reflection dl protobuf rocm_smi64 rdc_bootstrap)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${SERVER_DAEMON_EXE}