From 1a031b302a35d69ff1aaf69e8a4ba7e190b23580 Mon Sep 17 00:00:00 2001 From: Trent Lo Date: Thu, 12 Aug 2021 11:31:41 -0700 Subject: [PATCH] Do not link _pywrap_tensorflow_internal.so if XLA is not enabled. Signed-off-by: Trent Lo --- cmake/Modules/FindTensorflow.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/FindTensorflow.cmake b/cmake/Modules/FindTensorflow.cmake index 785e5bfcb2..a766fd92b7 100644 --- a/cmake/Modules/FindTensorflow.cmake +++ b/cmake/Modules/FindTensorflow.cmake @@ -21,8 +21,10 @@ if (LEN EQUAL "4") list(GET Tensorflow_OUTPUT 2 Tensorflow_LIBRARIES) string(REPLACE " " ";" Tensorflow_LIBRARIES_LIST "${Tensorflow_LIBRARIES}") list(GET Tensorflow_LIBRARIES_LIST 0 Tensorflow_LIB_PATH) - # XLA implementations are in _pywrap_tensorflow_internal.so - set(Tensorflow_LIBRARIES "${Tensorflow_LIBRARIES} ${Tensorflow_LIB_PATH}/python/ -l:_pywrap_tensorflow_internal.so") + if (Tensorflow_VERSION VERSION_GREATER_EQUAL "2.6") + # XLA implementations are in _pywrap_tensorflow_internal.so + set(Tensorflow_LIBRARIES "${Tensorflow_LIBRARIES} ${Tensorflow_LIB_PATH}/python/ -l:_pywrap_tensorflow_internal.so") + endif() message("Tensorflow_LIBRARIES := ${Tensorflow_LIBRARIES}") list(GET Tensorflow_OUTPUT 3 Tensorflow_COMPILE_FLAGS) if("${Tensorflow_COMPILE_FLAGS}" MATCHES "-D_GLIBCXX_USE_CXX11_ABI=1")