diff --git a/CMakeLists.txt b/CMakeLists.txt index 721b3233041..359cc18aecb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,7 +75,7 @@ if (USE_STATIC_LIBRARIES) list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) endif () -if (CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") +if (CMAKE_LIBRARY_ARCHITECTURE MATCHES "amd64.*|x86_64.*|AMD64.*") option (USE_INTERNAL_MEMCPY "Use internal implementation of 'memcpy' function instead of provided by libc. Only for x86_64." ON) if (CMAKE_SYSTEM MATCHES "Linux") diff --git a/cmake/find_zlib.cmake b/cmake/find_zlib.cmake index db26c0ad2de..c5ebb625564 100644 --- a/cmake/find_zlib.cmake +++ b/cmake/find_zlib.cmake @@ -8,7 +8,7 @@ if (NOT ZLIB_FOUND) set (USE_INTERNAL_ZLIB_LIBRARY 1) set (ZLIB_COMPAT 1) # for zlib-ng, also enables WITH_GZFILEOP set (WITH_NATIVE_INSTRUCTIONS ${ARCHNATIVE}) - if (CMAKE_SYSTEM MATCHES "FreeBSD") + if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_I386) set (WITH_OPTIM 0 CACHE INTERNAL "") # Bug in assembler endif () set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/zlib-ng" "${ClickHouse_BINARY_DIR}/contrib/zlib-ng") # generated zconf.h diff --git a/contrib/libtcmalloc/CMakeLists.txt b/contrib/libtcmalloc/CMakeLists.txt index 4ce75d9d7eb..f232c060de3 100644 --- a/contrib/libtcmalloc/CMakeLists.txt +++ b/contrib/libtcmalloc/CMakeLists.txt @@ -37,7 +37,8 @@ add_library (tcmalloc_minimal_internal ./src/memory_region_map.cc ) -target_compile_options (tcmalloc_minimal_internal PUBLIC + +target_compile_options (tcmalloc_minimal_internal -DNO_TCMALLOC_SAMPLES -DNDEBUG -DNO_FRAME_POINTER @@ -47,6 +48,8 @@ target_compile_options (tcmalloc_minimal_internal PUBLIC -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-private-field + + PUBLIC -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc diff --git a/dbms/src/AggregateFunctions/CMakeLists.txt b/dbms/src/AggregateFunctions/CMakeLists.txt index e1316b3027d..bc0152f5dc7 100644 --- a/dbms/src/AggregateFunctions/CMakeLists.txt +++ b/dbms/src/AggregateFunctions/CMakeLists.txt @@ -26,6 +26,6 @@ list(REMOVE_ITEM clickhouse_aggregate_functions_headers parseAggregateFunctionParameters.h ) -add_library(clickhouse_aggregate_functions ${SPLIT_SHARED} ${clickhouse_aggregate_functions_sources}) +add_library(clickhouse_aggregate_functions ${clickhouse_aggregate_functions_sources}) target_link_libraries(clickhouse_aggregate_functions dbms) target_include_directories (clickhouse_aggregate_functions BEFORE PRIVATE ${COMMON_INCLUDE_DIR}) diff --git a/dbms/src/Functions/CMakeLists.txt b/dbms/src/Functions/CMakeLists.txt index 65563e4cbe0..0ecb0091192 100644 --- a/dbms/src/Functions/CMakeLists.txt +++ b/dbms/src/Functions/CMakeLists.txt @@ -70,7 +70,7 @@ add_headers_and_sources(clickhouse_functions ${ClickHouse_BINARY_DIR}/dbms/src/F list(REMOVE_ITEM clickhouse_functions_sources IFunction.cpp FunctionFactory.cpp DataTypeTraits.cpp FunctionHelpers.cpp) list(REMOVE_ITEM clickhouse_functions_headers IFunction.h FunctionFactory.h DataTypeTraits.h FunctionHelpers.h) -add_library(clickhouse_functions ${SPLIT_SHARED} ${clickhouse_functions_sources}) +add_library(clickhouse_functions ${clickhouse_functions_sources}) target_link_libraries(clickhouse_functions dbms) target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libfarmhash) target_include_directories (clickhouse_functions BEFORE PUBLIC ${ClickHouse_SOURCE_DIR}/contrib/libmetrohash/src) diff --git a/dbms/src/Server/CMakeLists.txt b/dbms/src/Server/CMakeLists.txt index 040f780e98e..0357deac24f 100644 --- a/dbms/src/Server/CMakeLists.txt +++ b/dbms/src/Server/CMakeLists.txt @@ -16,32 +16,32 @@ add_library(clickhouse-server TCPHandler.cpp ) -target_link_libraries(clickhouse-server daemon clickhouse_storages_system clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions) +target_link_libraries(clickhouse-server clickhouse_common_io daemon clickhouse_storages_system clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions) target_include_directories (clickhouse-server PUBLIC ${ClickHouse_SOURCE_DIR}/libs/libdaemon/include) add_library(clickhouse-local LocalServer.cpp) -target_link_libraries(clickhouse-local dbms clickhouse-server clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions) +target_link_libraries(clickhouse-local clickhouse-server clickhouse_functions clickhouse_aggregate_functions clickhouse_table_functions) -add_library(clickhouse-extract-from-config ExtractFromConfig.cpp) -target_link_libraries(clickhouse-extract-from-config dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +add_library(clickhouse-extract-from-config ${SPLIT_SHARED} ExtractFromConfig.cpp) +target_link_libraries(clickhouse-extract-from-config clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) add_library (clickhouse-client Client.cpp) -target_link_libraries (clickhouse-client dbms clickhouse_functions clickhouse_aggregate_functions ${LINE_EDITING_LIBS} ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (clickhouse-client clickhouse_functions clickhouse_aggregate_functions ${LINE_EDITING_LIBS} ${Boost_PROGRAM_OPTIONS_LIBRARY}) install (FILES clickhouse-client.xml DESTINATION ${CLICKHOUSE_ETC_DIR}/clickhouse-client COMPONENT clickhouse-client RENAME config.xml) -add_library (clickhouse-benchmark Benchmark.cpp) -target_link_libraries (clickhouse-benchmark dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +add_library (clickhouse-benchmark ${SPLIT_SHARED} Benchmark.cpp) +target_link_libraries (clickhouse-benchmark clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) target_include_directories (clickhouse-benchmark PRIVATE ${PCG_RANDOM_INCLUDE_DIR}) -add_library (clickhouse-performance-test PerformanceTest.cpp) -target_link_libraries (clickhouse-performance-test dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +add_library (clickhouse-performance-test ${SPLIT_SHARED} PerformanceTest.cpp) +target_link_libraries (clickhouse-performance-test clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) target_include_directories (clickhouse-performance-test PRIVATE ${PCG_RANDOM_INCLUDE_DIR}) -add_library (clickhouse-compressor-lib Compressor.cpp) -target_link_libraries (clickhouse-compressor-lib dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +add_library (clickhouse-compressor-lib ${SPLIT_SHARED} Compressor.cpp) +target_link_libraries (clickhouse-compressor-lib clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) -add_library (clickhouse-format Format.cpp) -target_link_libraries (clickhouse-format dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +add_library (clickhouse-format ${SPLIT_SHARED} Format.cpp) +target_link_libraries (clickhouse-format clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) if (USE_EMBEDDED_COMPILER) link_directories (${LLVM_LIBRARY_DIRS}) @@ -57,7 +57,9 @@ target_link_libraries(clickhouse clickhouse-performance-test clickhouse-extract-from-config clickhouse-compressor-lib - clickhouse-format) + clickhouse-format + dbms + ) if (USE_EMBEDDED_COMPILER) add_subdirectory (Compiler) diff --git a/dbms/src/Storages/System/CMakeLists.txt b/dbms/src/Storages/System/CMakeLists.txt index 0b79de997d6..a561ebe1583 100644 --- a/dbms/src/Storages/System/CMakeLists.txt +++ b/dbms/src/Storages/System/CMakeLists.txt @@ -1,5 +1,5 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake) add_headers_and_sources(storages_system .) -add_library(clickhouse_storages_system ${SPLIT_SHARED} ${storages_system_headers} ${storages_system_sources}) +add_library(clickhouse_storages_system ${storages_system_headers} ${storages_system_sources}) target_link_libraries(clickhouse_storages_system dbms) diff --git a/dbms/src/TableFunctions/CMakeLists.txt b/dbms/src/TableFunctions/CMakeLists.txt index bf3488a344a..8f2305830b8 100644 --- a/dbms/src/TableFunctions/CMakeLists.txt +++ b/dbms/src/TableFunctions/CMakeLists.txt @@ -4,5 +4,5 @@ add_headers_and_sources(clickhouse_table_functions .) list(REMOVE_ITEM clickhouse_table_functions_sources TableFunctionFactory.cpp) list(REMOVE_ITEM clickhouse_table_functions_headers ITableFunction.h TableFunctionFactory.h) -add_library(clickhouse_table_functions ${SPLIT_SHARED} ${clickhouse_table_functions_sources}) +add_library(clickhouse_table_functions ${clickhouse_table_functions_sources}) target_link_libraries(clickhouse_table_functions dbms clickhouse_storages_system ${Poco_Foundation_LIBRARY}) diff --git a/utils/check-marks/CMakeLists.txt b/utils/check-marks/CMakeLists.txt index 30d50d4c286..5b858f929e1 100644 --- a/utils/check-marks/CMakeLists.txt +++ b/utils/check-marks/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable (check-marks main.cpp) -target_link_libraries (check-marks dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (check-marks clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) diff --git a/utils/config-processor/CMakeLists.txt b/utils/config-processor/CMakeLists.txt index 50b744a0a17..9d4d491bad9 100644 --- a/utils/config-processor/CMakeLists.txt +++ b/utils/config-processor/CMakeLists.txt @@ -1,4 +1,4 @@ add_executable (config-processor config-processor.cpp) -target_link_libraries (config-processor dbms) +target_link_libraries (config-processor clickhouse_common_io) INSTALL(TARGETS config-processor RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT config-processor) diff --git a/utils/corrector_utf8/CMakeLists.txt b/utils/corrector_utf8/CMakeLists.txt index db5cfc4964b..d9c971a6cc5 100644 --- a/utils/corrector_utf8/CMakeLists.txt +++ b/utils/corrector_utf8/CMakeLists.txt @@ -2,7 +2,6 @@ add_executable(corrector_utf8 corrector_utf8.cpp) # Link the executable to the library. -target_link_libraries (corrector_utf8 dbms) -add_dependencies(corrector_utf8 dbms) +target_link_libraries (corrector_utf8 clickhouse_common_io) install( TARGETS corrector_utf8 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT corrector_utf8) diff --git a/utils/fill-factor/CMakeLists.txt b/utils/fill-factor/CMakeLists.txt index dac8c621ff6..fad359b63a6 100644 --- a/utils/fill-factor/CMakeLists.txt +++ b/utils/fill-factor/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable (fill-factor main.cpp) -target_link_libraries (fill-factor dbms) +target_link_libraries (fill-factor clickhouse_common_io) diff --git a/utils/iotest/CMakeLists.txt b/utils/iotest/CMakeLists.txt index f4f916b3f7f..2a307d0ba66 100644 --- a/utils/iotest/CMakeLists.txt +++ b/utils/iotest/CMakeLists.txt @@ -1,11 +1,11 @@ add_executable (iotest iotest.cpp ${SRCS}) -target_link_libraries (iotest dbms) +target_link_libraries (iotest clickhouse_common_io) add_executable (iotest_nonblock iotest_nonblock.cpp ${SRCS}) -target_link_libraries (iotest_nonblock dbms) +target_link_libraries (iotest_nonblock clickhouse_common_io) if (NOT APPLE AND NOT CMAKE_SYSTEM MATCHES "FreeBSD") add_executable (iotest_aio iotest_aio.cpp ${SRCS}) - target_link_libraries (iotest_aio dbms) + target_link_libraries (iotest_aio clickhouse_common_io) endif() diff --git a/utils/test-data-generator/CMakeLists.txt b/utils/test-data-generator/CMakeLists.txt index fd0bfb8b9f0..9f1a0bf5a0d 100644 --- a/utils/test-data-generator/CMakeLists.txt +++ b/utils/test-data-generator/CMakeLists.txt @@ -1,5 +1,5 @@ add_executable (test-data-generator main.cpp) -target_link_libraries (test-data-generator dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (test-data-generator clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) add_executable (markov-model markov-model.cpp) -target_link_libraries (markov-model dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (markov-model clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) diff --git a/utils/wikistat-loader/CMakeLists.txt b/utils/wikistat-loader/CMakeLists.txt index 96f5e5ba07f..84d00e91bd5 100644 --- a/utils/wikistat-loader/CMakeLists.txt +++ b/utils/wikistat-loader/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable (wikistat-loader main.cpp ${SRCS}) -target_link_libraries (wikistat-loader dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (wikistat-loader clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) diff --git a/utils/zookeeper-cli/CMakeLists.txt b/utils/zookeeper-cli/CMakeLists.txt index bd230fdeb54..eeacad3c6e2 100644 --- a/utils/zookeeper-cli/CMakeLists.txt +++ b/utils/zookeeper-cli/CMakeLists.txt @@ -1,3 +1,3 @@ add_executable(clickhouse-zookeeper-cli zookeeper-cli.cpp) -target_link_libraries(clickhouse-zookeeper-cli dbms ${LINE_EDITING_LIBS}) +target_link_libraries(clickhouse-zookeeper-cli clickhouse_common_io ${LINE_EDITING_LIBS}) INSTALL(TARGETS clickhouse-zookeeper-cli RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse-utils) diff --git a/utils/zookeeper-dump-tree/CMakeLists.txt b/utils/zookeeper-dump-tree/CMakeLists.txt index 7510d21579a..f87ae72efd7 100644 --- a/utils/zookeeper-dump-tree/CMakeLists.txt +++ b/utils/zookeeper-dump-tree/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable (zookeeper-dump-tree main.cpp ${SRCS}) -target_link_libraries (zookeeper-dump-tree dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (zookeeper-dump-tree clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY}) diff --git a/utils/zookeeper-remove-by-list/CMakeLists.txt b/utils/zookeeper-remove-by-list/CMakeLists.txt index 08d2780f945..a16f816cc78 100644 --- a/utils/zookeeper-remove-by-list/CMakeLists.txt +++ b/utils/zookeeper-remove-by-list/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable (zookeeper-remove-by-list main.cpp ${SRCS}) -target_link_libraries (zookeeper-remove-by-list dbms ${Boost_PROGRAM_OPTIONS_LIBRARY}) +target_link_libraries (zookeeper-remove-by-list clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY})