Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alk opened this issue Aug 23, 2015 · 3 comments
Closed

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

alk opened this issue Aug 23, 2015 · 3 comments

Comments

@alk
Copy link
Contributor

alk commented Aug 23, 2015

Originally reported on Google Code with ID 615

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"

Reported by vguerra on 2014-04-04 11:42:33

@alk
Copy link
Contributor Author

alk commented Aug 23, 2015

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

Reported by vguerra on 2014-04-04 11:47:55

@alk
Copy link
Contributor Author

alk commented Aug 23, 2015

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

Reported by vguerra on 2014-04-04 11:49:28

@alk
Copy link
Contributor Author

alk commented Aug 23, 2015

Reported by alkondratenko on 2014-04-04 12:58:14

@alk alk closed this as completed Aug 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant