Skip to content

Commit

Permalink
Fix ABI compability when linking against OCCI when using clang. (#460)
Browse files Browse the repository at this point in the history
This patch improves the previous check whether the current compiler
is using an incompatible libstdc++ version or not.
  • Loading branch information
Teemperor authored and vgvassilev committed Mar 28, 2017
1 parent 4dcb8c2 commit 07d6afd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cmake/modules/CheckCompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ if(gnuinstall)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DR__HAVE_CONFIG")
endif()

#---Check if we use the new libstdc++ CXX11 ABI-----------------------------------------------------
# Necessary to compile check_cxx_source_compiles this early
include(CheckCXXSourceCompiles)
check_cxx_source_compiles(
"
#include <string>
#if _GLIBCXX_USE_CXX11_ABI == 0
#error NOCXX11
#endif
int main() {}
" GLIBCXX_USE_CXX11_ABI)

#---Print the final compiler flags--------------------------------------------------------------------
message(STATUS "ROOT Platform: ${ROOT_PLATFORM}")
message(STATUS "ROOT Architecture: ${ROOT_ARCHITECTURE}")
Expand Down
6 changes: 5 additions & 1 deletion sql/oracle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ add_definitions(${ORACLE_DEFINITIONS})
ROOT_GENERATE_DICTIONARY(G__Oracle *.h MODULE Oracle LINKDEF LinkDef.h)

ROOT_LINKER_LIBRARY(Oracle *.cxx G__Oracle.cxx LIBRARIES Core ${ORACLE_LIBRARIES} DEPENDENCIES Net RIO)
if(GCC_MAJOR GREATER 4)

# Check if libstdc++ uses the new string ABI and fall back to the old one if yes.
# We have to check for this because on the nightly builds we have an old occi
# installation that uses the old ABI, which results in linking errors.
if(${GLIBCXX_USE_CXX11_ABI})
file(GLOB srcs src/TOracle*.cxx)
set_source_files_properties(${srcs} PROPERTIES COMPILE_DEFINITIONS _GLIBCXX_USE_CXX11_ABI=0)
endif()
Expand Down

0 comments on commit 07d6afd

Please sign in to comment.