koolhazz / gperftools

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

Compilation error on Mac OS X 10.9.2 - 'malloc.h' file not found #615

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Checkout the latest code from the git repository @ 
https://code.google.com/p/gperftools/
2. run autogen.sh script
3. run configure script
4. do make. 

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

Expect output would be a clean compilation. Instead one gets the following 
error: 

clang++ -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 -fno-builtin -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.

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

checkout of master branch @ e7297f0c14b0c09ec52707ed7477c7aee43a1882, using Mac 
OS X 10.9.2

Please provide any additional information below.

the commit a2375a1f360c0451ec2a2b852ea26a71fb731727 introduces malloc.h header 
file on src/tests/debugallocation_test.cc in order to use memalign. I removed 
the include of malloc.h and compilation went through. But it seems that 
malloc.h has been deprecated on mac os and freebsd ( i guess ) .. and a patch 
like this would probably make sense(?): 

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

 #include <stdio.h>
 #include <stdlib.h>
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 #include <malloc.h> // for memalign
+#endif
 #include <string.h> // for memcmp
 #include <vector>
 #include "gperftools/malloc_extension.h"

Original issue reported on code.google.com by vgue...@gmail.com on 4 Apr 2014 at 11:42

GoogleCodeExporter commented 9 years ago
my bad!.. I rushed to post the issue and just noticed that it had been reported 
already. Sorry!!! 

Original comment by vgue...@gmail.com on 4 Apr 2014 at 11:47

GoogleCodeExporter commented 9 years ago
issue 614 was reporting already the issue: 
https://code.google.com/p/gperftools/issues/detail?id=614

Original comment by vgue...@gmail.com on 4 Apr 2014 at 11:49

GoogleCodeExporter commented 9 years ago

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