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

Already on GitHub? Sign in to your account

perftools 1.6 cannot compile with gcc 4.6.0 #24

wants to merge 1 commit into


None yet
8 participants

janx commented Jun 16, 2011

I'm using archlinux, gcc version 4.6, rvm 1.6.13, ruby 1.9.2-p180. I get some compile error when install latest perftools.rb, and it turns out a 1.6 bug: http://code.google.com/p/chromium/issues/detail?id=80071

I'm not sure whether this problem exists in other gcc versions, and my patch will affect perftools.rb on all gcc versions, so please be careful if you want to merge :)


tmm1 commented Jun 16, 2011

Interesting. Looks like this was fixed upstream in 1.7: http://code.google.com/p/google-perftools/issues/detail?id=301&can=1&q=stddef

Perhaps we should just upgrade perftools.rb to use 1.7. I'll take a look, thanks!

janx commented Jun 16, 2011

Yes, looking forward to an upgrade to 1.7!

solnic commented Jun 20, 2011

@tmm1 currently it's a huge blocker for me. I've recently switched to Fedora which ships with gcc 4.6 and I can't install perftools.rb...neither latest release nor the @janx fork. Please upgrade google-perftools to 1.7...I can help with testing the compilation. I'd fix it right away if I wasn't a C noob :)


tmm1 commented Jun 20, 2011

@solnic: why doesn't @janx's fork work?

solnic commented Jun 20, 2011

@tmm1 well, I dunno, I don't understand the error messages :) Here's the mkmf.log:

Makefile:2550: warning: overriding recipe for target `heap-checker_debug_unittest.sh'
Makefile:2547: warning: ignoring old recipe for target `heap-checker_debug_unittest.sh'
Makefile:2565: warning: overriding recipe for target `heap-profiler_debug_unittest.sh'
Makefile:2562: warning: ignoring old recipe for target `heap-profiler_debug_unittest.sh'
Makefile:2652: warning: overriding recipe for target `sampling_debug_test.sh'
Makefile:2649: warning: ignoring old recipe for target `sampling_debug_test.sh'
if /bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I./src  -I./src   -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -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   -g -O2 -DBUILD_FOR_RUBY -fPIC -O0 -ggdb -MT libtcmalloc_minimal_la-tcmalloc.lo -MD -MP -MF ".deps/libtcmalloc_minimal_la-tcmalloc.Tpo" -c -o libtcmalloc_minimal_la-tcmalloc.lo `test -f 'src/tcmalloc.cc' || echo './'`src/tcmalloc.cc; \
then mv -f ".deps/libtcmalloc_minimal_la-tcmalloc.Tpo" ".deps/libtcmalloc_minimal_la-tcmalloc.Plo"; else rm -f ".deps/libtcmalloc_minimal_la-tcmalloc.Tpo"; exit 1; fi
 g++ -DHAVE_CONFIG_H -I. -I. -I./src -I./src -DNO_TCMALLOC_SAMPLES -pthread -DNDEBUG -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 -g -O2 -DBUILD_FOR_RUBY -fPIC -O0 -ggdb -MT libtcmalloc_minimal_la-tcmalloc.lo -MD -MP -MF .deps/libtcmalloc_minimal_la-tcmalloc.Tpo -c src/tcmalloc.cc -o libtcmalloc_minimal_la-tcmalloc.o
src/tcmalloc.cc:1546:54: error: conflicting declaration ‘void* (* __memalign_hook)(size_t, size_t, const void*)’
/usr/include/malloc.h:183:27: error: ‘__memalign_hook’ has a previous declaration as ‘void* (* volatile __memalign_hook)(size_t, size_t, const void*)’
make: *** [libtcmalloc_minimal_la-tcmalloc.lo] Error 1

janx commented Jun 20, 2011

See http://code.google.com/p/chromium/issues/detail?id=80071#c13 : Add volatile to the declarations in src/tcmalloc.cc should solve your problem. I didn't get this error so it's not in my patch.


tmm1 commented Jun 20, 2011

This is being tracked upstream at http://code.google.com/p/google-perftools/issues/detail?id=348

It hasn't been fixed yet, so upgrading to 1.7 won't help. Will require a patch to tcmalloc.cc as noted by @janx, but we'll need to figure out a way to detect if the patch is required.

solnic commented Jun 20, 2011

Thanks guys! I made a temporary branch in my fork with a patch, seems to be working fine for me (it includes the patch from @janx too): https://github.com/solnic/perftools.rb/tree/gcc4.6

@solnic - Thanks! I got it installed with your patch. Just to point out to anyone else that it's in the gcc4.6 branch, I initially did a git clone and then wondered why it didn't work, but of course I was on master.

solnic commented Jun 28, 2011

@jonleighton good to know it works for you :)

grzuy commented Nov 21, 2011

Having the same issue, thanks @janx and @solnic :)

I am having this problem with: gcc version 4.6.2 20120120. @solnic 's patch is not providing any relief...

grzuy commented Feb 2, 2012

@ryandotsmith have you tried #33?

@grzuy #33 worked great! Thanks!!

Works for me on Debian squeeze.

gcc -v
gcc version 4.6.2 (Debian 4.6.2-12)

Thanks @janx!


tmm1 commented Mar 8, 2012

I've merged gperftools 2.0 into master, which should fix this issue. Please verify and confirm if you can.


bearded commented Mar 18, 2012

@tmm1, v2.0.0 works on gcc 4.6.1 and ruby 1.9.2p318

@tmm1 tmm1 closed this Dec 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment