From 38e17621f6ddd5e768c255abaa36d7b2c0a8e429 Mon Sep 17 00:00:00 2001 From: Superjomn Date: Sun, 8 Jul 2018 13:24:53 +0000 Subject: [PATCH] update --- paddle/contrib/inference/CMakeLists.txt | 9 +++++++-- paddle/contrib/inference/paddle_inference_api.cc | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/paddle/contrib/inference/CMakeLists.txt b/paddle/contrib/inference/CMakeLists.txt index a8bbb4eb808..c30eff50107 100644 --- a/paddle/contrib/inference/CMakeLists.txt +++ b/paddle/contrib/inference/CMakeLists.txt @@ -46,9 +46,14 @@ cc_library(paddle_inference_api SRCS paddle_inference_api.cc paddle_inference_api_impl.cc DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB}) +# Here the shared library doesn't depend on other fluid libraries, or double free will occur. cc_library(paddle_inference_api_shared SHARED - SRCS paddle_inference_api.cc paddle_inference_api_impl.cc - DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB}) + SRCS paddle_inference_api.cc paddle_inference_api_impl.cc) +set_target_properties(paddle_inference_api_shared PROPERTIES OUTPUT_NAME paddle_inference_api) +if(NOT APPLE) + set(LINK_FLAGS "-fPIC -fvisibility=hidden") + set_target_properties(paddle_inference_api_shared PROPERTIES LINK_FLAGS "${LINK_FLAGS}") +endif() cc_test(test_paddle_inference_api SRCS test_paddle_inference_api.cc diff --git a/paddle/contrib/inference/paddle_inference_api.cc b/paddle/contrib/inference/paddle_inference_api.cc index ea46b3006f8..4fe198ad7d4 100644 --- a/paddle/contrib/inference/paddle_inference_api.cc +++ b/paddle/contrib/inference/paddle_inference_api.cc @@ -23,7 +23,6 @@ int PaddleDtypeSize(PaddleDType dtype) { case PaddleDType::INT64: return sizeof(int64_t); default: - // assert(false); return -1; } -- GitLab