Skip to content

Commit ff642c6

Browse files
chenwhqlengineer1109wanghuancoder
authored
[Cherry-pick] Fix python link error (#47811)
* Fix Python Link Order Error (#46259) * fix cc_library link python lib (#47605) * fix cc_library link python lib Co-authored-by: engineer <[email protected]> Co-authored-by: wanghuancoder <[email protected]>
1 parent 76b883c commit ff642c6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

paddle/fluid/pybind/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,10 @@ if(WITH_PYTHON)
262262
list(APPEND OP_FUNCTION_GENERETOR_DEPS cncl_context)
263263
endif()
264264

265+
if(NOT ((NOT WITH_PYTHON) AND ON_INFER))
266+
list(APPEND OP_FUNCTION_GENERETOR_DEPS ${PYTHON_LIBRARIES})
267+
endif()
268+
265269
add_executable(op_function_generator op_function_generator.cc)
266270
target_link_libraries(op_function_generator ${OP_FUNCTION_GENERETOR_DEPS})
267271
add_executable(eager_legacy_op_function_generator
@@ -601,4 +605,6 @@ if(WITH_PYTHON)
601605
get_property(os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES)
602606
target_link_libraries(${SHARD_LIB_NAME} ${os_dependency_modules})
603607
add_dependencies(${SHARD_LIB_NAME} op_function_generator_cmd)
608+
609+
target_link_libraries(${SHARD_LIB_NAME} ${PYTHON_LIBRARIES})
604610
endif()

0 commit comments

Comments
 (0)