Hi, I want to build a Docker container with R and various R packages built and installed with the gcc address sanitizer enabled. I am working on a Debian Bookworm system running on an x86_64 architecture.
I start with the Docker file at https://github.com/rocker-org/r-devel-san/blob/master/Dockerfile I added -fsanitize=address to compiler and linker variables in the Dockerfile. I also import into the image a Makevars file with the contents CC=gcc -std=gnu99 -fsanitize=address -fno-omit-frame-pointer CXX=g++ -fsanitize=address -fno-omit-frame-pointer FC=gfortran -fsanitize=address LDFLAGS=-fsanitize=address Finally, the Docker file installs additional Debian object libraries and R packages that I want to test. When the package build gets to testing whether the package can be installed, an error message appears saying ==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. For example, ESC[0mESC[91m** building package indices ESC[0mESC[91m** installing vignettes ESC[0mESC[91m** testing if installed package can be loaded from temporary location ESC[0m==684==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. ESC[91mERROR: loading failed ESC[0mESC[91m* removing ‘/usr/local/lib/R/site-library/utf8’ ESC[0mESC[91m* installing *source* package ‘isoband’ ... ESC[0mESC[91m** package ‘isoband’ successfully unpacked and MD5 sums checked ESC[0mESC[91m** using staged installation ESC[0mESC[91m** libs I've tried preloading various libasan.so files that I find on the system but the loader says that it cannot load them. My questions are 1. is it possible to build and install R and packages (in a container) with the gcc address sanitizer enabled? 2. if it is, how do I do it? 3. is this ld_preload message relevant? If so, to which file does it refer? Is there an ASAN runtime library file that I need to specify, and if so, what is the path to it? I appreciate your consideration and assistance. Thank you. Brent P.S. The build-related commands in the Docker file (including my address sanitizer additions) are RUN cd /tmp/R-devel \ && R_PAPERSIZE=letter \ R_BATCHSAVE="--no-save --no-restore" \ R_BROWSER=xdg-open \ PAGER=/usr/bin/pager \ PERL=/usr/bin/perl \ R_UNZIPCMD=/usr/bin/unzip \ R_ZIPCMD=/usr/bin/zip \ R_PRINTCMD=/usr/bin/lpr \ LIBnn=lib \ AWK=/usr/bin/awk \ CC="gcc -std=gnu99 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer" \ CFLAGS="-fno-omit-frame-pointer -g -O2 -Wall -pedantic -mtune=native" \ FFLAGS="-g -O2 -mtune=native" \ FCFLAGS="-g -O2 -mtune=native" \ CXX="g++ -fsanitize=address -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer" \ CXXFLAGS="-fsanitize=address -g -O2 -Wall -pedantic -mtune=native" \ CXX11FLAGS="-fsanitize=address -g -O2 -Wall -pedantic -mtune=native" \ CXX14FLAGS="-fsanitize=address -g -O2 -Wall -pedantic -mtune=native" \ CXX17FLAGS="-fsanitize=address -g -O2 -Wall -pedantic -mtune=native" \ LDFLAGS="-fsanitize=address" \ MAIN_LDFLAGS="-fsanitize=address -fsanitize=undefined -pthread" \ F77="gfortran -fsanitize=undefined" \ FC="gfortran -fsanitize=undefined" \ FCFLAGS="-g -O2 -mtune=native" \ FFLAGS="-g -O2 -mtune=native" \ ./configure --enable-R-shlib \ --without-blas \ --without-lapack \ --with-readline \ --without-recommended-packages \ --program-suffix=dev \ --disable-openmp \ && make \ && make install \ && make clean [[alternative HTML version deleted]] _______________________________________________ R-SIG-Debian mailing list R-SIG-Debian@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-debian