Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New R-devel nags on 'R_forceSymbols' and compileAttributes() #1255

Closed
eddelbuettel opened this issue Mar 19, 2023 · 1 comment
Closed

New R-devel nags on 'R_forceSymbols' and compileAttributes() #1255

eddelbuettel opened this issue Mar 19, 2023 · 1 comment
Assignees

Comments

@eddelbuettel
Copy link
Member

@edzer had CCed me on a reply to CRAN after he received a gentle nudge from the CRAN team:

Dear maintainer,

Please see the problems shown on
<https://cran.r-project.org/web/checks/check_results_sf.html>.

The "DLL requires the use of native symbols" errors in the
r-devel-linux-x86_64-debian-gcc check results are from

r83985 | luke | 2023-03-16 02:31:57 +0100 (Thu, 16 Mar 2023) | 3 lines
Enforce R_forceSymbols for namespaces, but for now only if an
environment variable is set.

which makes R_forceSymbols work correctly, for now provided that env var
R_REALLY_FORCE_SYMBOLS is set.

You can conveniently extract the non-symbols in your package's foreign
function calls via tools:::package_native_routine_registration_db(),
e.g.,

R> tools:::package_native_routine_registration_db("/data/rsync/PKGS/tibble")
  cname                  s n
1 .Call tibble_need_coerce 1

but please note that there may be several such calls in your code.

Please correct before 2023-04-02 to safely retain your package on CRAN.

I took me a moment of head-scratching among several of my packages. I have some which produces a single when tools:::package_native_routine_registration_db() was called. With a bit more digging, and a quick helpful email exchange with @edzer I noticed that our compileAttributes() write one remaining .Call() with straight apostrophes rather than backticks. In the package in which I traced that it is (currently) this line:

https://github.com/eddelbuettel/rcppspdlog/blob/0c169b62ddef7b62a2217505bf06760b2b8ffea9/R/RcppExports.R#L194

I have a simple two-char patch to src/attributes.cpp which correct this to

diff --git a/R/RcppExports.R b/R/RcppExports.R
index 4c7f878..5ec15ee 100644
--- a/R/RcppExports.R
+++ b/R/RcppExports.R
@@ -191,5 +191,5 @@ format_stopwatch <- function(sw) {
 
 # Register entry points for exported C++ functions
 methods::setLoadAction(function(ns) {
-    .Call('_RcppSpdlog_RcppExport_registerCCallable', PACKAGE = 'RcppSpdlog')
+    .Call(`_RcppSpdlog_RcppExport_registerCCallable`, PACKAGE = 'RcppSpdlog')
 })

We should probably doube-check if we have other remaining uses of ' and/or discuss if we should just turn off the non-registration mode of compileAttributes(). We should also check if we do something garly with R_forceSymbols() but as best as I can tell me do not use it.

@eddelbuettel
Copy link
Member Author

All done via #1256 which was revised in a series of commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant