diff --git a/mindspore/ccsrc/CMakeLists.txt b/mindspore/ccsrc/CMakeLists.txt index b55a885729c..68641e26a0b 100644 --- a/mindspore/ccsrc/CMakeLists.txt +++ b/mindspore/ccsrc/CMakeLists.txt @@ -322,15 +322,15 @@ else () target_link_libraries(mindspore ibverbs rdmacm) endif() endif() + target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore proto_input -Wl,--no-whole-archive) + target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module) + target_link_libraries(_c_expression PRIVATE mindspore_gvar) if (ENABLE_D) target_link_libraries(_c_expression PRIVATE -Wl,--no-as-needed ms_profile) endif () if (ENABLE_ACL) - target_link_libraries(_c_expression PRIVATE graph) + target_link_libraries(_c_expression PRIVATE -Wl,--no-as-needed graph) endif () - target_link_libraries(_c_expression PRIVATE -Wl,--whole-archive mindspore proto_input -Wl,--no-whole-archive) - target_link_libraries(_c_expression PRIVATE mindspore::pybind11_module) - target_link_libraries(_c_expression PRIVATE mindspore_gvar) endif () if (USE_GLOG) diff --git a/mindspore/ccsrc/cxx_api/CMakeLists.txt b/mindspore/ccsrc/cxx_api/CMakeLists.txt index cd59cdd7166..50f30c79fef 100644 --- a/mindspore/ccsrc/cxx_api/CMakeLists.txt +++ b/mindspore/ccsrc/cxx_api/CMakeLists.txt @@ -85,9 +85,9 @@ if (ENABLE_ACL) find_library(libaicpu_engine_common libaicpu_engine_common.so ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64) find_library(atc_protobuf libascend_protobuf.so.3.8.0.0 ${ATC_DIR}/lib64 ${ATLAS_ATC_DIR}/lib64) - target_link_libraries(mindspore_shared_lib PRIVATE graph ${ge_compiler} ${atc_protobuf} ${acl_retr} ${acl_cblas} - ${acl_dvpp} ${acl_runtime} ${libplatform} ${libcompress} ${libopskernel} ${libaicore_utils} - ${libaicpu_engine_common} ${acl}) + target_link_libraries(mindspore_shared_lib PRIVATE -Wl,--no-as-needed graph ${ge_compiler} ${atc_protobuf} + ${acl_retr} ${acl_cblas} ${acl_dvpp} ${acl_runtime} ${libplatform} ${libcompress} ${libopskernel} + ${libaicore_utils} ${libaicpu_engine_common} ${acl}) add_dependencies(mindspore_shared_lib graph) endif ()