[R-pkg-devel] How to handle CRAN warning regarding stdout/stderr coming from code in upstream C library
Ralf Stubner
r@||@@tubner @end|ng |rom gm@||@com
Tue Jun 3 09:20:54 CEST 2025
On Sun, Jun 1, 2025 at 1:15 AM SN248 <sn248 using cornell.edu> wrote:
> ❯ checking compiled code ...
> > WARNING File ‘sundialr/libs/sundialr.so’:
> > Found ‘abort’, possibly from ‘abort’ (C) Object:
> > ‘../inst/lib/libsundials_core.a’
> > Found ‘puts’, possibly from ‘printf’ (C), ‘puts’ (C) Object:
> > ‘../inst/lib/libsundials_core.a’
One interesting side aspect is that while one of the warnings comes
from the .so file that will be used by R, most of the other messages
come from the intermediate .a files. You absolutely have to fix the
former ones. However, it sometimes happens that code is present in the
library and therefore compiled into the .a file, but it is not used in
the code exposed to R and therefore does not end up in the .so file.
In that case it helps to delete the intermediate .a file once the .so
file has been built. In swephR I do this with the following
src/Makevars file:
PKG_LIBS=-L. -lswe
PKG_CPPFLAGS=-I./libswe/ -DSTRICT_R_HEADERS
all: $(SHLIB) purify
$(SHLIB): libswe.a
LIBSWE = libswe/swedate.o libswe/swehouse.o libswe/swejpl.o libswe/swemmoon.o \
libswe/swemplan.o libswe/sweph.o \
libswe/swephlib.o libswe/swecl.o libswe/swehel.o
libswe.a: $(LIBSWE)
$(AR) rcs libswe.a $(LIBSWE)
purify: $(SHLIB)
@rm -rf libswe.a || true
ralf
More information about the R-package-devel
mailing list