From 01bbf650f88582befd4aef7908fb7624516be101 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Mon, 7 May 2018 11:59:24 +0300 Subject: [PATCH] Build fixes #2277 --- cmake/find_llvm.cmake | 9 +++++++-- dbms/src/Common/config.h.in | 1 + dbms/src/Interpreters/ExpressionJIT.cpp | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cmake/find_llvm.cmake b/cmake/find_llvm.cmake index 21ee7f28e4a..b4d64ce5aab 100644 --- a/cmake/find_llvm.cmake +++ b/cmake/find_llvm.cmake @@ -1,10 +1,12 @@ option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile' option for query execution" 1) if (ENABLE_EMBEDDED_COMPILER) + set (LLVM_PATHS "/usr/local/lib/llvm") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - find_package(LLVM CONFIG) + find_package(LLVM CONFIG PATHS ${LLVM_PATHS}) else () - find_package(LLVM 5 CONFIG) + find_package(LLVM 5 CONFIG PATHS ${LLVM_PATHS}) endif () if (LLVM_FOUND) @@ -16,6 +18,9 @@ if (ENABLE_EMBEDDED_COMPILER) message(STATUS "LLVM Include Directory: ${LLVM_INCLUDE_DIRS}") message(STATUS "LLVM Library Directory: ${LLVM_LIBRARY_DIRS}") message(STATUS "LLVM C++ Compiler: ${LLVM_CXXFLAGS}") + + option(LLVM_HAS_RTTI "Enable if LLVM was build with RTTI enabled" ON) + set (USE_EMBEDDED_COMPILER 1) endif() endif() diff --git a/dbms/src/Common/config.h.in b/dbms/src/Common/config.h.in index 2531d9ced70..f4d155de2c8 100644 --- a/dbms/src/Common/config.h.in +++ b/dbms/src/Common/config.h.in @@ -9,6 +9,7 @@ #cmakedefine01 USE_RDKAFKA #cmakedefine01 USE_CAPNP #cmakedefine01 USE_EMBEDDED_COMPILER +#cmakedefine01 LLVM_HAS_RTTI #cmakedefine01 Poco_SQLODBC_FOUND #cmakedefine01 Poco_DataODBC_FOUND #cmakedefine01 Poco_MongoDB_FOUND diff --git a/dbms/src/Interpreters/ExpressionJIT.cpp b/dbms/src/Interpreters/ExpressionJIT.cpp index 86b1d16d4c8..3abc9b34167 100644 --- a/dbms/src/Interpreters/ExpressionJIT.cpp +++ b/dbms/src/Interpreters/ExpressionJIT.cpp @@ -42,6 +42,8 @@ #pragma GCC diagnostic pop +#if !LLVM_HAS_RTTI + /** HACK * Allow to link with LLVM that was compiled without RTTI. * This is the default option when you build LLVM from sources. @@ -58,6 +60,8 @@ __attribute__((__weak__)) int _ZTIN4llvm12MemoryBufferE = 0; } +#endif + namespace ProfileEvents {