This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git


The following commit(s) were added to refs/heads/master by this push:
     new 1489f81  [tools] OSX tc_malloc fix
1489f81 is described below

commit 1489f817371ca7b7a1ed5ee3501f1089a888d73c
Author: Zoltan Chovan <[email protected]>
AuthorDate: Tue Jan 25 21:38:33 2022 +0100

    [tools] OSX tc_malloc fix
    
    Starting with Monterey protobuf related build actions fail due to a
    missing implementation of free_definite_size in tc_malloc for OSX.
    
    Upstream issue and fix:
    https://github.com/gperftools/gperftools/issues/1312
    https://github.com/gperftools/gperftools/pull/1315
    
https://github.com/gperftools/gperftools/commit/852fb6df031560c5e353b497222b76394190e27d
    
    Added new patchfile for gperftools and changed download-thirdparty.sh
    accordingly.
    
    Change-Id: Iae7719b233083616e21e5822d4f682efc324ec40
    Reviewed-on: http://gerrit.cloudera.org:8080/18172
    Reviewed-by: Attila Bukor <[email protected]>
    Tested-by: Attila Bukor <[email protected]>
    Reviewed-by: Alexey Serbin <[email protected]>
---
 thirdparty/download-thirdparty.sh                  |  3 +-
 .../patches/gperftools-tcmalloc-osx-fix.patch      | 41 ++++++++++++++++++++++
 2 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/thirdparty/download-thirdparty.sh 
b/thirdparty/download-thirdparty.sh
index 4c14397..aa095ed 100755
--- a/thirdparty/download-thirdparty.sh
+++ b/thirdparty/download-thirdparty.sh
@@ -193,12 +193,13 @@ fetch_and_patch \
  $GFLAGS_SOURCE \
  $GFLAGS_PATCHLEVEL
 
-GPERFTOOLS_PATCHLEVEL=2
+GPERFTOOLS_PATCHLEVEL=3
 fetch_and_patch \
  gperftools-${GPERFTOOLS_VERSION}.tar.gz \
  $GPERFTOOLS_SOURCE \
  $GPERFTOOLS_PATCHLEVEL \
  "patch -p1 < 
$TP_DIR/patches/gperftools-Replace-namespace-base-with-namespace-tcmalloc.patch"
 \
+ "patch -p1 < $TP_DIR/patches/gperftools-tcmalloc-osx-fix.patch" \
  "autoreconf -fvi"
 
 # NOTE: creating an empty 'third_party/googletest/m4' subdir is a recipe from
diff --git a/thirdparty/patches/gperftools-tcmalloc-osx-fix.patch 
b/thirdparty/patches/gperftools-tcmalloc-osx-fix.patch
new file mode 100644
index 0000000..04a1085
--- /dev/null
+++ b/thirdparty/patches/gperftools-tcmalloc-osx-fix.patch
@@ -0,0 +1,41 @@
+From 852fb6df031560c5e353b497222b76394190e27d Mon Sep 17 00:00:00 2001
+From: Natale Patriciello <[email protected]>
+Date: Thu, 18 Nov 2021 18:16:40 +0100
+Subject: [PATCH] Implement free_definite_size
+
+In Monterey, it seems that free_definite_size is required (despite
+the documentation saying that is optional). The implementation
+just forward the call to free.
+
+Signed-off-by: Natale Patriciello <[email protected]>
+---
+ src/libc_override_osx.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/libc_override_osx.h b/src/libc_override_osx.h
+index 9d5d611..a4c1dde 100644
+--- a/src/libc_override_osx.h
++++ b/src/libc_override_osx.h
+@@ -129,6 +129,10 @@ void mz_free(malloc_zone_t* zone, void* ptr) {
+   return tc_free(ptr);
+ }
+ 
++void mz_free_definite_size(malloc_zone_t* zone, void *ptr, size_t size) {
++  return tc_free(ptr);
++}
++
+ void* mz_realloc(malloc_zone_t* zone, void* ptr, size_t size) {
+   return tc_realloc(ptr, size);
+ }
+@@ -272,7 +276,7 @@ static void ReplaceSystemAlloc() {
+     MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+   // Switch to version 6 on OSX 10.6 to support memalign.
+   tcmalloc_zone.version = 6;
+-  tcmalloc_zone.free_definite_size = NULL;
++  tcmalloc_zone.free_definite_size = &mz_free_definite_size;
+   tcmalloc_zone.memalign = &mz_memalign;
+   tcmalloc_introspection.zone_locked = &mi_zone_locked;
+ 
+-- 
+2.30.2
+

Reply via email to