[Rcpp-devel] problem compiling package using Rcpp

Nick Matzke matzke at berkeley.edu
Thu Jan 3 03:09:34 CET 2013


Thanks very much for the reply.  Apologies for the 
non-reproducibility, normally I attempt to do that, but in 
this case I had no idea what piece of thousands of lines of 
code was causing the problem due to the vague compiler error 
message.  So I was just looking for hints.

And, you provided a good one -- it was indeed my build 
setup.  In case anyone on the interwebs ever has something 
similar, the full explanation:

To automate compiling packages with different compile flags 
(e.g. sometimes I have to use g++4.6 instead of g++4.2), I 
have a hack that copies a custom Makevars text file to the 
directory where R can see it:

/Users/nickm/.R/Makevars

The compile flags for this package had lines like:

CPPFLAGS = -I/usr/local/include 
-I/Library/Frameworks/R.framework/Resources/include 
-I/Library/Frameworks/R.framework/Resources/include/x86_64 
-I/Library/Frameworks/R.framework/Versions/2.14/Resources/library/Rcpp/include 
-I/Library/Frameworks/R.framework/Versions/2.14/Resources/library/RcppArmadillo/include 
-lf2c -lm

...but of course these no longer worked once I installed 
2.15 and new Rcpp and RcppArmadillo inside 2.15!!


While playing with this, I encountered additional problems 
due to permissions, it turns out when I re-installed R, 
/usr/bin/R was recreated with owner root, making copied 
files have owner root, resulting in problems later.  chown 
fixed that.

So that's it - yes I probably would have gotten there 
eventually but the hint helped.

Sorry also for the long sig, it's mostly so I can find all 
my own dang information like my departmental fax number. And 
it's a running joke at this point here, I'd hate to 
disappoint people. :)

Thanks, Nick

On 1/2/13 5:38 PM, Dirk Eddelbuettel wrote:
>
> Hi Nick,
>
> On 2 January 2013 at 17:00, Nick Matzke wrote:
> | Hi all,
> |
> | I had a package that made use of Rcpp and compiled well in R
> | 2.14.  However, I just updated to R 2.15.2, and updated Rcpp
> | etc. to the current standard, and now I get a compile error
> | right at the end.  Any hints about what might cause this?
> | It looks kind of like an Rcpp problem and not something with
> | my package code, which didn't change.
>
> Can you let us know what the Depends: are?
> | ** testing if installed package can be loaded
> | Error in dyn.load(file, DLLpath = DLLpath, ...) :
> |    unable to load shared object
> | '/Library/Frameworks/R.framework/Versions/2.15/Resources/library/phyRmcmc/libs/x86_64/phyRmcmc.so':
> |
> | dlopen(/Library/Frameworks/R.framework/Versions/2.15/Resources/library/phyRmcmc/libs/x86_64/phyRmcmc.so,
> | 6): Symbol not found:
> | __ZN4Rcpp8internal14r_vector_startILi10EiEEPT0_P7SEXPREC
> |    Referenced from:
> | /Library/Frameworks/R.framework/Versions/2.15/Resources/library/phyRmcmc/libs/x86_64/phyRmcmc.so
> |    Expected in: flat namespace
> |   in
> | /Library/Frameworks/R.framework/Versions/2.15/Resources/library/phyRmcmc/libs/x86_64/phyRmcmc.so
> | Error: loading failed
> | Execution halted
> | ERROR: loading failed
> | * removing
> | ‘/Library/Frameworks/R.framework/Versions/2.15/Resources/library/phyRmcmc’
> | Warning message:
> | In install.packages(packagename, lib =
> | "/Library/Frameworks/R.framework/Resources/library/",  :
> |    installation of package ‘phyRmcmc’ had non-zero exit status
>
> I think this is not a problem with your build. It seems like you try to load
> another package _which itself needs a rebuild_.   Could be as simple has
> having to rebuild RcppArmadillo.
>
> We did make a chance in 0.10.1 which required all packages using Rcpp to be
> reinstalled.  We try to keep such changes to a minimum, but sometimes you
> gotta do what you gotta do...
>
> | =====================================
> |
> |
> |
> | One other difference between the compilation runs:
> |
> | These are in my package:
> | basics.cpp
> | calc_anclikes_sp.cpp
> | rcpp_hello_world.cpp
> | rcpp_module.cpp
> |
> | But the compilation of these:
> | Num.cpp
> | stdVector.cpp
> |
> | ...is new I think, this didn't happen when I compiled in
> | 2.14 IIRC.
>
> I have no idea what you are trying to day, and please note that your example
> is __NOT REPRODUCIBLE__ as we do not have your sources.  Always try to
> distill to small reproducible cases.
>
> Dirk
>
> [tons of stuff and two novels omitted]
>

-- 
====================================================
Nicholas J. Matzke
Ph.D. Candidate, Graduate Student Researcher

Huelsenbeck Lab
Center for Theoretical Evolutionary Genomics
4151 VLSB (Valley Life Sciences Building)
Department of Integrative Biology
University of California, Berkeley

Graduate Student Instructor, IB200B
Principles of Phylogenetics: Ecology and Evolution
http://ib.berkeley.edu/courses/ib200b/
http://phylo.wikidot.com/


Lab websites:
http://ib.berkeley.edu/people/lab_detail.php?lab=54
http://fisher.berkeley.edu/cteg/hlab.html
Dept. personal page: 
http://ib.berkeley.edu/people/students/person_detail.php?person=370
Lab personal page: 
http://fisher.berkeley.edu/cteg/members/matzke.html
Lab phone: 510-643-6299
Dept. fax: 510-643-6264

Cell phone: 510-301-0179
Email: matzke at berkeley.edu

Mailing address:
Department of Integrative Biology
1005 Valley Life Sciences Building #3140
Berkeley, CA 94720-3140

-----------------------------------------------------
"[W]hen people thought the earth was flat, they were wrong. 
When people thought the earth was spherical, they were 
wrong. But if you think that thinking the earth is spherical 
is just as wrong as thinking the earth is flat, then your 
view is wronger than both of them put together."

Isaac Asimov (1989). "The Relativity of Wrong." The 
Skeptical Inquirer, 14(1), 35-44. Fall 1989.
http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm
====================================================


More information about the Rcpp-devel mailing list