Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2022-09-12 16:23:42 +0300
committerBastien Montagne <bastien@blender.org>2022-09-12 16:23:42 +0300
commit16af35054dc75fbfaf4bfc365d7223d8fdb23f01 (patch)
treec09de5929d5c6b76c3b85d53a7604df72b45793c /intern/libc_compat
parentec2e866aee1fe2e755f29e2c5f7a57d34727c855 (diff)
GLibC Compat: Add deprecated memory hooks symbols removed from 2.34.
Starting from GLibC 2.34, deprecated `__malloc_hook` & co. have been removed from headers, while still present in the shared library itself. This means that it is no more possible to build Blender with USD 22.03 on recent linux systems. While USD 22.08 has a fix to this issue, it is unlikely to be upgraded for Blender 3.4, and definitely not for Blender 3.3. This commit ensures Blender can build with USD 22.03 and glibc >= 2.34. Ref.: T99618, https://devtalk.blender.org/t/building-blender-on-linux-using-glibc-2-34-raises-linking-errors-from-the-usd-library/24185 Patch by @brecht, many thanks.
Diffstat (limited to 'intern/libc_compat')
-rw-r--r--intern/libc_compat/libc_compat.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/intern/libc_compat/libc_compat.c b/intern/libc_compat/libc_compat.c
index 5b969d80501..626490aa8e2 100644
--- a/intern/libc_compat/libc_compat.c
+++ b/intern/libc_compat/libc_compat.c
@@ -12,6 +12,7 @@
#ifdef __linux__
# include <features.h>
# include <math.h>
+# include <stdlib.h>
# if defined(__GLIBC_PREREQ)
# if __GLIBC_PREREQ(2, 31)
@@ -114,5 +115,15 @@ float __powf_finite(float x, float y)
}
# endif /* __GLIBC_PREREQ(2, 31) */
-# endif /* __GLIBC_PREREQ */
-#endif /* __linux__ */
+
+# if __GLIBC_PREREQ(2, 34)
+
+void *(*__malloc_hook)(size_t __size, const void *) = NULL;
+void *(*__realloc_hook)(void *__ptr, size_t __size, const void *) = NULL;
+void *(*__memalign_hook)(size_t __alignment, size_t __size, const void *) = NULL;
+void (*__free_hook)(void *__ptr, const void *) = NULL;
+
+# endif /* __GLIBC_PREREQ(2, 34) */
+
+# endif /* __GLIBC_PREREQ */
+#endif /* __linux__ */