[Rcpp-devel] Something strange with the package check and calls to C abort

Iñaki Ucar iucar at fedoraproject.org
Tue Nov 1 12:17:16 CET 2022


Oh, I receive emails from the list again. Nice.

On Tue, 1 Nov 2022 at 03:58, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> On 31 October 2022 at 11:01, Kevin Ushey wrote:
> | For posterity, what machine are you compiling the package on? If you're
> | using a modern Linux system, it's possible the default compilation flags
> | are including stack protection code during compilation that might call
> | abort on error. See e.g.
> |
> | https://developers.redhat.com/articles/2022/06/02/use-compiler-flags-stack-protection-gcc-and-clang
>
> Not to get into distro wars ... but over here where I build I had the benefit
> of kernel and compiler savvy people setting up defaults for many years now.
>
> Without ever creating a single issue for my (rather frequent) R package
> checking. All this is just to say that Debian and Ubuntu have treated me well.

No offense taken. :) Debian has a pretty good policy on hardening
flags [1], and, in fact, there are only two differences between Debian
and Fedora flags, because both have stack protection and so on:

1. Debian specifies -D_FORTIFY_SOURCE=2, while Fedora specifies
-Wp,-D_FORTIFY_SOURCE=2. I don't understand what's the difference
between them, but R seems to dislike the second one. However, there
are some gcc maintainers among the people that define these flags in
Fedora, so I suppose it's fine. I think it's just that R flags any
-W... option, no matter what.

2. Fedora adds -Wp,-D_GLIBCXX_ASSERTIONS, which enables run-time
bounds checking for STL containers. I've seen numerous upstream bugs
uncovered by this flag (and upstream maintainers responding "just
don't use that flag" to the bug report... which of course is not a
solution). So I think it's a cheap, nice thing to have.

If Debian/Ubuntu are quieter than Fedora about those flags is due to
[2]. ;-) I'm however reluctant to set this by default, because if a
package adds one of these flags (maybe unlikely, but who knows), the
checks would pass locally but would raise a NOTE on CRAN. So I'm more
inclined to document this and let the user decide whether to set this
or modify the check flags with a R_MAKEVARS_USER as described in a
previous posting.

Iñaki

[1] https://wiki.debian.org/Hardening
[2] https://salsa.debian.org/edd/r-base/-/blob/master/debian/Renviron.site#L37

> | It might be useful if you could share your package / the code used when
> | compiling the C++ code in your package.
>
> Indeed. It generally never hurts to let other people have a peek.
>
> Dirk
>
> --
> dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
> _______________________________________________
> 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



-- 
Iñaki Úcar


More information about the Rcpp-devel mailing list