aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/cmake/tf_python.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/contrib/cmake/tf_python.cmake')
-rwxr-xr-xtensorflow/contrib/cmake/tf_python.cmake9
1 files changed, 8 insertions, 1 deletions
diff --git a/tensorflow/contrib/cmake/tf_python.cmake b/tensorflow/contrib/cmake/tf_python.cmake
index f6aaf41f73..c4bdb69d82 100755
--- a/tensorflow/contrib/cmake/tf_python.cmake
+++ b/tensorflow/contrib/cmake/tf_python.cmake
@@ -554,12 +554,13 @@ if(WIN32)
set(pywrap_tensorflow_deffile "${CMAKE_CURRENT_BINARY_DIR}/pywrap_tensorflow.def")
endif()
set_source_files_properties(${pywrap_tensorflow_deffile} PROPERTIES GENERATED TRUE)
-
+ math(EXPR tensorflow_target_bitness "${CMAKE_SIZEOF_VOID_P}*8")
add_custom_command(TARGET pywrap_tensorflow_internal_static POST_BUILD
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/create_def_file.py
--input "${pywrap_tensorflow_internal_static_dependencies}"
--output "${pywrap_tensorflow_deffile}"
--target _pywrap_tensorflow_internal.pyd
+ --bitness "${tensorflow_target_bitness}"
BYPRODUCTS ${pywrap_tensorflow_deffile} # Required for Ninja
)
endif(WIN32)
@@ -589,6 +590,12 @@ add_library(pywrap_tensorflow_internal SHARED
${pywrap_tensorflow_deffile}
)
+# There is a bug in GCC 5 resulting in undefined reference to a __cpu_model function when
+# linking to the tensorflow library. Adding the following libraries fixes it.
+if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
+ target_link_libraries(pywrap_tensorflow_internal PRIVATE gcc_s gcc)
+endif()
+
if(WIN32)
add_dependencies(pywrap_tensorflow_internal pywrap_tensorflow_internal_static)
endif(WIN32)