我想安装 processx 库,因为它是我正在使用的 BioConductor 包的必需包。使用 install.packages("processx") 时出现以下错误
错误
gcc -g -O2 -Wall tools/px.c -o tools/px
gcc -g -O2 supervisor/supervisor.c supervisor/utils.c \
-o supervisor/supervisor
supervisor/supervisor.c: In function 'kill_children':
supervisor/supervisor.c:149:5: error: 'for' loop initial declarations are only allowed in C99 mode
for (int i=0; i<n_children; i++) {
^
supervisor/supervisor.c:149:5: note: use option -std=c99 or -std=gnu99 to compile your code
我参考了这篇文章,它通过 withr 库提供了一个解决方案。当我使用安装集群库时遇到类似问题时,它已经工作了。我跑了
withr::with_makevars(c(PKG_CFLAGS = "-std=c99"), # Use C++ from '99
install.packages("processx"),
assignment = "+=")
# Alternatively, I tried
withr::with_makevars(c(PKG_CFLAGS = "-std=gnu99"), # Use C++ from '99
install.packages("processx"),
assignment = "+=")
我收到了同样的错误,所以我尝试直接从命令行安装包
R --no-save <<< "install.packages('processx', repos = 'http://cran.us.r-project.org')"
当我在安装 ggplot2 时收到同样的错误时,这已经奏效了。我在其他 stackoverflow 帖子中阅读了有关 gcc 的信息,但我不熟悉该过程。任何帮助,将不胜感激!
R 会话信息
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux
Matrix products: default
BLAS/LAPACK: /zapps7/intel_parallel_studio_xe/2020/compilers_and_libraries_2020.0.166/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so
locale:
[1] C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] withr_2.4.1
loaded via a namespace (and not attached):
[1] compiler_4.0.0 tools_4.0.0