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

Dirk Eddelbuettel edd at debian.org
Tue Feb 28 20:17:49 CET 2012

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?


"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

More information about the Rcpp-devel mailing list