gpt4 book ai didi

r - 构建R软件包会导致R崩溃

转载 作者:行者123 更新时间:2023-12-03 17:07:26 30 4
gpt4 key购买 nike

当我尝试构建自己创建的程序包时,我试图诊断是什么导致R崩溃,但我不确定下一步该怎么做。

我最初使用RStudio和devtools创建了程序包。在编写了几个函数之后,我运行了devtools::document(),但这导致RStudio崩溃。当我重新打开项目时,document()运行时没有崩溃,但是RStudio在devtools::build()之后崩溃了。我重新打开了RStudio,这次build()正常运行,我可以单击Install and Restart安装该软件包。单击Install and Restart后,RStudio有时会崩溃,有时不会崩溃。

我决定在不使用RStudio的情况下直接运行R来尝试builddocument命令。我从项目目录中删除了man文件夹和NAMESPACE文件。然后,在将工作目录设置为软件包的目录后,我运行了devtools::document(),该程序运行无误,并生成了man文件夹和NAMESPACE文件。然后我运行了R崩溃的devtools::build()。崩溃消息如下。但是,当我重新启动R并再次运行build()时,它运行无误。然后,我从命令行运行R CMD INSTALL,它安装了程序包,没有错误。

我不确定接下来要采取什么步骤。当我直接在R脚本中创建和使用它们时,程序包中的所有函数运行都没有错误。 roxygen文档注释中是否可能包含导致崩溃的一个或多个函数的某些内容?

如果可能会有所帮助,则该软件包包括一个带有以下导入的imports.r文件:

#' @importFrom fst read.fst
#' @importFrom lubridate today
#' @import readr
#' @import readxl
#' @import dplyr
NULL

我可以提供其他信息,例如有关软件包的详细信息和代码,崩溃日志等。我在运行Sierra(10.12.6),R 3.4.2,devtools 1.13.3.9000,roxygen2 6.0.1的Macbook Pro上,以及RStudio 1.1.383。

这是第一次运行 build()后来自R的崩溃消息:
 *** caught illegal operation ***
address 0x7fff9f32eae4, cause 'illegal opcode'

Traceback:
1: process_initialize(self, private, command, args, commandline, stdout, stderr, cleanup, echo_cmd, windows_verbatim_args, windows_hide_window)
2: .subset2(public_bind_env, "initialize")(...)
3: process$new(command, args, commandline, echo_cmd = echo_cmd, windows_verbatim_args = windows_verbatim_args, windows_hide_window = windows_hide_window, stdout = "|", stderr = "|")
4: run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout)
5: force(code)
6: with_envvar(env, run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout))
7: eval(substitute(expr), data, enclos = parent.frame())
8: eval(substitute(expr), data, enclos = parent.frame())
9: with.default(options, with_envvar(env, run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout)))
10: with(options, with_envvar(env, run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout), stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback, stderr_callback = real_block_callback, echo_cmd = echo, echo = show, spinner = spinner, error_on_status = fail_on_status, timeout = timeout)))
11: run_r(options)
12: callr::rcmd_safe(..., env = env)
13: with_build_tools(callr::rcmd_safe(..., env = env), required = required)
14: rcmd_build_tools(cmd, c(path, args), wd = out_dir, show = !quiet, echo = !quiet, fail_on_status = TRUE, required = FALSE)
15: force(code)
16: withr::with_temp_libpaths(rcmd_build_tools(cmd, c(path, args), wd = out_dir, show = !quiet, echo = !quiet, fail_on_status = TRUE, required = FALSE))
17: pkgbuild::build(path = path, dest_path = dest_path, binary = binary, vignettes = vignettes, manual = manual, args = args, quiet = quiet, ...)
18: devtools::build()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection:

最佳答案

只是为了解决这个问题:fst package的开发人员Marcus Klik能够找到并解决此问题。 github issue page包含详细信息。在主题结尾附近,向下滚动至Marcus Klik的评论以获取关键发现。

关于r - 构建R软件包会导致R崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47420602/

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