[Rcpp-devel] undefined symbol: clock_gettime in Rcpp 0.10.2

Dirk Eddelbuettel edd at debian.org
Mon Dec 24 06:11:11 CET 2012

On 23 December 2012 at 18:31, Martin Morgan wrote:
| When trying to install Rcpp 0.10.2 with
| $ R --version
| R Under development (unstable) (2012-12-18 r61372) -- "Unsuffered Consequences"
| $ clang++ --version
| Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
| Target: x86_64-pc-linux-gnu
| Thread model: posix

I just upgraded my r-devel version today; the one I used to test 0.10.2 was
probably a week or at the most two weeks old. I did quite a few R CMD check
runs; they all passed -- but I only used g++.

Methinks I could have caught that if I had used clang.
| I get
| $ R CMD INSTALL Rcpp_0.10.2.tar.gz
| ...
| clang++ -I/home/mtmorgan/bin/R-devel/include -DNDEBUG -I../inst/include/ 
| -I/usr/local/include    -fpic  -g -O2  -c Timer.cpp -o Timer.o
| ...
| ** testing if installed package can be loaded
| Error in dyn.load(file, DLLpath = DLLpath, ...) :
|    unable to load shared object 
| '/home/mtmorgan/R/x86_64-unknown-linux-gnu-library/2.16/Rcpp/libs/Rcpp.so':
|    /home/mtmorgan/R/x86_64-unknown-linux-gnu-library/2.16/Rcpp/libs/Rcpp.so: 
| undefined symbol: clock_gettime
| Error: loading failed
|  From man clock_gettime I have
| ...
|         Link with -lrt.
| and adding PKG_LIBS += -lrt to src/Makevars addresses the problem for me, but 
| I'm not sure that is a universal solution? Also, I had an identical problem with 
| another package (Matrix, since corrected) so there is perhaps something 
| a-typical about my configuration.

I don't think so. The internal-to-Rcpp Timer class is new in 0.10.2.  And Yan
is (as usual) correct, -lrt is AFACR specific to Linux. I needed that in the
past when using the kernel-based high-res timer.

So this is something we need to figure out. So we seem to know that r-devel
and clang need it. Can you check if r-release needs it?  With g++, neither R
versions seems to need it.  

OTOH I don't think adding -lrt does any harm so maybe we'll add "in general".
Might run this by Simon too....  This needs more work.

Thanks so much for the heads-up!


| Martin
| -- 
| Computational Biology / Fred Hutchinson Cancer Research Center
| 1100 Fairview Ave. N.
| PO Box 19024 Seattle, WA 98109
| Location: Arnold Building M1 B861
| Phone: (206) 667-2793
| _______________________________________________
| Rcpp-devel mailing list
| Rcpp-devel at lists.r-forge.r-project.org
| https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  

More information about the Rcpp-devel mailing list