[R-pkg-devel] Need help building packages to track down ASAN error

Steven Scott @teve@the@b@ye@|@n @end|ng |rom gm@||@com
Tue Mar 24 05:30:26 CET 2020


One of my packages (bsts) appears to have a memory error identified by ASAN.
I'm trying to build an ASAN-enabled R+bsts so that I can debug the error.

I'm using the rocker image rocker/r-devel-ubsan-clang, loaded and run as
follows:

docker run --cap-add SYS_PTRACE -e PASSWORD=<redacted> --rm -p 8787:8787 -v
/home/steve/code/BOOM:/home/steve/code/BOOM -it rocker/r-devel-ubsan-clang
/bin/bash

This launches me into a bash shell.  At this point I think I need to build
and
install my package.  On this image the home directory is /root, and under
/root
I have installed /root/.R/Makevars with the following content (per section
4.3
of WRE).

CC = clang -std=c99 -fsanitize=address -fno-omit-frame-pointer
CXX = clang++ -std=c++11 -fsanitize=address -fno-omit-frame-pointer
FC = gfortran -fsanitize=address

When I run the scripts to build and install my packages (bsts + 2
dependencies,
named Boom and BoomSpikeSlab), I get output that looks like

g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
-I`/usr/lib/R/bin/Rscript -e "cat(system.file(package='Boom'))"`/include
-DADD_ -DR_NO_REMAP -DRLANGUAGE
-I"/usr/local/lib/R/site-library/Boom/include"   -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-MP6Q4u/r-base-3.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c boom_spike_slab_init.cc -o boom_spike_slab_init.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG
-I`/usr/lib/R/bin/Rscript -e "cat(system.file(package='Boom'))"`/include
-DADD_ -DR_NO_REMAP -DRLANGUAGE
-I"/usr/local/lib/R/site-library/Boom/include"   -fpic  -g -O2
-fdebug-prefix-map=/build/r-base-MP6Q4u/r-base-3.6.2=.
-fstack-protector-strong -Wformat -Werror=format-security -Wdate-time
-D_FORTIFY_SOURCE=2 -g  -c logit_spike_slab_wrapper.cc -o
logit_spike_slab_wrapper.o
....

Here g++ is being used instad of the requested clang++ (I'm assuming R on
this
image was built with clang), and the important -fsanitize=address flag is
not
present.  So it seems that ~/.R/Makevars is being ignored.

The goal is to produce an ASAN-enabled package so that I can test for the
error.
Am I on the correct path to producing such a package, and if so what else
do I
need to do to get there?

Thank you.

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list