Freebsd fixes

This commit is contained in:
proller 2018-01-21 02:23:19 +03:00
parent ee8272561a
commit c430af5fb8
10 changed files with 25 additions and 16 deletions

View File

@ -17,9 +17,6 @@ else ()
message (WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang 5+ and GCC 7+.") message (WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang 5+ and GCC 7+.")
endif () endif ()
if (CMAKE_SYSTEM MATCHES "FreeBSD")
set (PLATFORM_EXTRA_CXX_FLAG "-DCLOCK_MONOTONIC_COARSE=CLOCK_MONOTONIC_FAST")
endif ()
# Write compile_commands.json # Write compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS 1) set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
@ -51,6 +48,13 @@ if ( ( ARCH_ARM AND NOT ARCH_AARCH64 ) OR ARCH_I386)
set (ARCH_32 1) set (ARCH_32 1)
message (WARNING "Support for 32bit platforms is highly experimental") message (WARNING "Support for 32bit platforms is highly experimental")
endif () endif ()
if (CMAKE_SYSTEM MATCHES "FreeBSD")
set (ARCH_FREEBSD 1)
endif ()
if (ARCH_FREEBSD)
set (PLATFORM_EXTRA_CXX_FLAG "-DCLOCK_MONOTONIC_COARSE=CLOCK_MONOTONIC_FAST")
endif ()
set (COMMON_WARNING_FLAGS "${COMMON_WARNING_FLAGS} -Wall") # -Werror is also added inside directories with our own code. 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") set (CXX_WARNING_FLAGS "${CXX_WARNING_FLAGS} -Wnon-virtual-dtor")
@ -154,7 +158,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_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}") set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3 -ggdb3 -fno-inline ${CMAKE_C_FLAGS_ADD}")
if (MAKE_STATIC_LIBRARIES AND NOT APPLE AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_SYSTEM MATCHES "FreeBSD")) if (MAKE_STATIC_LIBRARIES AND NOT APPLE AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND ARCH_FREEBSD))
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif () endif ()

View File

@ -1,4 +1,4 @@
if (CMAKE_SYSTEM MATCHES "FreeBSD") if (ARCH_FREEBSD)
find_library (EXECINFO_LIBRARY execinfo) find_library (EXECINFO_LIBRARY execinfo)
message (STATUS "Using execinfo: ${EXECINFO_LIBRARY}") message (STATUS "Using execinfo: ${EXECINFO_LIBRARY}")
else () else ()

View File

@ -15,7 +15,7 @@ if (USE_EMBEDDED_COMPILER)
# llvm_map_components_to_libraries - Maps LLVM used components to required libraries. # 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 ...) # Usage: llvm_map_components_to_libraries(REQUIRED_LLVM_LIBRARIES core jit interpreter native ...)
if (CMAKE_SYSTEM MATCHES "FreeBSD") if (ARCH_FREEBSD)
set(LLVM_VERSION_POSTFIX "50" CACHE INTERNAL "") set(LLVM_VERSION_POSTFIX "50" CACHE INTERNAL "")
else() else()
set(LLVM_VERSION_POSTFIX "-5.0" CACHE INTERNAL "") set(LLVM_VERSION_POSTFIX "-5.0" CACHE INTERNAL "")

View File

@ -13,12 +13,17 @@ endif ()
if (NOT USE_INTERNAL_RDKAFKA_LIBRARY) if (NOT USE_INTERNAL_RDKAFKA_LIBRARY)
find_library (RDKAFKA_LIB rdkafka) find_library (RDKAFKA_LIB rdkafka)
find_path (RDKAFKA_INCLUDE_DIR NAMES librdkafka/rdkafka.h PATHS ${RDKAFKA_INCLUDE_PATHS}) find_path (RDKAFKA_INCLUDE_DIR NAMES librdkafka/rdkafka.h PATHS ${RDKAFKA_INCLUDE_PATHS})
if (USE_STATIC_LIBRARIES AND NOT ARCH_FREEBSD)
find_library (SASL2_LIBRARY sasl2) find_library (SASL2_LIBRARY sasl2)
endif () endif ()
endif ()
if (RDKAFKA_LIB AND RDKAFKA_INCLUDE_DIR) if (RDKAFKA_LIB AND RDKAFKA_INCLUDE_DIR)
set (USE_RDKAFKA 1) set (USE_RDKAFKA 1)
set (RDKAFKA_LIBRARY ${RDKAFKA_LIB} ${OPENSSL_LIBRARIES} ${SASL2_LIBRARY}) set (RDKAFKA_LIBRARY ${RDKAFKA_LIB} ${OPENSSL_LIBRARIES})
if (SASL2_LIBRARY)
list (APPEND RDKAFKA_LIBRARY ${SASL2_LIBRARY})
endif ()
elseif (NOT MISSING_INTERNAL_RDKAFKA_LIBRARY) elseif (NOT MISSING_INTERNAL_RDKAFKA_LIBRARY)
set (USE_INTERNAL_RDKAFKA_LIBRARY 1) set (USE_INTERNAL_RDKAFKA_LIBRARY 1)
set (RDKAFKA_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/src") set (RDKAFKA_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/librdkafka/src")

View File

@ -8,7 +8,7 @@ if (NOT ZLIB_FOUND)
set (USE_INTERNAL_ZLIB_LIBRARY 1) set (USE_INTERNAL_ZLIB_LIBRARY 1)
set (ZLIB_COMPAT 1) # for zlib-ng, also enables WITH_GZFILEOP set (ZLIB_COMPAT 1) # for zlib-ng, also enables WITH_GZFILEOP
set (WITH_NATIVE_INSTRUCTIONS ${ARCHNATIVE}) set (WITH_NATIVE_INSTRUCTIONS ${ARCHNATIVE})
if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_I386) if (ARCH_FREEBSD OR ARCH_I386)
set (WITH_OPTIM 0 CACHE INTERNAL "") # Bug in assembler set (WITH_OPTIM 0 CACHE INTERNAL "") # Bug in assembler
endif () endif ()
if (ARCH_AARCH64) if (ARCH_AARCH64)

View File

@ -80,7 +80,7 @@ list (APPEND dbms_headers
list (APPEND dbms_sources src/TableFunctions/TableFunctionFactory.cpp) list (APPEND dbms_sources src/TableFunctions/TableFunctionFactory.cpp)
list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h) list (APPEND dbms_headers src/TableFunctions/ITableFunction.h src/TableFunctions/TableFunctionFactory.h)
if (APPLE OR CMAKE_SYSTEM MATCHES "FreeBSD") if (APPLE OR ARCH_FREEBSD)
list(REMOVE_ITEM clickhouse_common_io_headers list(REMOVE_ITEM clickhouse_common_io_headers
src/Common/AIO.h src/Common/AIO.h
src/IO/WriteBufferAIO.h src/IO/WriteBufferAIO.h

View File

@ -63,7 +63,7 @@ add_check (hashing_read_buffer)
add_executable (io_operators operators.cpp ${SRCS}) add_executable (io_operators operators.cpp ${SRCS})
target_link_libraries (io_operators clickhouse_common_io) target_link_libraries (io_operators clickhouse_common_io)
if (NOT APPLE AND NOT CMAKE_SYSTEM MATCHES "FreeBSD") if (NOT APPLE AND NOT ARCH_FREEBSD)
add_executable(write_buffer_aio write_buffer_aio.cpp) add_executable(write_buffer_aio write_buffer_aio.cpp)
target_link_libraries (write_buffer_aio clickhouse_common_io ${Boost_FILESYSTEM_LIBRARY}) target_link_libraries (write_buffer_aio clickhouse_common_io ${Boost_FILESYSTEM_LIBRARY})

View File

@ -1,5 +1,5 @@
if (CMAKE_SYSTEM MATCHES "FreeBSD") if (ARCH_FREEBSD)
set (PATH_SHARE "/usr/local/share" CACHE STRING "") set (PATH_SHARE "/usr/local/share" CACHE STRING "")
else () else ()
set (PATH_SHARE "/usr/share" CACHE STRING "") set (PATH_SHARE "/usr/share" CACHE STRING "")

View File

@ -1,10 +1,10 @@
if (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_32) if (ARCH_FREEBSD OR ARCH_32)
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" OFF) option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" OFF)
else () else ()
option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" ${NOT_UNBUNDLED}) option (USE_INTERNAL_GPERFTOOLS_LIBRARY "Set to FALSE to use system gperftools (tcmalloc) library instead of bundled" ${NOT_UNBUNDLED})
endif () endif ()
if (CMAKE_SYSTEM MATCHES "FreeBSD") if (ARCH_FREEBSD)
option (ENABLE_TCMALLOC "Set to TRUE to enable tcmalloc" OFF) option (ENABLE_TCMALLOC "Set to TRUE to enable tcmalloc" OFF)
else () else ()
option (ENABLE_TCMALLOC "Set to TRUE to enable tcmalloc" ON) option (ENABLE_TCMALLOC "Set to TRUE to enable tcmalloc" ON)
@ -18,7 +18,7 @@ if (ENABLE_TCMALLOC)
find_package (Gperftools) find_package (Gperftools)
endif () endif ()
if (NOT (GPERFTOOLS_FOUND AND GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_TCMALLOC_MINIMAL) AND NOT (CMAKE_SYSTEM MATCHES "FreeBSD" OR ARCH_32)) if (NOT (GPERFTOOLS_FOUND AND GPERFTOOLS_INCLUDE_DIR AND GPERFTOOLS_TCMALLOC_MINIMAL) AND NOT (ARCH_FREEBSD OR ARCH_32))
set (USE_INTERNAL_GPERFTOOLS_LIBRARY 1) set (USE_INTERNAL_GPERFTOOLS_LIBRARY 1)
set (GPERFTOOLS_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libtcmalloc/include") set (GPERFTOOLS_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/libtcmalloc/include")
set (GPERFTOOLS_TCMALLOC_MINIMAL tcmalloc_minimal_internal) set (GPERFTOOLS_TCMALLOC_MINIMAL tcmalloc_minimal_internal)

View File

@ -5,7 +5,7 @@ target_link_libraries (iotest clickhouse_common_io)
add_executable (iotest_nonblock iotest_nonblock.cpp ${SRCS}) add_executable (iotest_nonblock iotest_nonblock.cpp ${SRCS})
target_link_libraries (iotest_nonblock clickhouse_common_io) target_link_libraries (iotest_nonblock clickhouse_common_io)
if (NOT APPLE AND NOT CMAKE_SYSTEM MATCHES "FreeBSD") if (NOT APPLE AND NOT ARCH_FREEBSD)
add_executable (iotest_aio iotest_aio.cpp ${SRCS}) add_executable (iotest_aio iotest_aio.cpp ${SRCS})
target_link_libraries (iotest_aio clickhouse_common_io) target_link_libraries (iotest_aio clickhouse_common_io)
endif() endif()