From 70e35d0bccbfca21d2ede8731b748dae3f0c60ef Mon Sep 17 00:00:00 2001 From: proller Date: Fri, 29 Dec 2017 18:48:20 +0300 Subject: [PATCH] Build fixes (#1718) * Embedded compiler fixes * common lib not needed for clang and lld * Fix pthread link * Fix shared build * Arm fixes 1 * arm fix * Unused fix * Build fixes * release --pbuilder * release pbuilder fix * FORCE_PBUILDER_CREATE=1 release * release: Auto use clang with sanitizers * Fix build without poco data odbc lib. zlib arm build fix. * Fix freebsd build and build without mysql * Tests: Dont eat my cpu! * Test me --- cmake/find_zlib.cmake | 4 ++++ dbms/src/Interpreters/CMakeLists.txt | 4 ++-- dbms/src/Interpreters/config_compile.h.in | 3 +++ dbms/src/Storages/StorageMySQL.cpp | 3 +++ dbms/src/Storages/StorageMySQL.h | 5 +++++ dbms/src/TableFunctions/CMakeLists.txt | 4 ++++ dbms/src/TableFunctions/TableFunctionODBC.cpp | 6 +++++- dbms/src/TableFunctions/TableFunctionODBC.h | 5 +++++ dbms/src/TableFunctions/registerTableFunctions.cpp | 5 +++++ libs/libcommon/include/common/exp10.h | 5 +++++ 10 files changed, 41 insertions(+), 3 deletions(-) diff --git a/cmake/find_zlib.cmake b/cmake/find_zlib.cmake index c5ebb625564..806ab5d0b30 100644 --- a/cmake/find_zlib.cmake +++ b/cmake/find_zlib.cmake @@ -11,6 +11,10 @@ if (NOT ZLIB_FOUND) if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_I386) set (WITH_OPTIM 0 CACHE INTERNAL "") # Bug in assembler endif () + if (ARCH_AARCH64) + set(WITH_NEON 1 CACHE INTERNAL "") + set(WITH_ACLE 1 CACHE INTERNAL "") + endif () set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/zlib-ng" "${ClickHouse_BINARY_DIR}/contrib/zlib-ng") # generated zconf.h set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) # for poco set (ZLIB_FOUND 1) # for poco diff --git a/dbms/src/Interpreters/CMakeLists.txt b/dbms/src/Interpreters/CMakeLists.txt index ef1d3bca108..8b9d118b120 100644 --- a/dbms/src/Interpreters/CMakeLists.txt +++ b/dbms/src/Interpreters/CMakeLists.txt @@ -7,10 +7,10 @@ endif () set (INTERNAL_COMPILER_EXECUTABLE "clickhouse-clang" CACHE STRING "") set (INTERNAL_LINKER_EXECUTABLE "clickhouse-lld" CACHE STRING "") -set (INTERNAL_COMPILER_NO_WARNING OFF CACHE BOOL "") +set (INTERNAL_COMPILER_NO_WARNING OFF CACHE INTERNAL "") set (INTERNAL_COMPILER_HEADERS "${PATH_SHARE}/clickhouse/headers" CACHE STRING "") set (INTERNAL_COMPILER_HEADERS_ROOT "${INTERNAL_COMPILER_HEADERS}" CACHE STRING "") -set (INTERNAL_COMPILER_CUSTOM_ROOT ON CACHE BOOL "") +set (INTERNAL_COMPILER_CUSTOM_ROOT ON CACHE INTERNAL "") set (INTERNAL_COMPILER_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${CXX_FLAGS_INTERNAL_COMPILER} -x c++ -march=native -fPIC -fvisibility=hidden -fno-implement-inlines -nostdinc -nostdinc++ -Wno-unused-command-line-argument -Bprefix=${PATH_SHARE}/clickhouse -isysroot=${INTERNAL_COMPILER_HEADERS_ROOT}" CACHE STRING "") string(REPLACE "-no-pie" "" INTERNAL_COMPILER_FLAGS ${INTERNAL_COMPILER_FLAGS}) diff --git a/dbms/src/Interpreters/config_compile.h.in b/dbms/src/Interpreters/config_compile.h.in index a3e87799571..19f91fd3449 100644 --- a/dbms/src/Interpreters/config_compile.h.in +++ b/dbms/src/Interpreters/config_compile.h.in @@ -1,6 +1,9 @@ #pragma once #cmakedefine CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_LIBRARY_ARCHITECTURE@" +#if !defined(CMAKE_LIBRARY_ARCHITECTURE) +#define CMAKE_LIBRARY_ARCHITECTURE "" +#endif #cmakedefine PATH_SHARE "@PATH_SHARE@" #cmakedefine INTERNAL_COMPILER_FLAGS "@INTERNAL_COMPILER_FLAGS@" #cmakedefine INTERNAL_COMPILER_EXECUTABLE "@INTERNAL_COMPILER_EXECUTABLE@" diff --git a/dbms/src/Storages/StorageMySQL.cpp b/dbms/src/Storages/StorageMySQL.cpp index 8b3b8491fd5..eafefdca879 100644 --- a/dbms/src/Storages/StorageMySQL.cpp +++ b/dbms/src/Storages/StorageMySQL.cpp @@ -1,4 +1,5 @@ #include +#if USE_MYSQL #include #include @@ -44,3 +45,5 @@ BlockInputStreams StorageMySQL::read( } } + +#endif diff --git a/dbms/src/Storages/StorageMySQL.h b/dbms/src/Storages/StorageMySQL.h index 5384f150163..29d0d35e69d 100644 --- a/dbms/src/Storages/StorageMySQL.h +++ b/dbms/src/Storages/StorageMySQL.h @@ -1,5 +1,8 @@ #pragma once +#include +#if USE_MYSQL + #include #include @@ -46,3 +49,5 @@ private: }; } + +#endif diff --git a/dbms/src/TableFunctions/CMakeLists.txt b/dbms/src/TableFunctions/CMakeLists.txt index d9a666c8fc1..ada1b81858e 100644 --- a/dbms/src/TableFunctions/CMakeLists.txt +++ b/dbms/src/TableFunctions/CMakeLists.txt @@ -6,5 +6,9 @@ list(REMOVE_ITEM clickhouse_table_functions_headers ITableFunction.h TableFuncti add_library(clickhouse_table_functions ${clickhouse_table_functions_sources}) target_link_libraries(clickhouse_table_functions dbms clickhouse_storages_system ${Poco_Foundation_LIBRARY}) +if (Poco_DataODBC_FOUND) + target_link_libraries (clickhouse_table_functions ${Poco_DataODBC_LIBRARY}) +endif () + target_include_directories (clickhouse_table_functions BEFORE PRIVATE ${SPARCEHASH_INCLUDE_DIR}) diff --git a/dbms/src/TableFunctions/TableFunctionODBC.cpp b/dbms/src/TableFunctions/TableFunctionODBC.cpp index 960e9405c84..591e7f8af8b 100644 --- a/dbms/src/TableFunctions/TableFunctionODBC.cpp +++ b/dbms/src/TableFunctions/TableFunctionODBC.cpp @@ -1,3 +1,6 @@ +#include + +#if Poco_DataODBC_FOUND #include #include @@ -8,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -122,3 +124,5 @@ void registerTableFunctionODBC(TableFunctionFactory & factory) factory.registerFunction(); } } + +#endif diff --git a/dbms/src/TableFunctions/TableFunctionODBC.h b/dbms/src/TableFunctions/TableFunctionODBC.h index bdb5939ef6f..90389eb0d96 100644 --- a/dbms/src/TableFunctions/TableFunctionODBC.h +++ b/dbms/src/TableFunctions/TableFunctionODBC.h @@ -1,5 +1,8 @@ #pragma once +#include +#if Poco_DataODBC_FOUND + #include @@ -20,3 +23,5 @@ public: StoragePtr execute(const ASTPtr & ast_function, const Context & context) const override; }; } + +#endif diff --git a/dbms/src/TableFunctions/registerTableFunctions.cpp b/dbms/src/TableFunctions/registerTableFunctions.cpp index 9054872e92d..af069a5fcf6 100644 --- a/dbms/src/TableFunctions/registerTableFunctions.cpp +++ b/dbms/src/TableFunctions/registerTableFunctions.cpp @@ -11,7 +11,9 @@ void registerTableFunctionRemote(TableFunctionFactory & factory); void registerTableFunctionShardByHash(TableFunctionFactory & factory); void registerTableFunctionNumbers(TableFunctionFactory & factory); void registerTableFunctionCatBoostPool(TableFunctionFactory & factory); +#if Poco_DataODBC_FOUND void registerTableFunctionODBC(TableFunctionFactory & factory); +#endif #if USE_MYSQL void registerTableFunctionMySQL(TableFunctionFactory & factory); @@ -27,7 +29,10 @@ void registerTableFunctions() registerTableFunctionShardByHash(factory); registerTableFunctionNumbers(factory); registerTableFunctionCatBoostPool(factory); + +#if Poco_DataODBC_FOUND registerTableFunctionODBC(factory); +#endif #if USE_MYSQL registerTableFunctionMySQL(factory); diff --git a/libs/libcommon/include/common/exp10.h b/libs/libcommon/include/common/exp10.h index 5e5f47db3f0..9ed3c4765eb 100644 --- a/libs/libcommon/include/common/exp10.h +++ b/libs/libcommon/include/common/exp10.h @@ -8,6 +8,11 @@ #include /// for __THROW +// freebsd have no __THROW +#if !defined(__THROW) +#define __THROW +#endif + extern "C" {