Skip to content

Commit

Permalink
GCC>5 issue (Undefined symbol) - Update CMake file
Browse files Browse the repository at this point in the history
Fix issue due to GCC > 5. 
Add a specific flag if GCC is greater than 5.0.
  • Loading branch information
Julien Guillaumin authored Jul 3, 2017
1 parent 8b4f90e commit 39ab564
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ execute_process(COMMAND python3 -c "import tensorflow; print(tensorflow.sysconfi
# C++11 required for tensorflow
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")

# if GCC > 5
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.0)
set(CMAKE_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=0 ${CMAKE_CXX_FLAGS}")
endif()

# build the actual operation which can be used directory
include_directories(${Tensorflow_INCLUDE_DIRS})
add_library(inner_product SHARED inner_product.cc)

# build the gradient operation which is used in inner_product_grad.py
# to register it
include_directories(${Tensorflow_INCLUDE_DIRS})
add_library(inner_product_grad SHARED inner_product_grad.cc)
add_library(inner_product_grad SHARED inner_product_grad.cc)

0 comments on commit 39ab564

Please sign in to comment.