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

Douglas Bates bates at stat.wisc.edu
Tue Feb 28 19:43:05 CET 2012

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?

More information about the Rcpp-devel mailing list