Rcpp::compileAttributes() Error

和自甴很熟 提交于 2019-12-18 06:09:50

问题


I am trying to compile a small package that I've made. This package uses Rcpp and RcppArmadillo. Everything was working well until I updated my mac to Sierra (version 10.12.5). I have now the following error message when building the package from Rstudio (version 1.0.143):

Error in Rcpp::compileAttributes() : 
Evaluation error: no native symbols were extracted.
Calls: source ... withVisible -> eval -> eval -> <Anonymous> -> .Call
Execution halted

Any idea what this is and how it can be fixed?

Thank you very much!


回答1:


Try

tools::package_native_routine_registration_skeleton(".", character_only = FALSE)

The unintuitive character_only = FALSE is necessary if you are not calling this for the first time.

I copied this answer from kbenoit at https://github.com/kbenoit/quanteda/issues/846. This worked for me when I had a similar problem.




回答2:


I have the same error after renaming the package.

After removing the compiled object files under src/ such as xxx.o and xxx.so, it works again.




回答3:


In my case this happens when there is a problem with the NAMESPACE file, or when NAMESPACE is missing. There is a catch-22. Roxygen2 wont overwrite your NAMESPACE file, but if you delete it and run roxygen to generate the NAMESPACE file, compileAttributes is called, but hangs because the NAMESPACE file is missing.




回答4:


Try deleting RcppExports.cpp and RcppExports.o and then in build options go-to "more" -> "clean and rebuild" This usually does the trick when I have similar problems




回答5:


I got mine fixed by recreating the project in RStudio from GitHub in a fresh directory.

I had the same problem; happened as I was working on a markdown file irrelevant to the package, but then all of sudden package would not build with the same error:

    > devtools::session_info()
Session info ----------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, mingw32             
 ui       RStudio (1.1.453)           
 language (EN)                        
 collate  English_United States.1252  
 tz       America/Los_Angeles         
 date     2018-06-05                  

Packages --------------------------------------------------------------------------------------------------------------------------
 package    * version    date       source                            
 assertthat   0.2.0      2017-04-11 CRAN (R 3.5.0)                    
 base       * 3.5.0      2018-04-23 local                             
 bindr        0.1.1      2018-03-13 CRAN (R 3.5.0)                    
 bindrcpp     0.2.2      2018-03-29 CRAN (R 3.5.0)                    
 colorspace   1.3-2      2016-12-14 CRAN (R 3.5.0)                    
 compiler     3.5.0      2018-04-23 local                             
 datasets   * 3.5.0      2018-04-23 local                             
 devtools     1.13.5     2018-02-18 CRAN (R 3.5.0)                    
 digest       0.6.15     2018-01-28 CRAN (R 3.5.0)                    
 dplyr        0.7.5      2018-05-19 CRAN (R 3.5.0)                    
 epicR      * 0.16.0     2018-06-06 local                             
 ggplot2      2.2.1.9000 2018-05-28 Github (tidyverse/ggplot2@4299917)
 ggthemes     3.5.0      2018-05-07 CRAN (R 3.5.0)                    
 glue         1.2.0      2017-10-29 CRAN (R 3.5.0)                    
 graphics   * 3.5.0      2018-04-23 local                             
 grDevices  * 3.5.0      2018-04-23 local                             
 grid         3.5.0      2018-04-23 local                             
 gtable       0.2.0      2016-02-26 CRAN (R 3.5.0)                    
 lazyeval     0.2.1      2017-10-29 CRAN (R 3.5.0)                    
 magrittr     1.5        2014-11-22 CRAN (R 3.5.0)                    
 memoise      1.1.0      2017-04-21 CRAN (R 3.5.0)                    
 methods    * 3.5.0      2018-04-23 local                             
 munsell      0.4.3      2016-02-13 CRAN (R 3.5.0)                    
 pillar       1.2.3      2018-05-25 CRAN (R 3.5.0)                    
 pkgconfig    2.0.1      2017-03-21 CRAN (R 3.5.0)                    
 plyr         1.8.4      2016-06-08 CRAN (R 3.5.0)                    
 purrr        0.2.5      2018-05-29 CRAN (R 3.5.0)                    
 R6           2.2.2      2017-06-17 CRAN (R 3.5.0)                    
 Rcpp         0.12.17    2018-05-18 CRAN (R 3.5.0)                    
 rlang        0.2.1      2018-05-30 CRAN (R 3.5.0)                    
 scales       0.5.0      2017-08-24 CRAN (R 3.5.0)                    
 stats      * 3.5.0      2018-04-23 local                             
 tibble       1.4.2      2018-01-22 CRAN (R 3.5.0)                    
 tidyselect   0.2.4      2018-02-26 CRAN (R 3.5.0)                    
 tools        3.5.0      2018-04-23 local                             
 utils      * 3.5.0      2018-04-23 local                             
 withr        2.1.2      2018-03-15 CRAN (R 3.5.0)                    
 yaml         2.1.19     2018-05-01 CRAN (R 3.5.0) 



回答6:


I don't know if this can help, but I had a similar problem because I named the package something like "xxx_package". I don't remember exactly what happened, I think I found out because when I tried to create a new package with a similar name in Rstudio it threw an error about the name, saying only letters and numbers were allowed. Rcpp::compileAttributes and even Rcpp::Rcpp.package.skeleton had not complained about the name. I tried with tools::package_native_routine_registration_skeleton(".", character_only = FALSE) to no avail.

In any case, after creating a new package named "xxxPackage" all problems were solved.



来源:https://stackoverflow.com/questions/44147065/rcppcompileattributes-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!