I'm scratching my head on this one. How to reproduce the results of CRAN's gcc ubsan tests of my package at home, on ubuntu? (the instructions on the preparation steps come from here)
1) I install-update all needed packages:
apt-get update
apt-get install bash-completion bison debhelper default-jdk g++ gcc gfortran groff-base libblas-dev libbz2-dev libcairo2-dev libcurl4-openssl-dev libjpeg-dev liblapack-dev liblzma-dev libncurses5-dev libpango1.0-dev libpcre3-dev libpng-dev libreadline-dev libtiff5-dev libx11-dev libxt-dev mpack subversion tcl8.5-dev texinfo texlive-base texlive-extra-utils texlive-fonts-extra texlive-fonts-recommended texlive-generic-recommended texlive-latex-base texlive-latex-extra texlive-latex-recommended tk8.5-dev valgrind x11proto-core-dev xauth xdg-utils xfonts-base xvfb zlib1g-dev
2) Built Rdevel with the needed options:
cd /tmp
svn co http://svn.r-project.org/R/trunk R-devel
cd /tmp/R-devel
R_PAPERSIZE=letter R_BATCHSAVE="--no-save --no-restore" 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 CFLAGS="-pipe -std=gnu99 -Wall -pedantic -O2" CXXFLAGS="-pipe -Wall -pedantic -O2" CC="gcc -fsanitize=address,undefined" CXX="g++ -fsanitize=address,undefined" CXX1X="g++ -fsanitize=address,undefined" FC="gfortran -fsanitize=address,undefined" F77="gfortran -fsanitize=address,undefined" ./configure --enable-R-shlib --without-blas --without-lapack --with-readline --without-recommended-packages --program-suffix=dev --disable-openmp
make
make install
make clean
3) finally, build/compile said package locally with the as-cran flag:
wget https://cran.r-project.org/src/contrib/FastRCS_0.0.6.tar.gz
tar -xvzf FastRCS_0.0.6.tar.gz
Rdevel CMD check --as-cran FastRCS
But I don't get the same bug report as on cran (see here). I mean for example this one:
/usr/local/gcc5/lib/gcc/x86_64-unknown-linux-gnu/5.2.0/include/emmintrin.h:140:21: runtime error: load of misaligned address 0x61800007fc84 for type 'const double', which requires 8 byte alignment
0x61800007fc84: note: pointer points here
00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f 00 00 80 3f
What is wrong with the script I use?
Another out-of-the-box solution seems to be using r-hub package / service, that works in similar fashion as devtools::check()
, you just need to run
rhub::check_with_sanitizers()