Updating poco and making submodule (#1263)

* Updating poco part 1: use submodule

* switch to tmp submodule

* update submodule

* wip

* wip

* wip

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* test

* wip

* wip

* wip

* wip

* wip

* wip

* Remove werror

* wip

* wip

* wip

* wip

* wip

* Block pipe signal

* Update poco

* Update and fix poco

* Better sigpipe handler

* Better block sigpipe

* Update BaseDaemon.cpp
This commit is contained in:
proller 2017-10-13 21:58:19 +03:00 committed by alexey-milovidov
parent fd072b58bb
commit 64194c9b03
10 changed files with 82 additions and 21 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "contrib/poco"]
path = contrib/poco
url = https://github.com/ClickHouse-Extras/poco
[submodule "contrib/zstd"]
path = contrib/zstd
url = https://github.com/facebook/zstd.git

View File

@ -19,7 +19,6 @@ if (NOT USE_INTERNAL_BOOST_LIBRARY)
endif ()
if (NOT Boost_SYSTEM_LIBRARY)
add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED)
set (USE_INTERNAL_BOOST_LIBRARY 1)
set (Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options_internal)
set (Boost_SYSTEM_LIBRARY boost_system_internal)

View File

@ -5,42 +5,55 @@ if (NOT USE_INTERNAL_POCO_LIBRARY)
endif ()
if (Poco_INCLUDE_DIRS AND Poco_Foundation_LIBRARY)
include_directories (${Poco_INCLUDE_DIRS})
#include_directories (${Poco_INCLUDE_DIRS})
else ()
set (USE_INTERNAL_POCO_LIBRARY 1)
include (${ClickHouse_SOURCE_DIR}/cmake/find_ltdl.cmake)
include (${ClickHouse_SOURCE_DIR}/contrib/libpoco/cmake/FindODBC.cmake)
set (ENABLE_ZIP 0 CACHE BOOL "")
set (ENABLE_PAGECOMPILER 0 CACHE BOOL "")
set (ENABLE_PAGECOMPILER_FILE2PAGE 0 CACHE BOOL "")
set (ENABLE_REDIS 0 CACHE BOOL "")
set (ENABLE_DATA_SQLITE 0 CACHE BOOL "")
set (ENABLE_DATA_MYSQL 0 CACHE BOOL "")
set (ENABLE_DATA_POSTGRESQL 0 CACHE BOOL "")
set (POCO_UNBUNDLED 1 CACHE BOOL "")
set (POCO_UNBUNDLED_PCRE 0 CACHE BOOL "")
set (POCO_UNBUNDLED_EXPAT 0 CACHE BOOL "")
set (POCO_STATIC ${MAKE_STATIC_LIBRARIES} CACHE BOOL "")
set (POCO_VERBOSE_MESSAGES 1 CACHE BOOL "")
include (${ClickHouse_SOURCE_DIR}/cmake/find_ltdl.cmake)
include (${ClickHouse_SOURCE_DIR}/contrib/poco/cmake/FindODBC.cmake)
# used in internal compiler
list (APPEND Poco_INCLUDE_DIRS
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Foundation/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Util/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Net/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/XML/include/"
"${ClickHouse_SOURCE_DIR}/contrib/poco/Foundation/include/"
"${ClickHouse_SOURCE_DIR}/contrib/poco/Util/include/"
)
if (NOT DEFINED POCO_ENABLE_MONGODB OR POCO_ENABLE_MONGODB)
set (Poco_MongoDB_FOUND 1)
set (Poco_MongoDB_LIBRARY PocoMongoDB)
list (APPEND Poco_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libpoco/MongoDB/include/")
set (Poco_MongoDB_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/poco/MongoDB/include/")
endif ()
if (ODBC_FOUND)
set (Poco_DataODBC_FOUND 1)
set (Poco_DataODBC_LIBRARY PocoDataODBC)
list (APPEND Poco_DataODBC_LIBRARY ${LTDL_LIB})
list (APPEND Poco_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/libpoco/Data/ODBC/include/")
if (USE_STATIC_LIBRARIES)
list (APPEND Poco_DataODBC_LIBRARY ${LTDL_LIB})
endif ()
set (Poco_DataODBC_INCLUDE_DIRS "${ClickHouse_SOURCE_DIR}/contrib/poco/Data/ODBC/include/")
endif ()
if (OPENSSL_FOUND)
set (Poco_NetSSL_FOUND 1)
set (Poco_NetSSL_LIBRARY PocoNetSSL)
set (Poco_Crypto_LIBRARY PocoCrypto)
list (APPEND Poco_INCLUDE_DIRS
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/NetSSL_OpenSSL/include/"
"${ClickHouse_SOURCE_DIR}/contrib/libpoco/Crypto/include/"
set (Poco_NetSSL_INCLUDE_DIRS
"${ClickHouse_SOURCE_DIR}/contrib/poco/NetSSL_OpenSSL/include/"
"${ClickHouse_SOURCE_DIR}/contrib/poco/Crypto/include/"
)
endif ()
@ -56,7 +69,23 @@ else ()
set (Poco_Net_LIBRARY PocoNet)
set (Poco_Data_LIBRARY PocoData)
set (Poco_XML_LIBRARY PocoXML)
include_directories (BEFORE ${Poco_INCLUDE_DIRS})
#include_directories (BEFORE ${Poco_INCLUDE_DIRS})
endif ()
message(STATUS "Using Poco: ${Poco_INCLUDE_DIRS} : ${Poco_Foundation_LIBRARY},${Poco_Util_LIBRARY},${Poco_Net_LIBRARY},${Poco_NetSSL_LIBRARY},${Poco_XML_LIBRARY},${Poco_Data_LIBRARY},${Poco_DataODBC_LIBRARY},${Poco_MongoDB_LIBRARY}; MongoDB=${Poco_MongoDB_FOUND}, DataODBC=${Poco_DataODBC_FOUND}, NetSSL=${Poco_NetSSL_FOUND}")
# How to make sutable poco:
# use branch:
# develop OR poco-1.7.9-release + 6a49c94d18c654d7a20b8c8ea47071b1fdd4813b
# and merge:
# ClickHouse-Extras/clickhouse_unbundled
# ClickHouse-Extras/clickhouse_unbundled_zlib
# ClickHouse-Extras/clickhouse_task # uses c++11, can't push to poco
# ClickHouse-Extras/clickhouse_misc
# ClickHouse-Extras/clickhouse_anl
# ClickHouse-Extras/clickhouse_http_header https://github.com/pocoproject/poco/pull/1574
# ClickHouse-Extras/clickhouse_socket
# ClickHouse-Extras/clickhouse_warning

View File

@ -6,8 +6,14 @@ endif ()
if (NOT ZLIB_FOUND)
set (USE_INTERNAL_ZLIB_LIBRARY 1)
set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng")
set (ZLIB_LIBRARIES zlibstatic)
set (ZLIB_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libzlib-ng" "${ClickHouse_BINARY_DIR}/contrib/libzlib-ng") # generated zconf.h
set (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR}) # for poco
set (ZLIB_FOUND 1) # for poco
if (USE_STATIC_LIBRARIES)
set (ZLIB_LIBRARIES zlibstatic)
else ()
set (ZLIB_LIBRARIES zlib)
endif ()
endif ()
message (STATUS "Using zlib: ${ZLIB_INCLUDE_DIR} : ${ZLIB_LIBRARIES}")

View File

@ -12,6 +12,10 @@ if (USE_INTERNAL_BOOST_LIBRARY)
list(APPEND dirs ${dirs1})
endif ()
if (USE_INTERNAL_POCO_LIBRARY)
list(APPEND dirs "./contrib/poco/Foundation/include")
endif ()
list(REMOVE_DUPLICATES dirs)
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/include_directories.txt "")
foreach (dir ${dirs})

View File

@ -4,9 +4,6 @@ if (USE_INTERNAL_BOOST_LIBRARY)
add_subdirectory (libboost)
endif ()
if (USE_INTERNAL_POCO_LIBRARY)
add_subdirectory (libpoco)
endif ()
if (USE_INTERNAL_LZ4_LIBRARY)
add_subdirectory (lz4-cmake)
@ -63,3 +60,12 @@ endif ()
if (NOT ARCH_ARM)
add_subdirectory (libcpuid)
endif ()
if (USE_INTERNAL_POCO_LIBRARY)
set (_save ${ENABLE_TESTS})
set (ENABLE_TESTS 0)
set (CMAKE_DISABLE_FIND_PACKAGE_ZLIB 1)
add_subdirectory (poco)
unset (CMAKE_DISABLE_FIND_PACKAGE_ZLIB)
set (ENABLE_TESTS ${_save})
endif ()

View File

@ -30,3 +30,7 @@ boost_1_65_0/libs/system/src/error_code.cpp)
target_include_directories (boost_program_options_internal BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
target_include_directories (boost_filesystem_internal BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
target_include_directories (boost_system_internal BEFORE PUBLIC ${Boost_INCLUDE_DIRS})
target_compile_definitions (boost_program_options_internal PUBLIC BOOST_SYSTEM_NO_DEPRECATED)
target_compile_definitions (boost_filesystem_internal PUBLIC BOOST_SYSTEM_NO_DEPRECATED)
target_compile_definitions (boost_system_internal PUBLIC BOOST_SYSTEM_NO_DEPRECATED)

View File

@ -74,3 +74,5 @@ endif ()
target_include_directories (tcmalloc_minimal_internal PUBLIC include)
target_include_directories (tcmalloc_minimal_internal PRIVATE src)
find_package (Threads)
target_link_libraries (tcmalloc_minimal_internal ${CMAKE_THREAD_LIBS_INIT})

1
contrib/poco vendored Submodule

@ -0,0 +1 @@
Subproject commit d28d05def4b7b701b56b9edb24e2f1bea880534b

View File

@ -812,6 +812,13 @@ void BaseDaemon::initialize(Application & self)
/// Ставим terminate_handler
std::set_terminate(terminate_handler);
/// We want to avoid SIGPIPE when working with sockets and pipes, and just handle return value/errno instead.
{
sigset_t sig_set;
if (sigemptyset(&sig_set) || sigaddset(&sig_set, SIGPIPE) || pthread_sigmask(SIG_BLOCK, &sig_set, nullptr))
throw Poco::Exception("Cannot block signal.");
}
/// Ставим обработчики сигналов
auto add_signal_handler =
[](const std::vector<int> & signals, signal_function handler)