2015-10-16 64 views
2

我在這個問題上摸不着頭腦。如何在家裏,在Ubuntu上重現 CRAN's gcc ubsan tests of my package的結果? (在準備步驟的指示來自here在ubuntu上重現CRAN GCC-UBSAN測試結果「在家」

1)我安裝更新所有需要的軟件包:

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)內置Rdevel與所需的選項:

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)最後,使用as-cran標誌在本地構建/編譯所述軟件包:

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 

但是我沒有得到和cran一樣的bug報告(參見here)。我的意思是例如這一個:

/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 

我使用的腳本有什麼問題?

回答

2

另外的現成解決方案似乎可以用r-hub package/service,在類似的方式devtools::check()工作,你只需要運行

rhub::check_with_sanitizers() 
+0

這是最簡單的方法 – user189035

+0

當我編寫答案時,這當然是不可用的......但至少容器幫助Gabor建立r-hub。 –

2

這是可行的,但相當一些工作。而且它也是docker非常適合的主要人選。所以,我創建了兩個不同的Docker容器:

相應的泊塢窗圖像上the Docker hub準備好您的下載。我也寫了一個longer blog post about this for UBSAN

+0

我不知道我做錯了。輸入'docker run --rm -ti -v $(pwd):/ mnt rocker/r-devel-ubsan-clang check.r --setwd/mnt --install-deps RcppAnnoy_0.0.5.tar.gz'來自博客帖子我得到了''下載的源代碼包在 \t'/ tmp/downloaded_pa​​ckages' 警告:'RcppAnnoy_0.0.5.tar.gz'既不是文件也不是目錄,跳過' – user189035

+0

也許使用'/ bin/bash'爲一個shell並手工運行'RD CMD check ...'。 –

+0

(我的意思是,我得到'* DONE(RcppAnnoy) 下載的源包在 \t '的/ tmp/downloaded_pa​​ckages' 警告: 'RcppAnnoy_0.0.5.tar.gz' 既不是一個文件也不是目錄,skipping') – user189035