diff options
author | Sergey Sharybin <sergey@blender.org> | 2022-09-13 11:34:41 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2022-09-13 11:38:42 +0300 |
commit | cca416cfe6c21ee9d0feb9d87995e505604b491e (patch) | |
tree | 3eae4def283cb01ec99c9275ff245d38990d63ba /intern | |
parent | 146e67b2bde8edd2b53ec5d0a9a30fa4046b5724 (diff) |
Fix compilation on Linux, glibc 2.34, and CentOS libraries
A continuation of previous fix for malloc hooks which got removed
from the new glibc library.
The pre-compiled jemalloc has definitions which interpose hooks
in glibc leading to linking errors with multiple hook definitions.
A simple fix is to skip doing the workaround when using jemalloc
from pre-compiled libraries.
This will likely be revisited in the future, but for now it is
important to fix compilation errors for developers.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/libc_compat/CMakeLists.txt | 6 | ||||
-rw-r--r-- | intern/libc_compat/libc_compat.c | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/intern/libc_compat/CMakeLists.txt b/intern/libc_compat/CMakeLists.txt index c318b3a303b..298d6f49bd9 100644 --- a/intern/libc_compat/CMakeLists.txt +++ b/intern/libc_compat/CMakeLists.txt @@ -18,3 +18,9 @@ set(LIB add_c_flag(-ffast-math) blender_add_lib(bf_intern_libc_compat "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") + +if(WITH_LIBC_MALLOC_HOOK_WORKAROUND) + target_compile_definitions(bf_intern_libc_compat + PRIVATE WITH_LIBC_MALLOC_HOOK_WORKAROUND + ) +endif() diff --git a/intern/libc_compat/libc_compat.c b/intern/libc_compat/libc_compat.c index 97e3f518c58..79efb1c009b 100644 --- a/intern/libc_compat/libc_compat.c +++ b/intern/libc_compat/libc_compat.c @@ -116,7 +116,7 @@ float __powf_finite(float x, float y) # endif /* __GLIBC_PREREQ(2, 31) */ -# if __GLIBC_PREREQ(2, 34) +# if __GLIBC_PREREQ(2, 34) && defined(WITH_LIBC_MALLOC_HOOK_WORKAROUND) extern void *(*__malloc_hook)(size_t __size, const void *); extern void *(*__realloc_hook)(void *__ptr, size_t __size, const void *); |