rise-worlds / gperftools

Automatically exported from code.google.com/p/gperftools
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

build on Mac OS X 10.9 is broken #614

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

What steps will reproduce the problem?
1. ./autogen.sh
2. ./configure
3. make

What is the expected output? What do you see instead?
Output:

g++ -DHAVE_CONFIG_H -I. -I./src  -I./src   -D_THREAD_SAFE  -Wall 
-Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -fno-builtin-malloc 
-fno-builtin-free -fno-builtin-realloc -fno-builtin-calloc -fno-builtin-cfree 
-fno-builtin-memalign -fno-builtin-posix_memalign -fno-builtin-valloc 
-fno-builtin-pvalloc  -Wno-unused-result   -fno-builtin -g -O2 -MT 
debugallocation_test-debugallocation_test.o -MD -MP -MF 
.deps/debugallocation_test-debugallocation_test.Tpo -c -o 
debugallocation_test-debugallocation_test.o `test -f 
'src/tests/debugallocation_test.cc' || echo 
'./'`src/tests/debugallocation_test.cc
src/tests/debugallocation_test.cc:36:10: fatal error: 'malloc.h' file not found
#include <malloc.h> // for memalign
         ^
1 error generated.

Expected: successful build

The problem is that Mac OS X ABI requires 16-byte alignment, so memalign() is 
not there (and even if it was, it should not be used).

The following patch fixes the problem for me:

diff --git a/src/tests/debugallocation_test.cc 
b/src/tests/debugallocation_test.cc
index 8e14830..1eedda3 100644
--- a/src/tests/debugallocation_test.cc
+++ b/src/tests/debugallocation_test.cc
@@ -33,7 +33,9 @@

 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_MEMALIGN
 #include <malloc.h> // for memalign
+#endif
 #include <string.h> // for memcmp
 #include <vector>
 #include "gperftools/malloc_extension.h"

What version of the product are you using? On what operating system?

$ uname -a
Darwin Davides-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 
16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

Original issue reported on code.google.com by davide.i...@10gen.com on 2 Apr 2014 at 5:43

GoogleCodeExporter commented 9 years ago
Thanks. Will consider your patch next weekend.

Original comment by alkondratenko on 2 Apr 2014 at 6:23

GoogleCodeExporter commented 9 years ago
Issue 615 has been merged into this issue.

Original comment by alkondratenko on 4 Apr 2014 at 12:58

GoogleCodeExporter commented 9 years ago
I've just merged slightly different fix. Consider testing please

Original comment by alkondratenko on 7 Apr 2014 at 7:37

GoogleCodeExporter commented 9 years ago
I quickly tested and build process finishes without errors now. Just for the 
record, I am as well running: 

Darwin Victors-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 
16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

Thank you for the fix. 

Original comment by vgue...@gmail.com on 7 Apr 2014 at 8:31