7

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!

user304347
  • 105
  • 1
  • 4
  • It _could_ be a fresh interaction between devtools and Rcpp. Try the two functions "manually", ie invoke `compileAttributes()` yourself from R, and invoke `tools::package_native_routine_registration_skeleton(".")` (maybe with `src/init.c` as the second argument). See if that works. – Dirk Eddelbuettel May 24 '17 at 11:56
  • Dear Dirk, thank you very much for your response. Sorry for not including more details in my first post. I have tried running the R commands you mentioned both `tools::package_native_routine_registration_skeleton(".")` and `tools::package_native_routine_registration_skeleton(".", "src/init.c")` return the same error (i.e. `no native symbols were extracted`). Any idea on how to solve this? If not, I will try to construct an "empty package" to see if I can reproduce the error. Thanks again! – user304347 May 24 '17 at 14:48
  • Weird. That has never failed me. And as the Rcpp 0.12.11 mentioned, I blogged about this three times. There are a number of possible venue: i) You package may be buggy. Try your approach on a known and test CRAN package. ii) It is us. There appears to be an intersection with devtools which is fixed in the master branch. But as I said, it always worked for me so YMMV ... – Dirk Eddelbuettel May 24 '17 at 15:03
  • Thanks for the reply. I should have mentioned this earlier but I had the same error on 0.12.11 and 0.12.11.1 (which I installed from github today). I will try this approach on a known package or build an empty to see if this is a bug my package. – user304347 May 24 '17 at 15:20

6 Answers6

7

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.

Rory Nolan
  • 972
  • 10
  • 15
6

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.

wush978
  • 3,114
  • 2
  • 19
  • 23
4

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.

THK
  • 486
  • 3
  • 11
  • 2
    It turns out that this (apparently) is a problem with RStudio. Running devtools::document() after deleting the NAMESPACE file will generate a new NAMESPACE without calling compileAttributes. – THK Feb 20 '18 at 01:08
  • 1
    spot on! I had just deleted the NAMESPACE file and devtools::document() solved the issue. – Trusky Apr 01 '19 at 15:42
1

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

Stefanos
  • 909
  • 12
  • 19
1

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) 
Itsuarpok
  • 36
  • 2
0

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.

Marco Stamazza
  • 836
  • 9
  • 15