mzhaom / gperftools

Fast, multi-threaded malloc() and nifty performance analysis tools
https://code.google.com/p/gperftools/
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

using ./configure --disable-shared builds a broken .libs/libprofiler.a #136

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
libprofiler.a is built correctly, using the command:

ar cru .libs/libprofiler.a  profiler.o profile-handler.o profiledata.o  
.libs/libprofiler.lax/libstacktrace.a/atomicops-internals-x86.o 
.libs/libprofiler.lax/libstacktrace.a/dynamic_annotations.o 
.libs/libprofiler.lax/libstacktrace.a/logging.o 
.libs/libprofiler.lax/libstacktrace.a/spinlock.o 
.libs/libprofiler.lax/libstacktrace.a/stacktrace.o 
.libs/libprofiler.lax/libstacktrace.a/stacktrace_with_context.o 
.libs/libprofiler.lax/libstacktrace.a/sysinfo.o 
.libs/libprofiler.lax/libstacktrace.a/vdso_support.o 

but then right after, libtool commands overwrite the static library and all the 
profiling symbols 
are missing:

/bin/sh ./libtool --tag=CXX --mode=link g++ -Wall -Wwrite-strings 
-Woverloaded-virtual -
Wno-sign-compare   -g -O2 -no-undefined   -o libprofiler.o profiler.lo 
profile-handler.lo 
profiledata.lo    libstacktrace.la
gcc -g -O2 -nostdlib -r -o libprofiler.o     
.libs/libprofiler.ox/libstacktrace.a/atomicops-
internals-x86.o .libs/libprofiler.ox/libstacktrace.a/dynamic_annotations.o 
.libs/libprofiler.ox/libstacktrace.a/logging.o 
.libs/libprofiler.ox/libstacktrace.a/spinlock.o 
.libs/libprofiler.ox/libstacktrace.a/stacktrace.o 
.libs/libprofiler.ox/libstacktrace.a/stacktrace_with_context.o 
.libs/libprofiler.ox/libstacktrace.a/sysinfo.o 
.libs/libprofiler.ox/libstacktrace.a/vdso_support.o 
cp -f "libprofiler.o" .libs/libprofiler.a

everything is fine if i don't --disable-shared

Original issue reported on code.google.com by themaste...@gmail.com on 30 May 2009 at 6:32

GoogleCodeExporter commented 9 years ago
What platform are you on?

This is me trying to be too clever, when creating the .a files (to let you link 
in
both libprofiler.a and libtcmalloc.a).  I don't know why the symbols are 
disappearing
-- that shouldn't be.  In any case, next release i'm back to a more normal 
setup so
this problem will go away.

In the meantime, you can edit the Makefile to comment out the rule(s) about
libprofiler.o.  That should keep it from doing the overwriting.

Original comment by csilv...@gmail.com on 30 May 2009 at 7:01

GoogleCodeExporter commented 9 years ago
I was seeing this issue on OSX Leopard. I checked the output of `nm 
libprofiler.a | grep ProfilerStart` before and 
after the libtool command and the symbols were definitely being lost. I was 
able to remove the --disable-
shared and successfully build a modified static libprofiler to link into a ruby 
extension.

If you're interested, I've released the ruby specific profiler at 
http://github.com/tmm1/perftools.rb

Original comment by themaste...@gmail.com on 31 May 2009 at 6:27

GoogleCodeExporter commented 9 years ago
Removing the make target for libprofiler.o worked great. Thanks!

Original comment by themaste...@gmail.com on 1 Jun 2009 at 7:36

GoogleCodeExporter commented 9 years ago
Hmm, I tried it on 3 varieties of OS X, and I thought the tests all passed, but 
maybe
I missed a problem.  Anyway, I'm glad the workaround worked.

The ruby profiler looks like a great idea!  Best of luck with that project.

Original comment by csilv...@gmail.com on 1 Jun 2009 at 11:00

GoogleCodeExporter commented 9 years ago
This should be fixed in perftools 1.3, just released.  (I've removed all that
libprofiler.o stuff.)

Original comment by csilv...@gmail.com on 10 Jun 2009 at 2:05