From 594c535bd419d153efe97bd9e93caef4b96cd692 Mon Sep 17 00:00:00 2001 From: proller Date: Sat, 5 Oct 2019 22:25:31 +0300 Subject: [PATCH] Build fixes (#7063) * Build fixes * fix * Fix * fix * Fix install(export.. * Freebsd fixes * Freebsd fixes * Fix warning * fix * More PRIVATE linking * Fix review * Timmy * fix * fix --- CMakeLists.txt | 5 +++- cmake/find/base64.cmake | 2 +- cmake/find/brotli.cmake | 2 +- cmake/find/capnp.cmake | 2 +- cmake/find/fastops.cmake | 26 ++++++++++--------- cmake/find/gperf.cmake | 2 +- cmake/find/h3.cmake | 18 ++++++++++--- cmake/find/hdfs3.cmake | 2 +- cmake/find/hyperscan.cmake | 2 +- cmake/find/icu.cmake | 4 +-- cmake/find/llvm.cmake | 4 +-- cmake/find/odbc.cmake | 5 +++- cmake/find/orc.cmake | 2 +- cmake/find/parquet.cmake | 8 +++--- cmake/find/protobuf.cmake | 6 ++--- cmake/find/rapidjson.cmake | 2 +- cmake/find/rdkafka.cmake | 2 +- cmake/find/readline_edit.cmake | 4 +-- cmake/find/snappy.cmake | 4 +-- cmake/find/ssl.cmake | 4 +-- cmake/find/unwind.cmake | 2 +- cmake/target.cmake | 17 ++++++------ contrib/arrow-cmake/CMakeLists.txt | 6 ++++- contrib/jemalloc-cmake/CMakeLists.txt | 2 +- contrib/libhdfs3-cmake/CMakeLists.txt | 2 +- dbms/CMakeLists.txt | 3 ++- dbms/programs/server/CMakeLists.txt | 2 +- dbms/programs/server/MySQLHandler.cpp | 2 +- dbms/programs/server/MySQLHandler.h | 2 +- dbms/programs/server/MySQLHandlerFactory.cpp | 6 ++--- dbms/programs/server/MySQLHandlerFactory.h | 2 +- dbms/programs/server/Server.cpp | 2 +- dbms/src/Common/Dwarf.cpp | 2 +- dbms/src/Common/Dwarf.h | 2 +- dbms/src/Common/Elf.cpp | 2 +- dbms/src/Common/Elf.h | 2 +- dbms/src/Common/OpenSSLHelpers.cpp | 2 +- dbms/src/Common/OpenSSLHelpers.h | 2 +- dbms/src/Common/StackTrace.cpp | 2 +- dbms/src/Common/SymbolIndex.cpp | 2 +- dbms/src/Common/SymbolIndex.h | 2 +- dbms/src/Common/checkStackSize.cpp | 5 +++- dbms/src/Common/config.h.in | 1 + dbms/src/Common/filesystemHelpers.cpp | 6 ++--- dbms/src/Common/tests/symbol_index.cpp | 2 +- dbms/src/Core/config_core.h.in | 1 - .../MergeSortingBlockInputStream.cpp | 1 + dbms/src/Functions/addressToLine.cpp | 2 +- dbms/src/Functions/addressToSymbol.cpp | 2 +- dbms/src/Interpreters/Aggregator.cpp | 1 + dbms/src/Interpreters/ExpressionJIT.cpp | 4 +-- .../Transforms/MergeSortingTransform.cpp | 4 +-- debian/clickhouse-client.install | 1 - debian/clickhouse-common-static.install | 1 + debian/clickhouse-server-common.install | 2 -- libs/libcommon/cmake/find_jemalloc.cmake | 2 +- libs/libmysqlxx/cmake/find_mysqlclient.cmake | 2 +- utils/build/build_debian_shared.sh | 6 +++++ utils/build/build_minimal.sh | 6 +++++ utils/build/build_no_submodules.sh | 22 ++++++++++++++++ 60 files changed, 150 insertions(+), 93 deletions(-) delete mode 100644 debian/clickhouse-server-common.install create mode 100755 utils/build/build_debian_shared.sh create mode 100755 utils/build/build_minimal.sh create mode 100755 utils/build/build_no_submodules.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index f45908ff066..4f196d1e414 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,6 +205,7 @@ set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILER_FLAGS} -fn set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O3 ${CMAKE_C_FLAGS_ADD}") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3 -ggdb3 -fno-inline ${CMAKE_C_FLAGS_ADD}") +option (ENABLE_LIBRARIES "Enable all libraries (Global default switch)" ON) option (UNBUNDLED "Try find all libraries in system. We recommend to avoid this mode for production builds, because we cannot guarantee exact versions and variants of libraries your system has installed. This mode exists for enthusiastic developers who search for trouble. Also it is useful for maintainers of OS packages." OFF) if (UNBUNDLED) @@ -373,7 +374,9 @@ endif () include (cmake/print_flags.cmake) -install (EXPORT global DESTINATION cmake) +if (TARGET global-group) + install (EXPORT global DESTINATION cmake) +endif () add_subdirectory (contrib EXCLUDE_FROM_ALL) diff --git a/cmake/find/base64.cmake b/cmake/find/base64.cmake index 8e52c8463c8..1128bf0cb6f 100644 --- a/cmake/find/base64.cmake +++ b/cmake/find/base64.cmake @@ -4,7 +4,7 @@ if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/base64/lib/lib.c") endif () if (NOT MISSING_INTERNAL_BASE64_LIBRARY) - option (ENABLE_BASE64 "Enable base64" ON) + option (ENABLE_BASE64 "Enable base64" ${ENABLE_LIBRARIES}) endif () if (ENABLE_BASE64) diff --git a/cmake/find/brotli.cmake b/cmake/find/brotli.cmake index 55350e21eed..5453cf15236 100644 --- a/cmake/find/brotli.cmake +++ b/cmake/find/brotli.cmake @@ -1,4 +1,4 @@ -option (ENABLE_BROTLI "Enable brotli" ON) +option (ENABLE_BROTLI "Enable brotli" ${ENABLE_LIBRARIES}) if (ENABLE_BROTLI) diff --git a/cmake/find/capnp.cmake b/cmake/find/capnp.cmake index d59b8b3a2a9..1ac6241a5f1 100644 --- a/cmake/find/capnp.cmake +++ b/cmake/find/capnp.cmake @@ -1,4 +1,4 @@ -option (ENABLE_CAPNP "Enable Cap'n Proto" ON) +option (ENABLE_CAPNP "Enable Cap'n Proto" ${ENABLE_LIBRARIES}) if (ENABLE_CAPNP) diff --git a/cmake/find/fastops.cmake b/cmake/find/fastops.cmake index 61d1bd9f4e7..1296ba586a0 100644 --- a/cmake/find/fastops.cmake +++ b/cmake/find/fastops.cmake @@ -1,17 +1,19 @@ -if (NOT ARCH_ARM AND NOT OS_FREEBSD) - option (ENABLE_FASTOPS "Enable fast vectorized mathematical functions library by Mikhail Parakhin" ${NOT_UNBUNDLED}) -endif () +if(NOT ARCH_ARM AND NOT OS_FREEBSD AND NOT OS_DARWIN) + option(ENABLE_FASTOPS "Enable fast vectorized mathematical functions library by Mikhail Parakhin" ${ENABLE_LIBRARIES}) +endif() -if (ENABLE_FASTOPS AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(ENABLE_FASTOPS) if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/fastops/fastops/fastops.h") - message(FATAL_ERROR "submodule contrib/fastops is missing. to fix try run: \n git submodule update --init --recursive") - set(USE_FASTOPS 0) + message(WARNING "submodule contrib/fastops is missing. to fix try run: \n git submodule update --init --recursive") + set(MISSING_INTERNAL_FASTOPS_LIBRARY 1) endif() - set (USE_FASTOPS 1) - set (FASTOPS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/fastops/) - set (FASTOPS_LIBRARY fastops) -else () + if(NOT MISSING_INTERNAL_FASTOPS_LIBRARY) + set(USE_FASTOPS 1) + set(FASTOPS_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/fastops/) + set(FASTOPS_LIBRARY fastops) + endif() +else() set(USE_FASTOPS 0) -endif () +endif() -message (STATUS "Using fastops=${USE_FASTOPS}: ${FASTOPS_INCLUDE_DIR} : ${FASTOPS_LIBRARY}") +message(STATUS "Using fastops=${USE_FASTOPS}: ${FASTOPS_INCLUDE_DIR} : ${FASTOPS_LIBRARY}") diff --git a/cmake/find/gperf.cmake b/cmake/find/gperf.cmake index 24fd040ed4b..451f5c21571 100644 --- a/cmake/find/gperf.cmake +++ b/cmake/find/gperf.cmake @@ -1,7 +1,7 @@ # Check if gperf was installed find_program(GPERF gperf) if(GPERF) - option(ENABLE_GPERF "Use gperf function hash generator tool" ON) + option(ENABLE_GPERF "Use gperf function hash generator tool" ${ENABLE_LIBRARIES}) endif() if (ENABLE_GPERF) if(NOT GPERF) diff --git a/cmake/find/h3.cmake b/cmake/find/h3.cmake index 802f5aff05e..6abe1ee657c 100644 --- a/cmake/find/h3.cmake +++ b/cmake/find/h3.cmake @@ -1,19 +1,29 @@ +option (ENABLE_H3 "Enable H3" ${ENABLE_LIBRARIES}) +if (ENABLE_H3) + option (USE_INTERNAL_H3_LIBRARY "Set to FALSE to use system h3 library instead of bundled" ${NOT_UNBUNDLED}) -set (H3_INCLUDE_PATHS /usr/local/include/h3) +if(NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/h3/src/h3lib/include/h3Index.h") + if(USE_INTERNAL_H3_LIBRARY) + message(WARNING "submodule contrib/h3 is missing. to fix try run: \n git submodule update --init --recursive") + endif() + set(MISSING_INTERNAL_H3_LIBRARY 1) + set(USE_INTERNAL_H3_LIBRARY 0) +endif() if (USE_INTERNAL_H3_LIBRARY) set (H3_LIBRARY h3) set (H3_INCLUDE_DIR ${ClickHouse_SOURCE_DIR}/contrib/h3/src/h3lib/include) -else () +elseif (NOT MISSING_INTERNAL_H3_LIBRARY) + set (H3_INCLUDE_PATHS /usr/local/include/h3) find_library (H3_LIBRARY h3) find_path (H3_INCLUDE_DIR NAMES h3api.h PATHS ${H3_INCLUDE_PATHS}) endif () if (H3_LIBRARY AND H3_INCLUDE_DIR) set (USE_H3 1) -else () - set (USE_H3 0) +endif () + endif () message (STATUS "Using h3=${USE_H3}: ${H3_INCLUDE_DIR} : ${H3_LIBRARY}") diff --git a/cmake/find/hdfs3.cmake b/cmake/find/hdfs3.cmake index 9c593d3266a..6a0d01d2245 100644 --- a/cmake/find/hdfs3.cmake +++ b/cmake/find/hdfs3.cmake @@ -1,5 +1,5 @@ if(NOT ARCH_ARM AND NOT OS_FREEBSD AND NOT APPLE AND USE_PROTOBUF) - option(ENABLE_HDFS "Enable HDFS" 1) + option(ENABLE_HDFS "Enable HDFS" ${ENABLE_LIBRARIES}) endif() if(ENABLE_HDFS) diff --git a/cmake/find/hyperscan.cmake b/cmake/find/hyperscan.cmake index a3e0b6bc9bc..039981fce81 100644 --- a/cmake/find/hyperscan.cmake +++ b/cmake/find/hyperscan.cmake @@ -1,5 +1,5 @@ if (HAVE_SSSE3) - option (ENABLE_HYPERSCAN "Enable hyperscan" ON) + option (ENABLE_HYPERSCAN "Enable hyperscan" ${ENABLE_LIBRARIES}) endif () if (ENABLE_HYPERSCAN) diff --git a/cmake/find/icu.cmake b/cmake/find/icu.cmake index 5be862f478a..9062b573514 100644 --- a/cmake/find/icu.cmake +++ b/cmake/find/icu.cmake @@ -1,6 +1,6 @@ -option(ENABLE_ICU "Enable ICU" ON) +option(ENABLE_ICU "Enable ICU" ${ENABLE_LIBRARIES}) -if(ENABLE_ICU AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(ENABLE_ICU) if (APPLE) set(ICU_ROOT "/usr/local/opt/icu4c" CACHE STRING "") endif() diff --git a/cmake/find/llvm.cmake b/cmake/find/llvm.cmake index c668416c0c0..8dfd26ec581 100644 --- a/cmake/find/llvm.cmake +++ b/cmake/find/llvm.cmake @@ -1,7 +1,7 @@ # Broken in macos. TODO: update clang, re-test, enable if (NOT APPLE) - option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile' option for query execution" 1) - option (USE_INTERNAL_LLVM_LIBRARY "Use bundled or system LLVM library. Default: system library for quicker developer builds." ${APPLE}) + option (ENABLE_EMBEDDED_COMPILER "Set to TRUE to enable support for 'compile' option for query execution" ${ENABLE_LIBRARIES}) + option (USE_INTERNAL_LLVM_LIBRARY "Use bundled or system LLVM library. Default: system library for quicker developer builds." 0) endif () if (ENABLE_EMBEDDED_COMPILER) diff --git a/cmake/find/odbc.cmake b/cmake/find/odbc.cmake index 4992306cabf..65e09d5c96d 100644 --- a/cmake/find/odbc.cmake +++ b/cmake/find/odbc.cmake @@ -1,6 +1,9 @@ # This file copied from contrib/poco/cmake/FindODBC.cmake to allow build without submodules -option (ENABLE_ODBC "Enable ODBC" ${OS_LINUX}) +if(OS_LINUX) + option (ENABLE_ODBC "Enable ODBC" ${ENABLE_LIBRARIES}) +endif() + if(ENABLE_ODBC) if (OS_LINUX) option(USE_INTERNAL_ODBC_LIBRARY "Set to FALSE to use system odbc library instead of bundled" ${NOT_UNBUNDLED}) diff --git a/cmake/find/orc.cmake b/cmake/find/orc.cmake index 50e563b04b4..613016c6ba7 100644 --- a/cmake/find/orc.cmake +++ b/cmake/find/orc.cmake @@ -1,4 +1,4 @@ -option (ENABLE_ORC "Enable ORC" 1) +option (ENABLE_ORC "Enable ORC" ${ENABLE_LIBRARIES}) if(ENABLE_ORC) option (USE_INTERNAL_ORC_LIBRARY "Set to FALSE to use system ORC instead of bundled" ${NOT_UNBUNDLED}) diff --git a/cmake/find/parquet.cmake b/cmake/find/parquet.cmake index 79be144a7a4..14332fc9caf 100644 --- a/cmake/find/parquet.cmake +++ b/cmake/find/parquet.cmake @@ -1,8 +1,10 @@ -option (ENABLE_PARQUET "Enable parquet" ON) +if (Protobuf_PROTOC_EXECUTABLE) + option (ENABLE_PARQUET "Enable parquet" ${ENABLE_LIBRARIES}) +endif() -if (ENABLE_PARQUET AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +if (ENABLE_PARQUET) -if (NOT OS_FREEBSD AND NOT APPLE) # Freebsd: ../contrib/arrow/cpp/src/arrow/util/bit-util.h:27:10: fatal error: endian.h: No such file or directory +if (NOT OS_FREEBSD AND NOT OS_DARWIN) # Freebsd: ../contrib/arrow/cpp/src/arrow/util/bit-util.h:27:10: fatal error: endian.h: No such file or directory option(USE_INTERNAL_PARQUET_LIBRARY "Set to FALSE to use system parquet library instead of bundled" ${NOT_UNBUNDLED}) endif() diff --git a/cmake/find/protobuf.cmake b/cmake/find/protobuf.cmake index fe990cfe3c8..e3330a32e7c 100644 --- a/cmake/find/protobuf.cmake +++ b/cmake/find/protobuf.cmake @@ -1,6 +1,6 @@ -option (ENABLE_PROTOBUF "Enable protobuf" ON) +option(ENABLE_PROTOBUF "Enable protobuf" ${ENABLE_LIBRARIES}) -if (ENABLE_PROTOBUF AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(ENABLE_PROTOBUF) option(USE_INTERNAL_PROTOBUF_LIBRARY "Set to FALSE to use system protobuf instead of bundled" ${NOT_UNBUNDLED}) @@ -104,4 +104,4 @@ endif() endif() -message(STATUS "Using protobuf=${USE_PROTOBUF}: ${Protobuf_INCLUDE_DIR} : ${Protobuf_LIBRARY}") +message(STATUS "Using protobuf=${USE_PROTOBUF}: ${Protobuf_INCLUDE_DIR} : ${Protobuf_LIBRARY} : ${Protobuf_PROTOC_EXECUTABLE}") diff --git a/cmake/find/rapidjson.cmake b/cmake/find/rapidjson.cmake index 443e2b02a28..df896b644e5 100644 --- a/cmake/find/rapidjson.cmake +++ b/cmake/find/rapidjson.cmake @@ -1,4 +1,4 @@ -option(ENABLE_RAPIDJSON "Use rapidjson" ON) +option(ENABLE_RAPIDJSON "Use rapidjson" ${ENABLE_LIBRARIES}) if(NOT ENABLE_RAPIDJSON) return() endif() diff --git a/cmake/find/rdkafka.cmake b/cmake/find/rdkafka.cmake index 8469969cf62..491f50b00bc 100644 --- a/cmake/find/rdkafka.cmake +++ b/cmake/find/rdkafka.cmake @@ -1,6 +1,6 @@ # Freebsd: contrib/cppkafka/include/cppkafka/detail/endianness.h:53:23: error: 'betoh16' was not declared in this scope if (NOT ARCH_ARM AND NOT ARCH_32 AND NOT APPLE AND NOT OS_FREEBSD AND OPENSSL_FOUND) - option (ENABLE_RDKAFKA "Enable kafka" ON) + option (ENABLE_RDKAFKA "Enable kafka" ${ENABLE_LIBRARIES}) endif () if (NOT EXISTS "${ClickHouse_SOURCE_DIR}/contrib/cppkafka/CMakeLists.txt") diff --git a/cmake/find/readline_edit.cmake b/cmake/find/readline_edit.cmake index 02e80a22fb1..96518a66887 100644 --- a/cmake/find/readline_edit.cmake +++ b/cmake/find/readline_edit.cmake @@ -1,8 +1,8 @@ include (CMakePushCheckState) cmake_push_check_state () -option (ENABLE_READLINE "Enable readline" 1) -if (ENABLE_READLINE AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +option (ENABLE_READLINE "Enable readline" ${ENABLE_LIBRARIES}) +if (ENABLE_READLINE) set (READLINE_PATHS "/usr/local/opt/readline/lib") # First try find custom lib for macos users (default lib without history support) diff --git a/cmake/find/snappy.cmake b/cmake/find/snappy.cmake index 3287ebee68e..504db87d613 100644 --- a/cmake/find/snappy.cmake +++ b/cmake/find/snappy.cmake @@ -1,6 +1,6 @@ -option(USE_SNAPPY "Enable support of snappy library" ON) +option(USE_SNAPPY "Enable support of snappy library" ${ENABLE_LIBRARIES}) -if (USE_SNAPPY AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(USE_SNAPPY) option (USE_INTERNAL_SNAPPY_LIBRARY "Set to FALSE to use system snappy library instead of bundled" ${NOT_UNBUNDLED}) if(NOT USE_INTERNAL_SNAPPY_LIBRARY) diff --git a/cmake/find/ssl.cmake b/cmake/find/ssl.cmake index 29fa1b9286e..af879406aab 100644 --- a/cmake/find/ssl.cmake +++ b/cmake/find/ssl.cmake @@ -1,6 +1,6 @@ -option (ENABLE_SSL "Enable ssl" ON) +option(ENABLE_SSL "Enable ssl" ${ENABLE_LIBRARIES}) -if (ENABLE_SSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(ENABLE_SSL) if(NOT ARCH_32) option(USE_INTERNAL_SSL_LIBRARY "Set to FALSE to use system *ssl library instead of bundled" ${NOT_UNBUNDLED}) diff --git a/cmake/find/unwind.cmake b/cmake/find/unwind.cmake index ea6e1d4bacb..efa7618a53b 100644 --- a/cmake/find/unwind.cmake +++ b/cmake/find/unwind.cmake @@ -1,4 +1,4 @@ -option (USE_UNWIND "Enable libunwind (better stacktraces)" ON) +option (USE_UNWIND "Enable libunwind (better stacktraces)" ${ENABLE_LIBRARIES}) if (NOT CMAKE_SYSTEM MATCHES "Linux" OR ARCH_ARM OR ARCH_32) set (USE_UNWIND OFF) diff --git a/cmake/target.cmake b/cmake/target.cmake index 2d3309ec189..5ce425b82cd 100644 --- a/cmake/target.cmake +++ b/cmake/target.cmake @@ -54,7 +54,7 @@ if (LINKER_NAME) endif () if (CMAKE_CROSSCOMPILING) - if (CMAKE_SYSTEM_NAME MATCHES "Darwin") + if (OS_DARWIN) set (CMAKE_SYSTEM_PROCESSOR x86_64) set (CMAKE_C_COMPILER_TARGET x86_64-apple-darwin) set (CMAKE_CXX_COMPILER_TARGET x86_64-apple-darwin) @@ -65,15 +65,14 @@ if (CMAKE_CROSSCOMPILING) set (HAS_POST_2038_EXITCODE "0" CACHE STRING "Result from TRY_RUN" FORCE) set (HAS_POST_2038_EXITCODE__TRYRUN_OUTPUT "" CACHE STRING "Output from TRY_RUN" FORCE) - # CMake < 3.13 doesn't respect same-name variables as values for options. # FIXME: broken dependencies - # set (USE_SNAPPY OFF) - # set (ENABLE_SSL OFF) - # set (ENABLE_PROTOBUF OFF) - # set (ENABLE_PARQUET OFF) - # set (ENABLE_READLINE OFF) - # set (ENABLE_ICU OFF) - # set (ENABLE_FASTOPS OFF) + set (USE_SNAPPY OFF CACHE INTERNAL "") + set (ENABLE_SSL OFF CACHE INTERNAL "") + set (ENABLE_PROTOBUF OFF CACHE INTERNAL "") + set (ENABLE_PARQUET OFF CACHE INTERNAL "") + set (ENABLE_READLINE OFF CACHE INTERNAL "") + set (ENABLE_ICU OFF CACHE INTERNAL "") + set (ENABLE_FASTOPS OFF CACHE INTERNAL "") message (STATUS "Cross-compiling for Darwin") else () diff --git a/contrib/arrow-cmake/CMakeLists.txt b/contrib/arrow-cmake/CMakeLists.txt index cfd57f2b296..a564f62384d 100644 --- a/contrib/arrow-cmake/CMakeLists.txt +++ b/contrib/arrow-cmake/CMakeLists.txt @@ -212,7 +212,11 @@ endif() add_library(${ARROW_LIBRARY} ${ARROW_SRCS}) -add_dependencies(${ARROW_LIBRARY} protoc) + +if (USE_INTERNAL_PROTOBUF_LIBRARY) + add_dependencies(${ARROW_LIBRARY} protoc) +endif() + target_include_directories(${ARROW_LIBRARY} SYSTEM PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/arrow/cpp/src PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/src ${Boost_INCLUDE_DIRS}) target_link_libraries(${ARROW_LIBRARY} PRIVATE ${DOUBLE_CONVERSION_LIBRARIES} ${Protobuf_LIBRARY}) if (ARROW_WITH_LZ4) diff --git a/contrib/jemalloc-cmake/CMakeLists.txt b/contrib/jemalloc-cmake/CMakeLists.txt index e44c54d2b37..43875c9d07f 100644 --- a/contrib/jemalloc-cmake/CMakeLists.txt +++ b/contrib/jemalloc-cmake/CMakeLists.txt @@ -35,7 +35,7 @@ ${JEMALLOC_SOURCE_DIR}/src/tsd.c ${JEMALLOC_SOURCE_DIR}/src/witness.c ) -if(CMAKE_SYSTEM_NAME MATCHES "Darwin") +if(OS_DARWIN) list(APPEND SRCS ${JEMALLOC_SOURCE_DIR}/src/zone.c) endif() diff --git a/contrib/libhdfs3-cmake/CMakeLists.txt b/contrib/libhdfs3-cmake/CMakeLists.txt index e1ba7225b0f..28f32e948b2 100644 --- a/contrib/libhdfs3-cmake/CMakeLists.txt +++ b/contrib/libhdfs3-cmake/CMakeLists.txt @@ -185,7 +185,7 @@ set(SRCS # target add_library(hdfs3 ${SRCS} ${PROTO_SOURCES} ${PROTO_HEADERS}) -if (USE_INTERNAL_PROTOBUF_LIBRARY) +if(USE_INTERNAL_PROTOBUF_LIBRARY) add_dependencies(hdfs3 protoc) endif() diff --git a/dbms/CMakeLists.txt b/dbms/CMakeLists.txt index 667c9076638..229639a8a7f 100644 --- a/dbms/CMakeLists.txt +++ b/dbms/CMakeLists.txt @@ -270,6 +270,7 @@ target_link_libraries(clickhouse_common_io PUBLIC ${CITYHASH_LIBRARIES} PRIVATE + ${Poco_XML_LIBRARY} ${ZLIB_LIBRARIES} ${EXECINFO_LIBRARIES} PUBLIC @@ -330,7 +331,7 @@ dbms_target_include_directories(SYSTEM PUBLIC ${PCG_RANDOM_INCLUDE_DIR}) dbms_target_include_directories(SYSTEM BEFORE PUBLIC ${PDQSORT_INCLUDE_DIR}) -if (NOT USE_INTERNAL_LZ4_LIBRARY) +if (NOT USE_INTERNAL_LZ4_LIBRARY AND LZ4_INCLUDE_DIR) dbms_target_include_directories(SYSTEM BEFORE PRIVATE ${LZ4_INCLUDE_DIR}) endif () diff --git a/dbms/programs/server/CMakeLists.txt b/dbms/programs/server/CMakeLists.txt index 72a2427ef3c..16aa7131291 100644 --- a/dbms/programs/server/CMakeLists.txt +++ b/dbms/programs/server/CMakeLists.txt @@ -10,7 +10,7 @@ set(CLICKHOUSE_SERVER_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/TCPHandler.cpp ) -if (USE_POCO_NETSSL) +if (USE_SSL) set(CLICKHOUSE_SERVER_SOURCES ${CLICKHOUSE_SERVER_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/MySQLHandler.cpp diff --git a/dbms/programs/server/MySQLHandler.cpp b/dbms/programs/server/MySQLHandler.cpp index 76cc7ddc632..1b495552fbc 100644 --- a/dbms/programs/server/MySQLHandler.cpp +++ b/dbms/programs/server/MySQLHandler.cpp @@ -1,5 +1,5 @@ #include -#if USE_POCO_NETSSL +#if USE_SSL #include "MySQLHandler.h" #include diff --git a/dbms/programs/server/MySQLHandler.h b/dbms/programs/server/MySQLHandler.h index e1e4297ea8d..9d51667925d 100644 --- a/dbms/programs/server/MySQLHandler.h +++ b/dbms/programs/server/MySQLHandler.h @@ -1,6 +1,6 @@ #pragma once #include -#if USE_POCO_NETSSL +#if USE_SSL #include #include diff --git a/dbms/programs/server/MySQLHandlerFactory.cpp b/dbms/programs/server/MySQLHandlerFactory.cpp index 8e7ebcb8291..752d88e05d8 100644 --- a/dbms/programs/server/MySQLHandlerFactory.cpp +++ b/dbms/programs/server/MySQLHandlerFactory.cpp @@ -1,7 +1,6 @@ -#include -#if USE_POCO_NETSSL +#include "MySQLHandlerFactory.h" +#if USE_POCO_NETSSL && USE_SSL #include -#include #include #include #include @@ -9,7 +8,6 @@ #include #include "IServer.h" #include "MySQLHandler.h" -#include "MySQLHandlerFactory.h" namespace DB { diff --git a/dbms/programs/server/MySQLHandlerFactory.h b/dbms/programs/server/MySQLHandlerFactory.h index 2da1d0f94a9..78022ddce37 100644 --- a/dbms/programs/server/MySQLHandlerFactory.h +++ b/dbms/programs/server/MySQLHandlerFactory.h @@ -1,7 +1,7 @@ #pragma once #include -#if USE_POCO_NETSSL +#if USE_POCO_NETSSL && USE_SSL #include #include diff --git a/dbms/programs/server/Server.cpp b/dbms/programs/server/Server.cpp index 84097fe4d7e..5385057fd03 100644 --- a/dbms/programs/server/Server.cpp +++ b/dbms/programs/server/Server.cpp @@ -813,7 +813,7 @@ int Server::main(const std::vector & /*args*/) create_server("mysql_port", [&](UInt16 port) { -#if USE_POCO_NETSSL +#if USE_SSL Poco::Net::ServerSocket socket; auto address = socket_bind_listen(socket, listen_host, port, /* secure = */ true); socket.setReceiveTimeout(Poco::Timespan()); diff --git a/dbms/src/Common/Dwarf.cpp b/dbms/src/Common/Dwarf.cpp index b7dc6a6eaa9..ea4d085399f 100644 --- a/dbms/src/Common/Dwarf.cpp +++ b/dbms/src/Common/Dwarf.cpp @@ -1,4 +1,4 @@ -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) /* * Copyright 2012-present Facebook, Inc. diff --git a/dbms/src/Common/Dwarf.h b/dbms/src/Common/Dwarf.h index 216b9bca1a9..2f97212d4d7 100644 --- a/dbms/src/Common/Dwarf.h +++ b/dbms/src/Common/Dwarf.h @@ -1,6 +1,6 @@ #pragma once -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) /* * Copyright 2012-present Facebook, Inc. diff --git a/dbms/src/Common/Elf.cpp b/dbms/src/Common/Elf.cpp index 594264c0099..11d454abd71 100644 --- a/dbms/src/Common/Elf.cpp +++ b/dbms/src/Common/Elf.cpp @@ -1,4 +1,4 @@ -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) #include #include diff --git a/dbms/src/Common/Elf.h b/dbms/src/Common/Elf.h index f0576ab7d58..f3aafc8e5a9 100644 --- a/dbms/src/Common/Elf.h +++ b/dbms/src/Common/Elf.h @@ -1,6 +1,6 @@ #pragma once -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) #include diff --git a/dbms/src/Common/OpenSSLHelpers.cpp b/dbms/src/Common/OpenSSLHelpers.cpp index 28542f1151e..a0a8ea91dbc 100644 --- a/dbms/src/Common/OpenSSLHelpers.cpp +++ b/dbms/src/Common/OpenSSLHelpers.cpp @@ -1,5 +1,5 @@ #include -#if USE_POCO_NETSSL +#if USE_SSL #include "OpenSSLHelpers.h" #include #include diff --git a/dbms/src/Common/OpenSSLHelpers.h b/dbms/src/Common/OpenSSLHelpers.h index 90c0d002fb4..bab045d2625 100644 --- a/dbms/src/Common/OpenSSLHelpers.h +++ b/dbms/src/Common/OpenSSLHelpers.h @@ -1,6 +1,6 @@ #pragma once #include -#if USE_POCO_NETSSL +#if USE_SSL #include diff --git a/dbms/src/Common/StackTrace.cpp b/dbms/src/Common/StackTrace.cpp index 9694e33a2dd..072bb55cf57 100644 --- a/dbms/src/Common/StackTrace.cpp +++ b/dbms/src/Common/StackTrace.cpp @@ -250,7 +250,7 @@ static void toStringEveryLineImpl(const StackTrace::Frames & frames, size_t offs if (size == 0) return callback(""); -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) const DB::SymbolIndex & symbol_index = DB::SymbolIndex::instance(); std::unordered_map dwarfs; diff --git a/dbms/src/Common/SymbolIndex.cpp b/dbms/src/Common/SymbolIndex.cpp index ebd5c68807a..ec8fd2ffa9d 100644 --- a/dbms/src/Common/SymbolIndex.cpp +++ b/dbms/src/Common/SymbolIndex.cpp @@ -1,4 +1,4 @@ -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) #include diff --git a/dbms/src/Common/SymbolIndex.h b/dbms/src/Common/SymbolIndex.h index 7cc72511c41..0e249c59bb2 100644 --- a/dbms/src/Common/SymbolIndex.h +++ b/dbms/src/Common/SymbolIndex.h @@ -1,6 +1,6 @@ #pragma once -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) #include #include diff --git a/dbms/src/Common/checkStackSize.cpp b/dbms/src/Common/checkStackSize.cpp index 62f04da70c7..16074e74281 100644 --- a/dbms/src/Common/checkStackSize.cpp +++ b/dbms/src/Common/checkStackSize.cpp @@ -1,11 +1,14 @@ #include #include #include - #include #include #include +#if defined(__FreeBSD__) +# include +#endif + namespace DB { diff --git a/dbms/src/Common/config.h.in b/dbms/src/Common/config.h.in index 7804068e5c4..a32eee16854 100644 --- a/dbms/src/Common/config.h.in +++ b/dbms/src/Common/config.h.in @@ -3,6 +3,7 @@ // .h autogenerated by cmake! #cmakedefine01 USE_RE2_ST +#cmakedefine01 USE_SSL #cmakedefine01 USE_POCO_NETSSL #cmakedefine01 USE_HDFS #cmakedefine01 USE_CPUID diff --git a/dbms/src/Common/filesystemHelpers.cpp b/dbms/src/Common/filesystemHelpers.cpp index 908c109524a..8d6b57df286 100644 --- a/dbms/src/Common/filesystemHelpers.cpp +++ b/dbms/src/Common/filesystemHelpers.cpp @@ -1,14 +1,14 @@ #include -#include #include #include +#include namespace DB { -bool enoughSpaceInDirectory(const std::string & path, size_t data_size) +bool enoughSpaceInDirectory(const std::string & path [[maybe_unused]], size_t data_size [[maybe_unused]]) { -#if !UNBUNDLED +#if POCO_VERSION >= 0x01090000 auto free_space = Poco::File(path).freeSpace(); if (data_size > free_space) return false; diff --git a/dbms/src/Common/tests/symbol_index.cpp b/dbms/src/Common/tests/symbol_index.cpp index baab1de1fe1..9f7ed2e9321 100644 --- a/dbms/src/Common/tests/symbol_index.cpp +++ b/dbms/src/Common/tests/symbol_index.cpp @@ -14,7 +14,7 @@ NO_INLINE const void * getAddress() int main(int argc, char ** argv) { -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) using namespace DB; if (argc < 2) diff --git a/dbms/src/Core/config_core.h.in b/dbms/src/Core/config_core.h.in index 15402294f83..fdbd69decd3 100644 --- a/dbms/src/Core/config_core.h.in +++ b/dbms/src/Core/config_core.h.in @@ -12,4 +12,3 @@ #cmakedefine01 USE_POCO_REDIS #cmakedefine01 USE_INTERNAL_LLVM_LIBRARY #cmakedefine01 USE_SSL - diff --git a/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp b/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp index 588a9e30cec..4a6259d4a7c 100644 --- a/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp +++ b/dbms/src/DataStreams/MergeSortingBlockInputStream.cpp @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/dbms/src/Functions/addressToLine.cpp b/dbms/src/Functions/addressToLine.cpp index cd7e374c27b..e2ab7576eef 100644 --- a/dbms/src/Functions/addressToLine.cpp +++ b/dbms/src/Functions/addressToLine.cpp @@ -1,4 +1,4 @@ -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) #include #include diff --git a/dbms/src/Functions/addressToSymbol.cpp b/dbms/src/Functions/addressToSymbol.cpp index 80b197c4429..29f541c1e27 100644 --- a/dbms/src/Functions/addressToSymbol.cpp +++ b/dbms/src/Functions/addressToSymbol.cpp @@ -1,4 +1,4 @@ -#ifdef __ELF__ +#if defined(__ELF__) && !defined(__FreeBSD__) #include #include diff --git a/dbms/src/Interpreters/Aggregator.cpp b/dbms/src/Interpreters/Aggregator.cpp index 784fe4341ba..53c706bf85d 100644 --- a/dbms/src/Interpreters/Aggregator.cpp +++ b/dbms/src/Interpreters/Aggregator.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include diff --git a/dbms/src/Interpreters/ExpressionJIT.cpp b/dbms/src/Interpreters/ExpressionJIT.cpp index 972cfe38c17..4c3a8bbb1d5 100644 --- a/dbms/src/Interpreters/ExpressionJIT.cpp +++ b/dbms/src/Interpreters/ExpressionJIT.cpp @@ -136,14 +136,14 @@ auto wrapJITSymbolResolver(llvm::JITSymbolResolver & jsr) { #if USE_INTERNAL_LLVM_LIBRARY && LLVM_VERSION_PATCH == 0 // REMOVE AFTER contrib/llvm upgrade - auto flags = [&](llvm::orc::SymbolFlagsMap & flags, const llvm::orc::SymbolNameSet & symbols) + auto flags = [&](llvm::orc::SymbolFlagsMap & flags_internal, const llvm::orc::SymbolNameSet & symbols) { llvm::orc::SymbolNameSet missing; for (const auto & symbol : symbols) { auto resolved = jsr.lookupFlags({*symbol}); if (resolved && resolved->size()) - flags.emplace(symbol, resolved->begin()->second); + flags_internal.emplace(symbol, resolved->begin()->second); else missing.emplace(symbol); } diff --git a/dbms/src/Processors/Transforms/MergeSortingTransform.cpp b/dbms/src/Processors/Transforms/MergeSortingTransform.cpp index 5528f02952d..83d80d42e05 100644 --- a/dbms/src/Processors/Transforms/MergeSortingTransform.cpp +++ b/dbms/src/Processors/Transforms/MergeSortingTransform.cpp @@ -1,14 +1,12 @@ +#include #include #include #include - #include #include #include - #include #include - #include #include diff --git a/debian/clickhouse-client.install b/debian/clickhouse-client.install index 5e730db669f..f19f937b318 100644 --- a/debian/clickhouse-client.install +++ b/debian/clickhouse-client.install @@ -5,4 +5,3 @@ usr/bin/clickhouse-benchmark usr/bin/clickhouse-format usr/bin/clickhouse-obfuscator etc/clickhouse-client/config.xml -usr/bin/clickhouse-extract-from-config diff --git a/debian/clickhouse-common-static.install b/debian/clickhouse-common-static.install index 81b1dc4eb1b..f1cbf0848d3 100644 --- a/debian/clickhouse-common-static.install +++ b/debian/clickhouse-common-static.install @@ -1,3 +1,4 @@ usr/bin/clickhouse usr/bin/clickhouse-odbc-bridge +usr/bin/clickhouse-extract-from-config etc/security/limits.d/clickhouse.conf diff --git a/debian/clickhouse-server-common.install b/debian/clickhouse-server-common.install deleted file mode 100644 index 7237e9914d5..00000000000 --- a/debian/clickhouse-server-common.install +++ /dev/null @@ -1,2 +0,0 @@ -etc/clickhouse-server/config.xml etc/clickhouse-server -etc/clickhouse-server/users.xml etc/clickhouse-server diff --git a/libs/libcommon/cmake/find_jemalloc.cmake b/libs/libcommon/cmake/find_jemalloc.cmake index 0b1c80c8934..ec0841d1535 100644 --- a/libs/libcommon/cmake/find_jemalloc.cmake +++ b/libs/libcommon/cmake/find_jemalloc.cmake @@ -1,5 +1,5 @@ if (OS_LINUX AND NOT SANITIZE AND NOT ARCH_ARM AND NOT ARCH_32 AND NOT ARCH_PPC64LE) - set(ENABLE_JEMALLOC_DEFAULT 1) + set(ENABLE_JEMALLOC_DEFAULT ${ENABLE_LIBRARIES}) else () set(ENABLE_JEMALLOC_DEFAULT 0) endif () diff --git a/libs/libmysqlxx/cmake/find_mysqlclient.cmake b/libs/libmysqlxx/cmake/find_mysqlclient.cmake index e07ebe2304d..30cd0a586b3 100644 --- a/libs/libmysqlxx/cmake/find_mysqlclient.cmake +++ b/libs/libmysqlxx/cmake/find_mysqlclient.cmake @@ -1,4 +1,4 @@ -option(ENABLE_MYSQL "Enable MySQL" 1) +option(ENABLE_MYSQL "Enable MySQL" ${ENABLE_LIBRARIES}) if(ENABLE_MYSQL) if(OS_LINUX) option(USE_INTERNAL_MYSQL_LIBRARY "Set to FALSE to use system mysqlclient library instead of bundled" ${NOT_UNBUNDLED}) diff --git a/utils/build/build_debian_shared.sh b/utils/build/build_debian_shared.sh new file mode 100755 index 00000000000..5974dba2d51 --- /dev/null +++ b/utils/build/build_debian_shared.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +ROOT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../.. && pwd) + +CMAKE_FLAGS="-DUSE_STATIC_LIBRARIES=0 -DCLICKHOUSE_SPLIT_BINARY=1 $CMAKE_FLAGS" +. $ROOT_DIR/release diff --git a/utils/build/build_minimal.sh b/utils/build/build_minimal.sh new file mode 100755 index 00000000000..673a6fe898d --- /dev/null +++ b/utils/build/build_minimal.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) + +CMAKE_FLAGS+=" -DENABLE_LIBRARIES=0 " +. $CUR_DIR/build_no_submodules.sh diff --git a/utils/build/build_no_submodules.sh b/utils/build/build_no_submodules.sh new file mode 100755 index 00000000000..63349882128 --- /dev/null +++ b/utils/build/build_no_submodules.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -e + +CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) + +cd ${CUR_DIR}/../.. +BRANCH=`git rev-parse --abbrev-ref HEAD` +BRANCH=${BRANCH:=master} +ROOT_DIR=${CUR_DIR}/../build_no_submodules +mkdir -p $ROOT_DIR +cd $ROOT_DIR +URL=`git remote get-url origin | sed 's/.git$//'` +wget -O ch.zip $URL/archive/${BRANCH}.zip +unzip -ou ch.zip + +# TODO: make disableable lz4 zstd +# TODO: USE_INTERNAL_DOUBLE_CONVERSION_LIBRARY : cmake test +# Shared because /usr/bin/ld.gold: error: /usr/lib/x86_64-linux-gnu/libcrypto.a(err.o): multiple definition of 'ERR_remove_thread_state' +CMAKE_FLAGS+="-DUSE_STATIC_LIBRARIES=0 -DUSE_INTERNAL_DOUBLE_CONVERSION_LIBRARY=0 $CMAKE_FLAGS" +EXTRAPACKAGES+="libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-regex-dev liblz4-dev libzstd-dev libpoco-dev libdouble-conversion-dev libcctz-dev libre2-dev libsparsehash-dev $EXTRAPACKAGES" +. $ROOT_DIR/ClickHouse-${BRANCH}/release