gpt4 book ai didi

R 重新编译包失败,因为失败

转载 作者:行者123 更新时间:2023-12-02 12:24:27 24 4
gpt4 key购买 nike

在我的 Linux 集群上,我在重新编译需要重新编译的 R 包时遇到问题 在最新版本中删除了 libRcpp.so。最终目标是 让 R 包 DEseq2 运行。我们已经安装了新版本 /opt/bin 目录中的 g++ 在 /opt/lib64 中有新库。我有 还创建了具有以下指令的 .R/Makevars:

CXX=/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64

-Wl,-llibstdc++ CC=/opt/bin/c++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++
SHLIB_OPENMP_CXXFLAGS= -fopenmp
<小时/>

“各个版本的 Makevars 都失败了,这只是我的最新尝试 克服链接时找不到 libstdc++ 的加载程序问题 Armadillo 。如您所见,它正在查找 /usr/lib64 而不是 /opt/lib64。就好像我的 -Wl 指令被忽略了。我是 以 sudo 身份运行 R。

我的 .bashrc 也有:

LD_LIBRARY_PATH=/opt/lib64:/opt/lib64/R/library/Rcpp/libs:$LD_LIBRARY_PATH:~/lib:~/perl/lib:~/lib/bamtools

LD_RUN_PATH=/opt/lib64:$LD_RUN_PATH:~/lib

export LD_LIBRARY_PATH
export LD_RUN_PATH
<小时/>

这是当我尝试在 R 中编译需要的新包时得到的结果 重新编译:

<小时/>
    install.packages(onCRAN, lib=lib, repos=rep)
trying URL 'http://cran.rstudio.com/src/contrib/RcppArmadillo_0.4.000.2.tar.gz'
Content type 'application/x-gzip' length 892941 bytes (872 Kb)
opened URL
==================================================
downloaded 872 Kb

* installing *source* package âRcppArmadilloâ ...
** package âRcppArmadilloâ successfully unpacked and MD5 sums checked
* checking LAPACK_LIBS divide-and-conquer complex SVD unavailable via R-supplied LAPACK
* divide-and-conquer algorithm for complex SVD will be redirected to default
** libs
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -I/opt/lib64/R/include -DNDEBUG -I/usr/local/include -I"/opt/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppArmadillo.cpp -o RcppArmadillo.o
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -I/opt/lib64/R/include -DNDEBUG -I/usr/local/include -I"/opt/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -I/opt/lib64/R/include -DNDEBUG -I/usr/local/include -I"/opt/lib64/R/library/Rcpp/include" -I../inst/include -fpic -g -O2 -c fastLm.cpp -o fastLm.o
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/lib64/R/library/Rcpp/libs/Rcpp.so':
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/lib64/R/library/Rcpp/libs/Rcpp.so)
Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
/opt/bin/g++ -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 -Wl,-llibstdc++ -shared -L/usr/local/lib64 -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -L/opt/lib64/R/lib -lRlapack
-L/opt/lib64/R/lib -lRblas -lgfortran -lm
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/opt/lib64/R/library/Rcpp/libs/Rcpp.so':
/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/lib64/R/library/Rcpp/libs/Rcpp.so)`
Calls: ::: ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
Execution halted
/usr/bin/ld: cannot find -llibstdc++
collect2: error: ld returned 1 exit status
make: *** [RcppArmadillo.so] Error 1
ERROR: compilation failed for package âRcppArmadilloâ
* removing â/opt/lib64/RcppArmadilloâ

下载的源码包在

 /tmp/RtmpZty35f/downloaded_packages

警告消息:

In install.packages(onCRAN, lib = lib, repos = rep) :
installation of package RcppArmadillo had non-zero exit code

最佳答案

两条简短的评论:

  1. CXX=/opt/bin/g++ 中CXX的定义 -Wl,-rpath,/opt/lib64 -Wl,-L,/opt/lib64 有点不寻常,因为它混合了链接器指令(对于 ld 二进制文件)。如果没有,我会再试一次。

  2. 编译 RcppArmadillo 时出现的错误没有什么意义,它应该尝试加载 libRcpp.so'GLIBCXX_3.4.9' not found 表明您可能设置了路径。

我会尝试更简单的设置,更少的花哨的东西,然后从内到外工作:重建/重新安装 Rcpp,然后是 RcppArmadillo 等等。它适用于很多使用更标准设置的人。

关于R 重新编译包失败,因为失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21597018/

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