RLIMIT_RSS does not work since 2.6.x+, from getrlimit(2):
RLIMIT_RSS
This is a limit (in bytes) on the process's resident set (the number of virtual pages resident in RAM). This limit has effect only in Linux 2.4.x, x < 30, and there af‐
fects only calls to madvise(2) specifying MADV_WILLNEED.
Note that before this patch RSS was to 10MB but I doubt that it is
enough for C++ compiler, this patch uses 1G limit for DATA and 10G for
AS/VIRT (but it seems that even 1G may be too small).
And see also https://code.woboq.org/linux/linux/mm/mmap.c.html#may_expand_vm
Since libtsan.a provides new/delete overrides too:
ld.lld: error: duplicate symbol: operator new[](unsigned long, std::nothrow_t const&)
>>> defined at new_delete.cpp:64 (../src/Common/new_delete.cpp:64)
>>> new_delete.cpp.o:(operator new[](unsigned long, std::nothrow_t const&)) in archive src/libclickhouse_new_delete.a
>>> defined at tsan_new_delete.o:(.text+0xE0) in archive /usr/lib/gcc/x86_64-linux-gnu/10/libtsan.a
v2: Fix order of src vs programs for clickhouse_new_delete target detection
gcc with -nodefaultlibs does not add sanitizers library during linkage
with -static-libasan and similar, fix this, by add them explicitly.
From the gcc(1) about -nodefaultlibs:
Do not use the standard system libraries when linking. Only the
libraries you specify are passed to the linker, and options specifying
linkage of the system libraries, such as -static-libgcc or
-shared-libgcc, are ignored. The standard startup files are used
normally, unless -nostartfiles is used.
Plus checked it manually, w/o -nodefaultlibs everything works without
this explicit linkage.
After this patch UBSAN under gcc compiled successfully.
v2: freebsd and darwin
Yes clickhosue set gnu++2a globally, but this will not work, since
default -std=c++11 will be added later, look:
clang++ -std=gnu++2a ... -std=c++11 -Wall -Wextra contrib/llvm/...
Use -std=gnu++2a regardless of whether UNBUNDLED or not, because __int128
is a non-standard builtin and GCC, unlike Clang, only considers it to be
an integral type when GNU extensions are enabled.
Squashed:
- cmake: move USE_INTERNAL_POCO_LIBRARY option to separate file
- point contrib/poco to "add <atomic> to TCPServerDispatcher"
Signed-off-by: Konstantin Podshumok <kpp.live+signed@gmail.com>
Squashed:
- ENABLE_THINLTO shouldn't be enabled by default when tests or sanitizers are enabled
Signed-off-by: Konstantin Podshumok <kpp.live+signed@gmail.com>
This reverts commit 89419ceb9b
(curl part moved to separate commit)
Squashed:
- termcap removed
- fix for cassandra on apple merged
- cmake: fix "Can't find system zlib library" in unbundled build
- cmake: fix condition when testing for rdkafka platform
- cmake: PROTOBUF_OLD_ABI_COMPAT shouldn't be enabled for internal protobuf
Signed-off-by: Konstantin Podshumok <kpp.live+signed@gmail.com>
This will fix CMAKE_POLICY_DEFAULT_CMP0077 for snappy:
CMake Warning (dev) at contrib/snappy/CMakeLists.txt:11 (option):
Policy CMP0077 is not set: option() honors normal variables. Run
"cmake
--help-policy CMP0077" for policy details. Use the cmake_policy
command to
set the policy and suppress this warning.
For compatibility with older versions of CMake, option is clearing the
normal variable 'BUILD_SHARED_LIBS'.
This warning is for project developers. Use -Wno-dev to suppress it.
When you will try to link target with the directory (that exists), cmake will
skip this without an error, only the following warning will be reported:
target_link_libraries(main /tmp)
WARNING: Target "main" requests linking to directory "/tmp". Targets may link only to libraries. CMake is dropping the item.
And there is no cmake policy that controls this.
(I guess the reason that it is allowed is because of FRAMEWORK for OSX).
So to avoid error-prone cmake rules, this can be sanitized.
There are the following ways:
- overwrite target_link_libraries()/link_libraries() and check *before*
calling real macro, but this requires duplicate all supported syntax
-- too complex
- overwrite target_link_libraries() and check LINK_LIBRARIES property, this
works great
-- but cannot be used with link_libraries()
- use BUILDSYSTEM_TARGETS property to get list of all targets and sanitize
-- this will work.
I also tested it with the following patch:
$ git di
diff --git a/base/daemon/CMakeLists.txt b/base/daemon/CMakeLists.txt
index 26d59a57e7..35e6ff6432 100644
--- a/base/daemon/CMakeLists.txt
+++ b/base/daemon/CMakeLists.txt
@@ -9,4 +9,5 @@ target_link_libraries (daemon PUBLIC loggers PRIVATE clickhouse_common_io clickh
if (USE_SENTRY)
target_link_libraries (daemon PRIVATE ${SENTRY_LIBRARY})
+ target_link_libraries (daemon PRIVATE /tmp)
endif ()
And it works:
CMake Error at cmake/sanitize_target_link_libraries.cmake:48 (message):
daemon requested to link with directory: /tmp
Call Stack (most recent call first):
cmake/sanitize_target_link_libraries.cmake:55 (sanitize_link_libraries)
CMakeLists.txt:425 (include)
Refs: #12041