[Rcpp-devel] Linking a package to -ltmalloc from the google perftools

Douglas Bates bates at stat.wisc.edu
Tue Feb 28 20:56:18 CET 2012


On Tue, Feb 28, 2012 at 1:24 PM, Douglas Bates <bates at stat.wisc.edu> wrote:
> On Tue, Feb 28, 2012 at 1:17 PM, Dirk Eddelbuettel <edd at debian.org> wrote:
>>
>> On 28 February 2012 at 12:43, Douglas Bates wrote:
>> | As the google perftools are specifically designed for multi-threaded
>> | C++ programs I ask this here rather than on R-devel.
>> |
>> | On a Linux system (Ubuntu 11.10) I have been unsuccessful linking a
>> | package, say Rcpp, against -ltcmalloc.  I do have
>> | /usr/lib/libtcmalloc.so.0 and friends installed but the link step
>> | comes back saying it can't find -ltcmalloc.  I actually went to the
>> | trouble of including -L/usr/lib but installing the source package
>> | still ends in
>> | ...
>> | g++ -shared -Bdirect,--hash-style=both,-Wl,-O1 -o Rcpp.so Date.o
>> | DateVector.o Datetime.o DatetimeVector.o Dimension.o DottedPair.o
>> | Environment.o Evaluator.o Formula.o Function.o Language.o Module.o
>> | Pairlist.o Promise.o RObject.o RcppCommon.o Rcpp_init.o Reference.o
>> | Rostream.o Rstreambuf.o S4.o Symbol.o WeakReference.o barrier.o
>> | cache.o coerce.o complex.o debugging.o exceptions.o posixt.o r_cast.o
>> | -L/home/bates/build/R-devel/lib -lR -L/usr/lib -ltcmalloc
>> | ...
>> | /usr/bin/ld: cannot find -ltcmalloc
>> | collect2: ld returned 1 exit status
>> | make: *** [Rcpp.so] Error 1
>> | ERROR: compilation failed for package ‘Rcpp’
>> |
>> | Am I missing something subtle?
>>
>> You do have libgoogle-perftools-dev installed, right?
>
> Well, actually, no I didn't have that package installed.  Thanks for
> the pointer.

Followup question: How does one invoke the cpu-profiler?  You need to
give a path to the binary, which is actually something like
/usr/lib/R/bin/exec/R but that needs several environment variables to
be set.  Do you get around this by using littler?


More information about the Rcpp-devel mailing list