gpt4 book ai didi

R-devel 带有来自摇杆的 sanitizer

转载 作者:行者123 更新时间:2023-12-05 00:09:50 27 4
gpt4 key购买 nike

我正在尝试使用来自 rocker 的 ASAN USBAN 安装 R devel .按照自述文件我试过:

sudo docker run --rm -ti rocker/r-devel-san

这花了很长时间下载,但最后没问题。然后我安装了 sanitizers用于针对已知错误测试 R 的软件包。
install.package("sanitizers")

我试图得到一个错误
> sanitizers::stackAddressSanitize(42)
[1] 24
> sanitizers::heapAddressSanitize(1)
[1] 0

我没有收到任何错误,所以我猜我用 docker 运行的 R 版本不是用 sanitizer 支持构建的。或者我只是在某个地方错过了一些东西。这是我第一次使用 docker。

最佳答案

确保您开始RD而不是 R .然后它按预期对我有用:

> install.packages("sanitizers")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'http://cloud.r-project.org/src/contrib/sanitizers_0.1.0.tar.gz'
Content type 'application/x-gzip' length 3963 bytes
==================================================
downloaded 3963 bytes

* installing *source* package ‘sanitizers’ ...
** package ‘sanitizers’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++98 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -Wall -pedantic -mtune=native -c heap_address.cpp -o heap_address.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++98 -I"/usr/local/lib/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -Wall -pedantic -mtune=native -c stack_address.cpp -o stack_address.o
g++ -fsanitize=undefined,bounds-strict -fno-omit-frame-pointer -std=gnu++98 -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o sanitizers.so heap_address.o stack_address.o -L/usr/local/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-sanitizers/00new/sanitizers/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (sanitizers)

The downloaded source packages are in
‘/tmp/RtmpqpZ0Zg/downloaded_packages’
> sanitizers::stackAddressSanitize(42)
stack_address.cpp:16:32: runtime error: index 142 out of bounds for type 'int [100]'
stack_address.cpp:16:11: runtime error: load of address 0x7fff11a2da88 with insufficient space for an object of type 'int'
0x7fff11a2da88: note: pointer points here
ff 7f 00 00 00 00 00 00 00 00 00 00 b0 a1 85 ce d0 55 00 00 e3 b1 cb da ed 7f 00 00 78 88 fa cf
^
[1] 0
>

简而言之,就像在 r-devel 中一样容器你想要的非 Vanilla 版本是 RD而不是 R这是来自标准二进制包的普通 R。

关于R-devel 带有来自摇杆的 sanitizer ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59850638/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com