cuitao2046 / gperftools

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

build fails with --enable-minimal #312

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ./configure --enable-minimal
2. make

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

libtool: link: g++ -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 -o debugallocation_test 
-pthread debugallocation_test-debugallocation_test.o  
./.libs/libtcmalloc_debug.a -lpthread -pthread
debugallocation_test-debugallocation_test.o: In function 
`Test_DebugAllocationTest_GetAllocatedSizeTest::Run()':
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:260: undefined reference to `MallocExtension::instance()'
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:265: undefined reference to `MallocExtension::instance()'
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:267: undefined reference to `MallocExtension::instance()'
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:268: undefined reference to `MallocExtension::instance()'
debugallocation_test-debugallocation_test.o: In function 
`Test_DebugAllocationTest_DanglingPointerWriteTest::Run()':
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:192: undefined reference to 
`FLAG__namespace_do_not_use_directly_use_DECLARE_int32_instead::FLAGS_max_free_q
ueue_size'
debugallocation_test-debugallocation_test.o: In function 
`CurrentlyAllocatedBytes':
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:229: undefined reference to `MallocExtension::instance()'
debugallocation_test-debugallocation_test.o: In function 
`Test_DebugAllocationTest_CurrentlyAllocated::Run()':
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:237: undefined reference to 
`FLAG__namespace_do_not_use_directly_use_DECLARE_int32_instead::FLAGS_max_free_q
ueue_size'
/root/src/altoros/moxi-build/google-perftools-1.7/src/tests/debugallocation_test
.cc:241: undefined reference to 
`FLAG__namespace_do_not_use_directly_use_DECLARE_int32_instead::FLAGS_max_free_q
ueue_size'
collect2: ld returned 1 exit status
make: *** [debugallocation_test] Error 1

What version of the product are you using? On what operating system?
1.7 on Debian GNU/Linux unstable i386

Please provide any additional information below.

--disable-static also fails to build

Original issue reported on code.google.com by alkondratenko on 14 Feb 2011 at 4:24

GoogleCodeExporter commented 9 years ago
Oops, I always forget to test the various --enable flags before a new release.  
Thanks for catching this; I'll look into it for the next release.  In the 
meantime, 'make -k' should hopefully work. :-]

Original comment by csilv...@gmail.com on 15 Feb 2011 at 1:57

GoogleCodeExporter commented 9 years ago
OK, fixing --enable-minimal for the next build by no longer running 
debugallocation_test.

--disable-static builds for me, so I can't address that part of the report.  
What is the exact 'configure' args that you're using?  What's the exact output 
of ./configure && make?

Original comment by csilv...@gmail.com on 23 Feb 2011 at 5:18

GoogleCodeExporter commented 9 years ago
Apparently it complains on C++ style comments here:

In file included from src/tests/malloc_extension_c_test.c:44:
./src/google/malloc_hook_c.h:43: error: expected identifier or ‘(’ before 
‘/’ token

My configure flags are just usual --disable-static. gcc -v outputs:

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.4.5-11' 
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-4.4 --enable-shared --enable-multiarch 
--enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib 
--without-included-gettext --enable-threads=posix 
--with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls 
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc 
--enable-targets=all --with-arch-32=i586 --with-tune=generic 
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu 
--target=i486-linux-gnu
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-11) 

Original comment by alkondratenko on 23 Feb 2011 at 3:21

GoogleCodeExporter commented 9 years ago
Ah, that's just issue 309.  This should be fixed at svn-root.

Original comment by csilv...@gmail.com on 23 Feb 2011 at 11:22

GoogleCodeExporter commented 9 years ago
This is due to a bug in the Makefile, which tells it to link against the wrong 
debug library.

[root@zre-rhel4 google-perftools-1.7]# diff -u Makefile.orig Makefile
--- Makefile.orig       2011-02-24 15:06:14.000000000 -0800
+++ Makefile    2011-02-24 15:09:40.000000000 -0800
@@ -2135,7 +2135,7 @@
 debugallocation_test_SOURCES = src/tests/debugallocation_test.cc
 debugallocation_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
 debugallocation_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS)
-debugallocation_test_LDADD = libtcmalloc_debug.la $(PTHREAD_LIBS)
+debugallocation_test_LDADD = libtcmalloc_minimal_debug.la $(PTHREAD_LIBS)

 ### ------- tcmalloc (thread-caching malloc + heap profiler + heap checker)

fixes the build.  So I assume this fix needs to be made to Makefile.in and 
Makefile.am

Original comment by quanah.g...@gmail.com on 24 Feb 2011 at 11:12

GoogleCodeExporter commented 9 years ago
I hit another issue on OSX only, so my final patch for Makefile.in is:

--- google-perftools-1.7/Makefile.in.orig       2011-02-24 15:13:20.412098139 
-0800
+++ google-perftools-1.7/Makefile.in    2011-02-24 15:31:00.032153239 -0800
@@ -790,7 +790,6 @@
 @WITH_DEBUGALLOC_TRUE@am_debugallocation_test_OBJECTS = debugallocation_test-debugallocation_test.$(OBJEXT)
 debugallocation_test_OBJECTS = $(am_debugallocation_test_OBJECTS)
 @WITH_DEBUGALLOC_TRUE@debugallocation_test_DEPENDENCIES =  \
-@WITH_DEBUGALLOC_TRUE@ libtcmalloc_debug.la \
 @WITH_DEBUGALLOC_TRUE@ $(am__DEPENDENCIES_1)
 am__debugallocation_test_sh_SOURCES_DIST =  \
        src/tests/debugallocation_test.sh
@@ -2135,7 +2134,7 @@
 @WITH_DEBUGALLOC_TRUE@debugallocation_test_SOURCES = src/tests/debugallocation_test.cc
 @WITH_DEBUGALLOC_TRUE@debugallocation_test_CXXFLAGS = $(PTHREAD_CFLAGS) $(AM_CXXFLAGS)
 @WITH_DEBUGALLOC_TRUE@debugallocation_test_LDFLAGS = $(PTHREAD_CFLAGS) $(TCMALLOC_FLAGS)
-@WITH_DEBUGALLOC_TRUE@debugallocation_test_LDADD = libtcmalloc_debug.la 
$(PTHREAD_LIBS)
+@WITH_DEBUGALLOC_TRUE@debugallocation_test_LDADD = 
libtcmalloc_minimal_debug.la $(PTHREAD_LIBS)

 ### ------- tcmalloc (thread-caching malloc + heap profiler + heap checker)

Original comment by quanah.g...@gmail.com on 24 Feb 2011 at 11:35

GoogleCodeExporter commented 9 years ago
debugallocation_test needs to link against the full tcmalloc, because it needs 
to get stack traces.  Are you finding that --disable-static still fails to work 
using the version of perftools as svn-root?  Or maybe I'm misunderstanding 
exactly which bug you're referring to here.

Original comment by csilv...@gmail.com on 25 Feb 2011 at 12:21

GoogleCodeExporter commented 9 years ago
@7 When I try to compile with --enable-minimal, I also run into this bug. I 
find that applying the patch in Comment #5 fixes it and the build makes.

The issue is that when you 

./configure --enable-minimal
make

 you do NOT make libtcmalloc_debug.la. Instead you make libtcmalloc_minimal_debug.la. So the issue in the makefile is that debugallocation_test_LDADD points to the wrong thing - a file that is NOT created - if you configure with --enable-minimal. 

The easy fix is presented in comment #5, just alter the makefile. A better fix 
would be to not hardcode in this fix, as it'll have to be manually changed when 
I try to configure the entire perftools package - ie, have the Makefile link to 
the correct file when --enable-minimal is applied.

Does that make sense? I think comment #5 & #6 is referring to the initial bug, 
regarding that --enable-minimal does not make because the Makefile links to the 
wrong package. I'm on a linux box, I did not run into the issue that #6 
suggests is an OSX-only bug.

Original comment by robots...@gmail.com on 21 Jun 2011 at 2:31

GoogleCodeExporter commented 9 years ago
#6: what version of perftools are you using?  The top-of-tree tcmalloc should 
fix this by not trying to build debugallocation_test with --enable-minimal.  
That is the right fix for this (#5 fixes the build, but not the tests).

Original comment by csilv...@gmail.com on 21 Jun 2011 at 4:50

GoogleCodeExporter commented 9 years ago
This should be fixed in perftools 1.8, just released.

Original comment by csilv...@gmail.com on 16 Jul 2011 at 1:24