mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
4c043301e6
This will fix with issues like this [1]:
Aug 12 09:58:44 '/usr/bin/cmake' '--build' '/build/build_docker/native' '--target' 'pre_compressor'
Aug 12 09:58:44 sccache: error: Server startup failed: cache storage failed to read: Unexpected (temporary) at stat
Aug 12 09:58:45 ninja: build stopped: subcommand failed.
Aug 12 09:58:45 -- Configuring done (77.7s)
Aug 12 09:58:47 -- Generating done (1.8s)
Aug 12 09:58:47 -- Build files have been written to: /build/build_docker
So as you can see even if ninja fails it still wrote build files, while
it should fail.
[1]: https://s3.amazonaws.com/clickhouse-test-reports/64955/0af41e32a5822d25ac3760f1ebb2313557474701/builds/report.html
[2]: 0af41e32a5/binary_darwin_aarch64/build_log.log
Note, COMMAND_ERROR_IS_FATAL is 3.19+, and the requirement for now is
3.20
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
48 lines
1.8 KiB
CMake
48 lines
1.8 KiB
CMake
set (DEFAULT_LIBS "-nodefaultlibs")
|
|
|
|
if (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
|
|
set(system_processor "x86_64")
|
|
else ()
|
|
set(system_processor "${CMAKE_SYSTEM_PROCESSOR}")
|
|
endif ()
|
|
|
|
file(GLOB bprefix "/usr/local/llvm${COMPILER_VERSION_MAJOR}/lib/clang/${COMPILER_VERSION_MAJOR}/lib/${system_processor}-portbld-freebsd*/")
|
|
message(STATUS "-Bprefix: ${bprefix}")
|
|
|
|
execute_process(COMMAND
|
|
${CMAKE_CXX_COMPILER} -Bprefix=${bprefix} --print-file-name=libclang_rt.builtins-${system_processor}.a
|
|
OUTPUT_VARIABLE BUILTINS_LIBRARY
|
|
COMMAND_ERROR_IS_FATAL ANY
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
# --print-file-name simply prints what you passed in case of nothing was resolved, so let's try one other possible option
|
|
if (BUILTINS_LIBRARY STREQUAL "libclang_rt.builtins-${system_processor}.a")
|
|
execute_process(COMMAND
|
|
${CMAKE_CXX_COMPILER} -Bprefix=${bprefix} --print-file-name=libclang_rt.builtins.a
|
|
OUTPUT_VARIABLE BUILTINS_LIBRARY
|
|
COMMAND_ERROR_IS_FATAL ANY
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
endif()
|
|
if (BUILTINS_LIBRARY STREQUAL "libclang_rt.builtins.a")
|
|
message(FATAL_ERROR "libclang_rt.builtins had not been found")
|
|
endif()
|
|
|
|
set (DEFAULT_LIBS "${DEFAULT_LIBS} ${BUILTINS_LIBRARY} ${COVERAGE_OPTION} -lc -lm -lrt -lpthread")
|
|
|
|
message(STATUS "Default libraries: ${DEFAULT_LIBS}")
|
|
|
|
set(CMAKE_CXX_STANDARD_LIBRARIES ${DEFAULT_LIBS})
|
|
set(CMAKE_C_STANDARD_LIBRARIES ${DEFAULT_LIBS})
|
|
|
|
# Unfortunately '-pthread' doesn't work with '-nodefaultlibs'.
|
|
# Just make sure we have pthreads at all.
|
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
find_package(Threads REQUIRED)
|
|
|
|
include (cmake/unwind.cmake)
|
|
include (cmake/cxx.cmake)
|
|
link_libraries(global-group)
|
|
|
|
target_link_libraries(global-group INTERFACE
|
|
$<TARGET_PROPERTY:global-libs,INTERFACE_LINK_LIBRARIES>
|
|
)
|