* Build fix

* Better sample build scripts

* zlib apple fix

* fix

* fix

* better so version

* SPLIT_SHARED -> LINK_MODE

* clean
This commit is contained in:
proller 2018-08-27 17:39:20 +03:00 committed by alexey-milovidov
parent 3913a6ef4e
commit 3acce3bff9
27 changed files with 77 additions and 57 deletions

View File

@ -71,7 +71,7 @@ if (NOT MAKE_STATIC_LIBRARIES)
endif ()
if (SPLIT_SHARED_LIBRARIES)
set (SPLIT_SHARED SHARED)
set (LINK_MODE SHARED)
endif ()
if (USE_STATIC_LIBRARIES)

View File

@ -1,4 +1,6 @@
option (USE_INTERNAL_SSL_LIBRARY "Set to FALSE to use system *ssl library instead of bundled" ${OS_LINUX})
#if (OS_LINUX)
option (USE_INTERNAL_SSL_LIBRARY "Set to FALSE to use system *ssl library instead of bundled" ${NOT_UNBUNDLED})
#endif ()
set (OPENSSL_USE_STATIC_LIBS ${USE_STATIC_LIBRARIES})

View File

@ -60,8 +60,8 @@ if (USE_INTERNAL_ZLIB_LIBRARY)
target_compile_definitions (zlib PUBLIC ZLIB_COMPAT WITH_GZFILEOP)
target_compile_definitions (zlibstatic PUBLIC ZLIB_COMPAT WITH_GZFILEOP)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64")
target_compile_definitions (zlib PUBLIC X86_64)
target_compile_definitions (zlibstatic PUBLIC X86_64)
target_compile_definitions (zlib PUBLIC X86_64 X86_NOCHECK_SSE2 UNALIGNED_OK)
target_compile_definitions (zlibstatic PUBLIC X86_64 X86_NOCHECK_SSE2 UNALIGNED_OK)
endif ()
set_target_properties(example PROPERTIES EXCLUDE_FROM_ALL 1)

View File

@ -16,7 +16,7 @@ if (NOT MSVC)
add_definitions(-Wno-unused-variable -Wno-deprecated-declarations)
endif ()
add_library(boost_program_options_internal ${SPLIT_SHARED}
add_library(boost_program_options_internal ${LINK_MODE}
${LIBRARY_DIR}/libs/program_options/src/cmdline.cpp
${LIBRARY_DIR}/libs/program_options/src/config_file.cpp
${LIBRARY_DIR}/libs/program_options/src/convert.cpp
@ -29,7 +29,7 @@ ${LIBRARY_DIR}/libs/program_options/src/value_semantic.cpp
${LIBRARY_DIR}/libs/program_options/src/variables_map.cpp
${LIBRARY_DIR}/libs/program_options/src/winmain.cpp)
add_library(boost_filesystem_internal ${SPLIT_SHARED}
add_library(boost_filesystem_internal ${LINK_MODE}
${LIBRARY_DIR}/libs/filesystem/src/codecvt_error_category.cpp
${LIBRARY_DIR}/libs/filesystem/src/operations.cpp
${LIBRARY_DIR}/libs/filesystem/src/path.cpp
@ -39,7 +39,7 @@ ${LIBRARY_DIR}/libs/filesystem/src/unique_path.cpp
${LIBRARY_DIR}/libs/filesystem/src/utf8_codecvt_facet.cpp
${LIBRARY_DIR}/libs/filesystem/src/windows_file_codecvt.cpp)
add_library(boost_system_internal ${SPLIT_SHARED}
add_library(boost_system_internal ${LINK_MODE}
${LIBRARY_DIR}/libs/system/src/error_code.cpp)
target_link_libraries (boost_filesystem_internal PUBLIC boost_system_internal)

View File

@ -1,6 +1,6 @@
SET(LIBRARY_DIR ${ClickHouse_SOURCE_DIR}/contrib/cctz)
add_library(cctz ${SPLIT_SHARED}
add_library(cctz ${LINK_MODE}
${LIBRARY_DIR}/src/civil_time_detail.cc
${LIBRARY_DIR}/src/time_zone_fixed.cc
${LIBRARY_DIR}/src/time_zone_format.cc

View File

@ -54,7 +54,7 @@ ${RDKAFKA_SOURCE_DIR}/lz4hc.c
${RDKAFKA_SOURCE_DIR}/rdgz.c
)
add_library(rdkafka ${SPLIT_SHARED} ${SRCS})
add_library(rdkafka ${LINK_MODE} ${SRCS})
target_include_directories(rdkafka PRIVATE include)
target_include_directories(rdkafka SYSTEM PUBLIC ${RDKAFKA_SOURCE_DIR})
target_link_libraries(rdkafka PUBLIC ${ZLIB_LIBRARIES} ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY})

View File

@ -23,7 +23,7 @@ ${ODBC_SOURCE_DIR}/libltdl/loaders/preopen.c
${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/libltdl/libltdlcS.c
)
add_library(ltdl ${SPLIT_SHARED} ${SRCS})
add_library(ltdl ${LINK_MODE} ${SRCS})
target_include_directories(ltdl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/linux_x86_64/libltdl)
target_include_directories(ltdl PUBLIC ${ODBC_SOURCE_DIR}/libltdl)
@ -273,7 +273,7 @@ ${ODBC_SOURCE_DIR}/lst/lstSetFreeFunc.c
${ODBC_SOURCE_DIR}/lst/_lstVisible.c
)
add_library(unixodbc ${SPLIT_SHARED} ${SRCS})
add_library(unixodbc ${LINK_MODE} ${SRCS})
target_link_libraries(unixodbc ltdl)

View File

@ -125,6 +125,6 @@ IF (ZSTD_LEGACY_SUPPORT)
${LIBRARY_LEGACY_DIR}/zstd_v07.h)
ENDIF (ZSTD_LEGACY_SUPPORT)
ADD_LIBRARY(zstd ${SPLIT_SHARED} ${Sources} ${Headers})
ADD_LIBRARY(zstd ${LINK_MODE} ${Sources} ${Headers})
target_include_directories (zstd PUBLIC ${LIBRARY_DIR})

View File

@ -83,7 +83,7 @@ list (APPEND dbms_headers
list (APPEND dbms_sources src/TableFunctions/ITableFunction.cpp src/TableFunctions/TableFunctionFactory.cpp)
list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h)
add_library(clickhouse_common_io ${SPLIT_SHARED} ${clickhouse_common_io_headers} ${clickhouse_common_io_sources})
add_library(clickhouse_common_io ${LINK_MODE} ${clickhouse_common_io_headers} ${clickhouse_common_io_sources})
if (OS_FREEBSD)
target_compile_definitions (clickhouse_common_io PUBLIC CLOCK_MONOTONIC_COARSE=CLOCK_MONOTONIC_FAST)
@ -96,7 +96,7 @@ if (MAKE_STATIC_LIBRARIES)
add_library(dbms ${dbms_headers} ${dbms_sources})
else ()
add_library(dbms SHARED ${dbms_headers} ${dbms_sources})
set_target_properties (dbms PROPERTIES SOVERSION ${VERSION_MAJOR} VERSION ${VERSION_SO} OUTPUT_NAME clickhouse)
set_target_properties (dbms PROPERTIES SOVERSION ${VERSION_MAJOR}.${VERSION_MINOR} VERSION ${VERSION_SO} OUTPUT_NAME clickhouse)
install (TARGETS dbms LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT clickhouse)
endif ()

View File

@ -1,4 +1,4 @@
add_library (clickhouse-benchmark-lib ${SPLIT_SHARED} Benchmark.cpp)
add_library (clickhouse-benchmark-lib ${LINK_MODE} Benchmark.cpp)
target_link_libraries (clickhouse-benchmark-lib clickhouse-client-lib clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_include_directories (clickhouse-benchmark-lib SYSTEM PRIVATE ${PCG_RANDOM_INCLUDE_DIR})

View File

@ -1,4 +1,4 @@
add_library (clickhouse-compressor-lib ${SPLIT_SHARED} Compressor.cpp)
add_library (clickhouse-compressor-lib ${LINK_MODE} Compressor.cpp)
target_link_libraries (clickhouse-compressor-lib clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (CLICKHOUSE_SPLIT_BINARY)

View File

@ -1,4 +1,4 @@
add_library (clickhouse-extract-from-config-lib ${SPLIT_SHARED} ExtractFromConfig.cpp)
add_library (clickhouse-extract-from-config-lib ${LINK_MODE} ExtractFromConfig.cpp)
target_link_libraries (clickhouse-extract-from-config-lib clickhouse_common_config clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (CLICKHOUSE_SPLIT_BINARY)

View File

@ -1,4 +1,4 @@
add_library (clickhouse-format-lib ${SPLIT_SHARED} Format.cpp)
add_library (clickhouse-format-lib ${LINK_MODE} Format.cpp)
target_link_libraries (clickhouse-format-lib dbms clickhouse_common_io ${Boost_PROGRAM_OPTIONS_LIBRARY})
if (CLICKHOUSE_SPLIT_BINARY)
add_executable (clickhouse-format clickhouse-format.cpp)

View File

@ -1,4 +1,4 @@
add_library (clickhouse-performance-test-lib ${SPLIT_SHARED} PerformanceTest.cpp)
add_library (clickhouse-performance-test-lib ${LINK_MODE} PerformanceTest.cpp)
target_link_libraries (clickhouse-performance-test-lib clickhouse_common_io dbms ${Boost_PROGRAM_OPTIONS_LIBRARY})
target_include_directories (clickhouse-performance-test-lib SYSTEM PRIVATE ${PCG_RANDOM_INCLUDE_DIR})

View File

@ -1,6 +1,6 @@
# TODO: make separate lib datastream, block, ...
#include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
#add_headers_and_sources(clickhouse_client .)
#add_library(clickhouse_client ${SPLIT_SHARED} ${clickhouse_client_headers} ${clickhouse_client_sources})
#add_library(clickhouse_client ${LINK_MODE} ${clickhouse_client_headers} ${clickhouse_client_sources})
#target_link_libraries (clickhouse_client clickhouse_common_io ${Poco_Net_LIBRARY})
#target_include_directories (clickhouse_client PRIVATE ${DBMS_INCLUDE_DIR})

View File

@ -3,7 +3,7 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
add_headers_and_sources(clickhouse_common_config .)
add_library(clickhouse_common_config ${SPLIT_SHARED} ${clickhouse_common_config_headers} ${clickhouse_common_config_sources})
add_library(clickhouse_common_config ${LINK_MODE} ${clickhouse_common_config_headers} ${clickhouse_common_config_sources})
target_link_libraries (clickhouse_common_config clickhouse_common_zookeeper string_utils)
target_include_directories (clickhouse_common_config PRIVATE ${DBMS_INCLUDE_DIR})

View File

@ -5,5 +5,5 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
add_headers_and_sources(clickhouse_common_stringutils .)
add_library(string_utils ${SPLIT_SHARED} ${clickhouse_common_stringutils_headers} ${clickhouse_common_stringutils_sources})
add_library(string_utils ${LINK_MODE} ${clickhouse_common_stringutils_headers} ${clickhouse_common_stringutils_sources})
target_include_directories (string_utils PRIVATE ${DBMS_INCLUDE_DIR})

View File

@ -2,7 +2,7 @@ include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
add_headers_and_sources(clickhouse_common_zookeeper .)
add_library(clickhouse_common_zookeeper ${SPLIT_SHARED} ${clickhouse_common_zookeeper_headers} ${clickhouse_common_zookeeper_sources})
add_library(clickhouse_common_zookeeper ${LINK_MODE} ${clickhouse_common_zookeeper_headers} ${clickhouse_common_zookeeper_sources})
target_link_libraries (clickhouse_common_zookeeper clickhouse_common_io)

View File

@ -1,6 +1,6 @@
include(${ClickHouse_SOURCE_DIR}/cmake/dbms_glob_sources.cmake)
add_headers_and_sources(clickhouse_parsers .)
add_library(clickhouse_parsers ${SPLIT_SHARED} ${clickhouse_parsers_headers} ${clickhouse_parsers_sources})
add_library(clickhouse_parsers ${LINK_MODE} ${clickhouse_parsers_headers} ${clickhouse_parsers_sources})
target_link_libraries (clickhouse_parsers clickhouse_common_io)
target_include_directories (clickhouse_parsers PUBLIC ${DBMS_INCLUDE_DIR})

View File

@ -10,7 +10,7 @@ if (DEFINED APPLE_HAVE_CLOCK_GETTIME)
target_compile_definitions(apple_rt PUBLIC -DAPPLE_HAVE_CLOCK_GETTIME=${APPLE_HAVE_CLOCK_GETTIME})
endif ()
add_library (common ${SPLIT_SHARED}
add_library (common ${LINK_MODE}
src/DateLUT.cpp
src/DateLUTImpl.cpp
src/preciseExp10.c

View File

@ -1,4 +1,4 @@
add_library (daemon ${SPLIT_SHARED}
add_library (daemon ${LINK_MODE}
src/BaseDaemon.cpp
src/GraphiteWriter.cpp
src/ExtendedLogChannel.cpp

View File

@ -1,4 +1,4 @@
add_library (mysqlxx ${SPLIT_SHARED}
add_library (mysqlxx ${LINK_MODE}
src/Connection.cpp
src/Exception.cpp
src/Query.cpp

View File

@ -1,4 +1,4 @@
add_library (pocoext ${SPLIT_SHARED}
add_library (pocoext ${LINK_MODE}
src/LevelFilterChannel.cpp
src/ThreadNumber.cpp
src/SessionPoolHelpers.cpp

View File

@ -6,20 +6,30 @@
# curl https://raw.githubusercontent.com/yandex/ClickHouse/master/utils/build/build_debian.sh | sh
# install compiler and libs
sudo apt install -y git bash cmake gcc-7 g++-7 libicu-dev libreadline-dev
sudo apt install -y git bash cmake ninja-build gcc-7 g++-7 libicu-dev libreadline-dev
# for -DUNBUNDLED=1 mode:
#sudo apt install -y libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev zlib1g-dev liblz4-dev libdouble-conversion-dev libzstd-dev libre2-dev libsparsehash-dev librdkafka-dev libcapnp-dev libpoco-dev libsparsehash-dev libgoogle-perftools-dev libunwind-dev googletest libcctz-dev
# install testing only stuff if you want:
sudo apt install -y python python-lxml python-termcolor python-requests curl perl
sudo apt install -y expect python python-lxml python-termcolor python-requests curl perl sudo openssl netcat-openbsd telnet
# Checkout ClickHouse sources
git clone --recursive https://github.com/yandex/ClickHouse.git
BASE_DIR=$(dirname $0) && [ -f "$BASE_DIR/../../CMakeLists.txt" ] && ROOT_DIR=$BASE_DIR/../.. && cd $ROOT_DIR
if [ -z $ROOT_DIR ]; then
# Checkout ClickHouse sources
git clone --recursive https://github.com/yandex/ClickHouse.git
cd ClickHouse
fi
# Build!
mkdir -p ClickHouse/build
cd ClickHouse/build
cmake .. -DCMAKE_CXX_COMPILER=`which g++-7` -DCMAKE_C_COMPILER=`which gcc-7`
make -j $(nproc || sysctl -n hw.ncpu || echo 2)
mkdir -p build
cd build
cmake .. -DCMAKE_CXX_COMPILER=`which g++-7 g++-8 | head -n1` -DCMAKE_C_COMPILER=`which gcc-7 gcc-8 | head -n1`
cmake --build .
cd ..
# Run server:
# build/dbms/programs/clickhouse-server --config-file=ClickHouse/dbms/programs/server/config.xml &
# Run client:
# build/dbms/programs/clickhouse-client

View File

@ -18,9 +18,9 @@ env TEST_RUN=1 \
TEST_OPT="--skip long compile 00416 $TEST_OPT" \
TEST_TRUE=false \
DH_VERBOSE=1 \
CMAKE_FLAGS="-DUNBUNDLED=1 $CMAKE_FLAGS" \
CMAKE_FLAGS="-DUNBUNDLED=1 -DUSE_STATIC_LIBRARIES=0 $CMAKE_FLAGS" \
`# Use all possible contrib libs from system` \
`# psmisc - killall` \
`# gdb - symbol test in pbuilder` \
EXTRAPACKAGES="psmisc gdb clang-6.0 libc++abi-dev libc++-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev zlib1g-dev liblz4-dev libdouble-conversion-dev libsparsehash-dev librdkafka-dev libpoco-dev libsparsehash-dev libgoogle-perftools-dev libzstd-dev libre2-dev libunwind-dev googletest libcctz-dev $EXTRAPACKAGES" \
EXTRAPACKAGES="psmisc gdb clang-6.0 libc++abi-dev libc++-dev libboost-program-options-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev zlib1g-dev liblz4-dev libdouble-conversion-dev libsparsehash-dev librdkafka-dev libpoco-dev unixodbc-dev libsparsehash-dev libgoogle-perftools-dev libzstd-dev libre2-dev libunwind-dev googletest libcctz-dev libcapnp-dev libjemalloc-dev libssl-dev $EXTRAPACKAGES" \
pdebuild --configfile $ROOT_DIR/debian/.pbuilderrc $PDEBUILD_OPT

View File

@ -15,11 +15,12 @@
# Variant 3: Manual build:
# pkg install -y curl sudo
# curl https://raw.githubusercontent.com/yandex/ClickHouse/master/utils/build/build_freebsd.sh | sh
# install compiler and libs
sudo pkg install devel/git devel/cmake shells/bash devel/icu devel/libltdl databases/unixODBC devel/google-perftools devel/libdouble-conversion archivers/zstd archivers/liblz4 devel/sparsehash devel/re2
sudo pkg install devel/git devel/cmake devel/ninja shells/bash devel/icu devel/libltdl databases/unixODBC devel/google-perftools devel/libdouble-conversion archivers/zstd archivers/liblz4 devel/sparsehash devel/re2
# install testing only stuff if you want:
sudo pkg install lang/python devel/py-lxml devel/py-termcolor www/py-requests ftp/curl perl5
@ -27,20 +28,23 @@ sudo pkg install lang/python devel/py-lxml devel/py-termcolor www/py-requests ft
# If you want ODBC support: Check UNIXODBC option:
# make -C /usr/ports/devel/poco config reinstall
# Checkout ClickHouse sources
git clone --recursive https://github.com/yandex/ClickHouse.git
BASE_DIR=$(dirname $0) && [ -f "$BASE_DIR/../../CMakeLists.txt" ] && ROOT_DIR=$BASE_DIR/../.. && cd $ROOT_DIR
if [ -z $ROOT_DIR ]; then
# Checkout ClickHouse sources
git clone --recursive https://github.com/yandex/ClickHouse.git
cd ClickHouse
fi
# Build!
mkdir -p ClickHouse/build
cd ClickHouse/build
mkdir -p build
cd build
cmake .. -DUNBUNDLED=1 -DUSE_STATIC_LIBRARIES=0
# build with boost 1.64 from ports temporary broken
make clickhouse-bundle -j $(nproc || sysctl -n hw.ncpu || echo 2)
cd ../..
cmake --build .
cd ..
# Run server:
# ClickHouse/build/dbms/programs/clickhouse-server --config-file=ClickHouse/dbms/programs/server/config.xml &
# build/dbms/programs/clickhouse-server --config-file=ClickHouse/dbms/programs/server/config.xml &
# Run client:
# ClickHouse/build/dbms/programs/clickhouse-client
# build/dbms/programs/clickhouse-client

View File

@ -12,15 +12,19 @@ fi
## Install required compilers, tools, libraries
brew install cmake gcc icu4c mariadb-connector-c openssl unixodbc libtool gettext readline librdkafka
brew install cmake ninja gcc icu4c mariadb-connector-c openssl unixodbc libtool gettext readline librdkafka
## Checkout ClickHouse sources
# To get the latest stable version:
git clone -b stable --recursive --depth=10 https://github.com/yandex/ClickHouse.git
BASE_DIR=$(dirname $0) && [ -f "$BASE_DIR/../../CMakeLists.txt" ] && ROOT_DIR=$BASE_DIR/../.. && cd $ROOT_DIR
cd ClickHouse
if [ -z $ROOT_DIR ]; then
# Checkout ClickHouse sources
git clone -b stable --recursive https://github.com/yandex/ClickHouse.git
cd ClickHouse
fi
# For development, switch to the `master` branch.
# For the latest release candidate, switch to the `testing` branch.
@ -30,15 +34,15 @@ cd ClickHouse
mkdir build
cd build
cmake .. -DCMAKE_CXX_COMPILER=`which g++-8 g++-7` -DCMAKE_C_COMPILER=`which gcc-8 gcc-7`
make -j `sysctl -n hw.ncpu`
cmake --build .
cd ../..
cd ..
# Run server:
# ClickHouse/build/dbms/programs/clickhouse-server --config-file=ClickHouse/dbms/programs/server/config.xml &
# build/dbms/programs/clickhouse-server --config-file=ClickHouse/dbms/programs/server/config.xml &
# Run client:
# ClickHouse/build/dbms/programs/clickhouse-client
# build/dbms/programs/clickhouse-client
## Caveats