构建 R 包导致 R 崩溃
Building R package causes R to crash
当我尝试构建我创建的包时,我正在尝试诊断导致 R 崩溃的原因,但我不确定接下来要采取什么步骤。
我最初使用 RStudio 和 devtools
创建了这个包。在写了几个函数后,我 运行 devtools::document()
,但是这导致 RStudio 崩溃了。当我重新打开项目时,document()
运行 没有崩溃,但 RStudio 在 devtools::build()
之后崩溃了。我重新打开 RStudio,这次 build()
运行 没有出现错误,我能够单击 Install and Restart
来安装包。单击后 Install and Restart
RStudio 有时会崩溃,有时不会。
我决定在没有 RStudio 的情况下直接通过 运行ning R 尝试 build
和 document
命令。我从项目目录中删除了 man
文件夹和 NAMESPACE
文件。然后,在将工作目录设置为包的目录后,我 运行 devtools::document()
,其中 运行 没有错误并生成了 man
文件夹和 NAMESPACE
文件.然后我 运行 devtools::build()
使 R 崩溃。崩溃消息如下。但是,当我重新启动 R 并再次 运行 build()
时,它 运行 没有错误。然后我从命令行 运行 R CMD INSTALL
安装了包,没有错误。
我不确定接下来要采取什么步骤。当我直接在 R 脚本中创建和使用它们时,包 运行 中的所有函数都没有错误。 roxygen
文档注释中是否存在导致崩溃的一个或多个函数的内容?
如果了解它可能会有所帮助,该软件包包含一个文件 imports.r
,其中包含以下导入内容:
#' @importFrom fst read.fst
#' @importFrom lubridate today
#' @import readr
#' @import readxl
#' @import dplyr
NULL
我可以提供其他信息,例如包的详细信息和代码、崩溃日志等。我使用的是 Macbook Pro 运行ning Sierra (10.12.6),R 3.4.2 , devtools 1.13.3.9000, roxygen2 6.0.1, 和 RStudio 1.1.383.
这是 R 在第一次 运行ning build()
之后的崩溃消息:
*** 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, was able to track down and fix the issue. The github issue page 的开发者 Marcus Klik 有详细信息。向下滚动到线程末尾附近的 Marcus Klik 评论以了解主要发现。
当我尝试构建我创建的包时,我正在尝试诊断导致 R 崩溃的原因,但我不确定接下来要采取什么步骤。
我最初使用 RStudio 和 devtools
创建了这个包。在写了几个函数后,我 运行 devtools::document()
,但是这导致 RStudio 崩溃了。当我重新打开项目时,document()
运行 没有崩溃,但 RStudio 在 devtools::build()
之后崩溃了。我重新打开 RStudio,这次 build()
运行 没有出现错误,我能够单击 Install and Restart
来安装包。单击后 Install and Restart
RStudio 有时会崩溃,有时不会。
我决定在没有 RStudio 的情况下直接通过 运行ning R 尝试 build
和 document
命令。我从项目目录中删除了 man
文件夹和 NAMESPACE
文件。然后,在将工作目录设置为包的目录后,我 运行 devtools::document()
,其中 运行 没有错误并生成了 man
文件夹和 NAMESPACE
文件.然后我 运行 devtools::build()
使 R 崩溃。崩溃消息如下。但是,当我重新启动 R 并再次 运行 build()
时,它 运行 没有错误。然后我从命令行 运行 R CMD INSTALL
安装了包,没有错误。
我不确定接下来要采取什么步骤。当我直接在 R 脚本中创建和使用它们时,包 运行 中的所有函数都没有错误。 roxygen
文档注释中是否存在导致崩溃的一个或多个函数的内容?
如果了解它可能会有所帮助,该软件包包含一个文件 imports.r
,其中包含以下导入内容:
#' @importFrom fst read.fst
#' @importFrom lubridate today
#' @import readr
#' @import readxl
#' @import dplyr
NULL
我可以提供其他信息,例如包的详细信息和代码、崩溃日志等。我使用的是 Macbook Pro 运行ning Sierra (10.12.6),R 3.4.2 , devtools 1.13.3.9000, roxygen2 6.0.1, 和 RStudio 1.1.383.
这是 R 在第一次 运行ning build()
之后的崩溃消息:
*** 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, was able to track down and fix the issue. The github issue page 的开发者 Marcus Klik 有详细信息。向下滚动到线程末尾附近的 Marcus Klik 评论以了解主要发现。