From a7993843f9d9d75f01b20b29f5b45077b6cf70ba Mon Sep 17 00:00:00 2001 From: zerobot Date: Wed, 28 Aug 2019 08:31:00 -0700 Subject: [PATCH] clients:CMake:Hide symbols that are not TRTIS API (#589) * clients:CMake:Hide symbols that are not TRTIS API gRPC symbols were visible and caused crash on client application which is using different version of gRPC Signed-off-by: Wenjia Zhou * clients:cmake: address comments fix style --- src/clients/c++/CMakeLists.txt | 10 +++++++++ src/clients/c++/librequest.ldscript | 32 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 src/clients/c++/librequest.ldscript diff --git a/src/clients/c++/CMakeLists.txt b/src/clients/c++/CMakeLists.txt index 1631d47d89..3ae00c2587 100644 --- a/src/clients/c++/CMakeLists.txt +++ b/src/clients/c++/CMakeLists.txt @@ -31,6 +31,8 @@ cmake_minimum_required (VERSION 3.5) # find_package(CURL REQUIRED) +configure_file(librequest.ldscript librequest.ldscript COPYONLY) + add_library( request SHARED request.cc request.h @@ -40,6 +42,14 @@ add_library( $ $ ) +set_target_properties( + request + PROPERTIES LINK_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/librequest.ldscript +) +set_target_properties( + request + PROPERTIES LINK_FLAGS "-Wl,--version-script=librequest.ldscript" +) target_link_libraries( request diff --git a/src/clients/c++/librequest.ldscript b/src/clients/c++/librequest.ldscript new file mode 100644 index 0000000000..137d5a32e1 --- /dev/null +++ b/src/clients/c++/librequest.ldscript @@ -0,0 +1,32 @@ +# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of NVIDIA CORPORATION nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +{ + global: + extern "C++" { + nvidia::inferenceserver* + }; + local: *; +};