mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Fix freebsd build. Little cmake fixes. (#1634)
This commit is contained in:
parent
4a51a7bb22
commit
741117a390
@ -54,8 +54,9 @@ endif ()
|
||||
|
||||
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wall") # -Werror is also added inside directories with our own code.
|
||||
set (CXX_WARNING_FLAGS "${CXX_WARNING_FLAGS} -Wnon-virtual-dtor")
|
||||
if (CCACHE_FOUND AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# clang-6.0: warning: argument unused during compilation: '-stdlib=libc++'
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
# clang: warning: argument unused during compilation: '-stdlib=libc++'
|
||||
# clang: warning: argument unused during compilation: '-specs=/usr/share/dpkg/no-pie-compile.specs' [-Wunused-command-line-argument]
|
||||
set (CXX_WARNING_FLAGS "${CXX_WARNING_FLAGS} -Wno-unused-command-line-argument")
|
||||
endif ()
|
||||
|
||||
@ -258,6 +259,7 @@ include (cmake/find_poco.cmake)
|
||||
include (cmake/find_lz4.cmake)
|
||||
include (cmake/find_sparsehash.cmake)
|
||||
include (cmake/find_rt.cmake)
|
||||
include (cmake/find_execinfo.cmake)
|
||||
include (cmake/find_readline_edit.cmake)
|
||||
include (cmake/find_zookeeper.cmake)
|
||||
include (cmake/find_re2.cmake)
|
||||
|
6
cmake/find_execinfo.cmake
Normal file
6
cmake/find_execinfo.cmake
Normal file
@ -0,0 +1,6 @@
|
||||
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
||||
find_library (EXECINFO_LIBRARY execinfo)
|
||||
message (STATUS "Using execinfo: ${EXECINFO_LIBRARY}")
|
||||
else ()
|
||||
set (EXECINFO_LIBRARY "")
|
||||
endif ()
|
@ -15,10 +15,14 @@ if (USE_EMBEDDED_COMPILER)
|
||||
# llvm_map_components_to_libraries - Maps LLVM used components to required libraries.
|
||||
# Usage: llvm_map_components_to_libraries(REQUIRED_LLVM_LIBRARIES core jit interpreter native ...)
|
||||
|
||||
set(LLVM_VERSION_POSTFIX "-5.0" CACHE INTERNAL "")
|
||||
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
||||
set(LLVM_VERSION_POSTFIX "50" CACHE INTERNAL "")
|
||||
else()
|
||||
set(LLVM_VERSION_POSTFIX "-5.0" CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
find_program(LLVM_CONFIG_EXECUTABLE
|
||||
NAMES llvm-config${LLVM_VERSION_POSTFIX} llvm-config
|
||||
NAMES llvm-config${LLVM_VERSION_POSTFIX} llvm-config llvm-config-devel
|
||||
PATHS $ENV{LLVM_ROOT}/bin)
|
||||
|
||||
mark_as_advanced(LLVM_CONFIG_EXECUTABLE)
|
||||
@ -35,7 +39,7 @@ if (USE_EMBEDDED_COMPILER)
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
if(LLVM_VERSION VERSION_LESS "5")
|
||||
message(FATAL_ERROR "LLVM 5+ is required.")
|
||||
message(FATAL_ERROR "LLVM 5+ is required. You have ${LLVM_VERSION} (${LLVM_CONFIG_EXECUTABLE})")
|
||||
endif()
|
||||
|
||||
message(STATUS "LLVM config: ${LLVM_CONFIG_EXECUTABLE}; version: ${LLVM_VERSION}")
|
||||
@ -75,7 +79,7 @@ if (USE_EMBEDDED_COMPILER)
|
||||
|
||||
string(REPLACE " " ";" _libs_module "${_tmp}")
|
||||
|
||||
message(STATUS "LLVM Libraries for '${ARGN}': ${_libs_module}")
|
||||
#message(STATUS "LLVM Libraries for '${ARGN}': ${_libs_module}")
|
||||
|
||||
execute_process(
|
||||
COMMAND ${LLVM_CONFIG_EXECUTABLE} --system-libs ${ARGN}
|
||||
|
@ -1,11 +1,11 @@
|
||||
if (APPLE)
|
||||
# lib from libs/libcommon
|
||||
set (RT_LIBRARIES "apple_rt")
|
||||
set (RT_LIBRARY "apple_rt")
|
||||
else ()
|
||||
find_library (RT_LIBRARIES rt)
|
||||
find_library (RT_LIBRARY rt)
|
||||
endif ()
|
||||
|
||||
message(STATUS "Using rt: ${RT_LIBRARIES}")
|
||||
message(STATUS "Using rt: ${RT_LIBRARY}")
|
||||
|
||||
function (target_link_rt_by_force TARGET)
|
||||
if (NOT APPLE)
|
||||
|
@ -149,12 +149,6 @@ if (NOT ARCH_ARM)
|
||||
set (LINK_LIBRARIES_ONLY_ON_X86_64 cpuid)
|
||||
endif()
|
||||
|
||||
if (CMAKE_SYSTEM MATCHES "FreeBSD")
|
||||
set(PLATFORM_LIBS "execinfo")
|
||||
else()
|
||||
set(PLATFORM_LIBS "")
|
||||
endif()
|
||||
|
||||
target_link_libraries (clickhouse_common_io
|
||||
common
|
||||
string_utils
|
||||
@ -164,7 +158,7 @@ target_link_libraries (clickhouse_common_io
|
||||
${ZOOKEEPER_LIBRARY}
|
||||
${DOUBLE_CONVERSION_LIBRARIES}
|
||||
${Poco_Net_LIBRARY}
|
||||
${PLATFORM_LIBS}
|
||||
${EXECINFO_LIBRARY}
|
||||
)
|
||||
|
||||
target_link_libraries (dbms
|
||||
|
@ -67,17 +67,19 @@ if (CLICKHOUSE_SPLIT_BINARY)
|
||||
add_executable (clickhouse-format clickhouse-format.cpp)
|
||||
target_link_libraries (clickhouse-format clickhouse-format-lib dbms)
|
||||
|
||||
set (CLICKHOUSE_ALL_TARGETS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-format)
|
||||
|
||||
if (USE_EMBEDDED_COMPILER)
|
||||
add_executable (clickhouse-clang clickhouse-clang.cpp)
|
||||
target_link_libraries (clickhouse-clang clickhouse-compiler-lib)
|
||||
add_executable (clickhouse-lld clickhouse-lld.cpp)
|
||||
target_link_libraries (clickhouse-lld clickhouse-compiler-lib)
|
||||
install (TARGETS clickhouse-clang clickhouse-lld RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
||||
list (APPEND CLICKHOUSE_ALL_TARGETS clickhouse-clang clickhouse-lld)
|
||||
endif ()
|
||||
|
||||
install (TARGETS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-format RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
||||
|
||||
add_custom_target (clickhouse ALL DEPENDS clickhouse-server clickhouse-client clickhouse-local clickhouse-benchmark clickhouse-performance-test clickhouse-extract-from-config clickhouse-compressor clickhouse-format)
|
||||
install (TARGETS clickhouse-server ${CLICKHOUSE_ALL_TARGETS} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
||||
add_custom_target (clickhouse-bundle ALL DEPENDS ${CLICKHOUSE_ALL_TARGETS})
|
||||
else ()
|
||||
add_executable (clickhouse main.cpp)
|
||||
target_include_directories (clickhouse BEFORE PRIVATE ${COMMON_INCLUDE_DIR})
|
||||
@ -97,7 +99,6 @@ else ()
|
||||
target_link_libraries (clickhouse clickhouse-compiler-lib)
|
||||
endif ()
|
||||
|
||||
|
||||
add_custom_target (clickhouse-server ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-server DEPENDS clickhouse)
|
||||
add_custom_target (clickhouse-client ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-client DEPENDS clickhouse)
|
||||
add_custom_target (clickhouse-local ALL COMMAND ${CMAKE_COMMAND} -E create_symlink clickhouse clickhouse-local DEPENDS clickhouse)
|
||||
@ -119,6 +120,8 @@ else ()
|
||||
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-clang
|
||||
${CMAKE_CURRENT_BINARY_DIR}/clickhouse-lld
|
||||
DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT clickhouse)
|
||||
|
||||
add_custom_target (clickhouse-bundle ALL DEPENDS clickhouse)
|
||||
endif ()
|
||||
|
||||
install (
|
||||
|
@ -12,6 +12,10 @@ llvm_map_components_to_libraries(REQUIRED_LLVM_LIBRARIES all)
|
||||
|
||||
# We link statically with zlib, and LLVM (sometimes) tries to bring its own dependency.
|
||||
list(REMOVE_ITEM REQUIRED_LLVM_LIBRARIES "-lz")
|
||||
# Wrong library in freebsd:
|
||||
list(REMOVE_ITEM REQUIRED_LLVM_LIBRARIES "-l/usr/lib/libexecinfo.so")
|
||||
|
||||
message(STATUS "Using libraries for LLVM: ${REQUIRED_LLVM_LIBRARIES}")
|
||||
|
||||
target_include_directories(clickhouse-compiler-lib PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||
|
||||
|
@ -12,6 +12,10 @@ llvm_map_components_to_libraries(REQUIRED_LLVM_LIBRARIES all)
|
||||
|
||||
# We link statically with zlib, and LLVM (sometimes) tries to bring its own dependency.
|
||||
list(REMOVE_ITEM REQUIRED_LLVM_LIBRARIES "-lz")
|
||||
# Wrong library in freebsd:
|
||||
list(REMOVE_ITEM REQUIRED_LLVM_LIBRARIES "-l/usr/lib/libexecinfo.so")
|
||||
|
||||
message(STATUS "Using libraries for LLVM: ${REQUIRED_LLVM_LIBRARIES}")
|
||||
|
||||
target_include_directories(clickhouse-compiler-lib PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||
|
||||
@ -19,7 +23,9 @@ target_include_directories(clickhouse-compiler-lib PRIVATE ${LLVM_INCLUDE_DIRS})
|
||||
|
||||
target_link_libraries(clickhouse-compiler-lib
|
||||
|
||||
clangBasic clangCodeGen clangDriver clangFrontend clangFrontendTool
|
||||
clangBasic clangCodeGen clangDriver
|
||||
clangFrontend
|
||||
clangFrontendTool
|
||||
clangRewriteFrontend clangARCMigrate clangStaticAnalyzerFrontend
|
||||
clangParse clangSerialization clangSema clangEdit clangStaticAnalyzerCheckers
|
||||
clangASTMatchers clangStaticAnalyzerCore clangAnalysis clangAST clangRewrite clangLex clangBasic
|
||||
|
2
debian/.pbuilderrc
vendored
2
debian/.pbuilderrc
vendored
@ -27,6 +27,8 @@
|
||||
# env EXTRAPACKAGES="liblld-5.0-dev libclang-5.0-dev liblld-5.0" CMAKE_FLAGS="-DUSE_EMBEDDED_COMPILER=1" DIST=artful pdebuild --configfile debian/.pbuilderrc
|
||||
# use only clang:
|
||||
# env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 env EXTRAPACKAGES="liblld-5.0 liblld-5.0-dev libclang-5.0-dev clang-5.0" CMAKE_FLAGS="-DNO_WERROR=1 -DUSE_EMBEDDED_COMPILER=1" DIST=artful pdebuild --configfile debian/.pbuilderrc
|
||||
# clang+asan:
|
||||
# env DEB_CC=clang-5.0 DEB_CXX=clang++-5.0 env EXTRAPACKAGES="liblld-5.0 liblld-5.0-dev libclang-5.0-dev clang-5.0" CMAKE_FLAGS="-DNO_WERROR=1 -DUSE_EMBEDDED_COMPILER=1 -DENABLE_TCMALLOC=0 -DENABLE_UNWIND=0 -DCMAKE_BUILD_TYPE=Asan" DIST=artful pdebuild --configfile debian/.pbuilderrc
|
||||
|
||||
# Your packages built here: /var/cache/pbuilder/*-*/result
|
||||
|
||||
|
@ -99,7 +99,7 @@ target_link_libraries (
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${MALLOC_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${RT_LIBRARIES}
|
||||
${RT_LIBRARY}
|
||||
${GLIBC_COMPATIBILITY_LIBRARIES}
|
||||
${MEMCPY_LIBRARIES})
|
||||
|
||||
|
@ -14,8 +14,8 @@ target_link_libraries (date_lut2 common ${PLATFORM_LIBS})
|
||||
target_link_libraries (date_lut3 common ${PLATFORM_LIBS})
|
||||
target_link_libraries (date_lut4 common ${PLATFORM_LIBS})
|
||||
target_link_libraries (date_lut_default_timezone common ${PLATFORM_LIBS})
|
||||
target_link_libraries (multi_version common ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${RT_LIBRARIES})
|
||||
target_link_libraries (multi_version common ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${RT_LIBRARY})
|
||||
|
||||
add_executable (unit_tests_libcommon gtest_json_test.cpp gtest_strong_typedef.cpp)
|
||||
target_link_libraries (unit_tests_libcommon gtest_main common ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${RT_LIBRARIES})
|
||||
target_link_libraries (unit_tests_libcommon gtest_main common ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${RT_LIBRARY})
|
||||
add_check(unit_tests_libcommon)
|
||||
|
@ -17,4 +17,4 @@ endif ()
|
||||
target_include_directories (daemon PUBLIC include)
|
||||
target_include_directories (daemon PRIVATE ${ClickHouse_SOURCE_DIR}/libs/libpocoext/include)
|
||||
|
||||
target_link_libraries (daemon dbms)
|
||||
target_link_libraries (daemon clickhouse_common_io ${EXECINFO_LIBRARY})
|
||||
|
@ -2,6 +2,6 @@
|
||||
add_executable (mysqlxx_test mysqlxx_test.cpp)
|
||||
add_executable (failover failover.cpp)
|
||||
|
||||
target_link_libraries (mysqlxx_test mysqlxx ${RT_LIBRARIES})
|
||||
target_link_libraries (mysqlxx_test mysqlxx ${RT_LIBRARY})
|
||||
target_link_libraries (failover mysqlxx ${Poco_Util_LIBRARY} ${Poco_Foundation_LIBRARY})
|
||||
target_link_rt_by_force (failover)
|
||||
|
Loading…
Reference in New Issue
Block a user