【问题标题】:Installing the R package PearsonDS gives clang unexpected token error安装 R 包 PearsonDS 给出了意外的令牌错误
【发布时间】:2020-07-07 09:52:20
【问题描述】:

我在安装 R 软件包 PearsonDS 时遇到问题。在 RStudio 中,我运行:

> install.packages("PearsonDS")
Warning in install.packages :
  unable to access index for repository https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6:
  cannot open URL 'https://cran.rstudio.com/bin/macosx/el-capitan/contrib/3.6/PACKAGES'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘PearsonDS’
Do you want to attempt to install these from sources? (Yes/no/cancel) Yes
installing the source package ‘PearsonDS’

trying URL 'https://cran.rstudio.com/src/contrib/PearsonDS_1.1.tar.gz'
Content type 'application/x-gzip' length 63798 bytes (62 KB)
==================================================
downloaded 62 KB

* installing *source* package ‘PearsonDS’ ...
** package ‘PearsonDS’ successfully unpacked and MD5 sums checked
** using staged installation
checking whether x86 FPU control code is needed... yes
checking for gcc... clang
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables
See `config.log' for more details.
ERROR: configuration failed for package ‘PearsonDS’
* removing ‘/Library/Frameworks/R.framework/Versions/3.6/Resources/library/PearsonDS’
Warning in install.packages :
  installation of package ‘PearsonDS’ had non-zero exit status

The downloaded source packages are in
    ‘/private/var/folders/03/32f1q0m9187czl2dwcms4jgr0000gn/T/RtmpKg5AWd/downloaded_packages’

所以,我从https://cloud.r-project.org/src/contrib/下载了包,打开PearsonDS_1.1.tar文件后,进入终端的PearsonDS文件夹并运行R CMD INSTALL .config.log中的错误内容如下

## ----------- ##
## Core tests. ##
## ----------- ##

configure:1660: checking whether x86 FPU control code is needed
configure:1673: result: yes
configure:1729: checking for gcc
configure:1756: result: clang
configure:1994: checking for C compiler version
configure:2001: clang --version >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
configure:2004: $? = 0
configure:2011: clang -v >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
configure:2014: $? = 0
configure:2021: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:2024: $? = 1
configure:2047: checking for C compiler default output file name
configure:2074: clang -Wall -g -O2 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include  conftest.c  >&5
ld: unexpected token: !tapi-tbd-v2 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:2077: $? = 1
configure:2115: result: 
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "PearsonDS"
| #define PACKAGE_TARNAME "pearsonds"
| #define PACKAGE_VERSION "0.91"
| #define PACKAGE_STRING "PearsonDS 0.91"
| #define PACKAGE_BUGREPORT "m@rtinbecker.de"
| #define X86 1
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2122: error: C compiler cannot create executables
See `config.log' for more details.

我该如何解决?我查找了类似的错误(例如,https://trac.macports.org/ticket/54506?cversion=0&cnum_hist=2),但我没有设法解决问题。

我当前的 R 会话是:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.6.1 tools_3.6.1    yaml_2.2.1    

【问题讨论】:

  • 第二个错误R CMD INSTALL听起来好像没有写o文件的地方写权限。
  • 嗨,克里斯,感谢您的建议。为什么说我没有写权限?我尝试了sudo R CMD INSTALL .,但我得到了同样的错误。

标签: r linker clang token x86-64


【解决方案1】:

您是否按照here 的建议尝试了最新的 ld64 或“ld64_xcode 变体”?

【讨论】:

  • 谢谢。我该如何安装?我试过sudo port install ld64 +ld64_xcode,但它不起作用(sudo: port: command not found
  • 恐怕这本身就是另一个问题,我不知道答案。
【解决方案2】:

我在 RStudio 控制台中输入了install.packages('PearsonDS'),它对我有用。尝试以完全相同的方式复制粘贴我的行。可能会有一些细微差别。您还需要Rtools 以使工作更轻松

【讨论】:

    【解决方案3】:

    虽然我没有 MacOS,但我知道当我无法在 Ubuntu 中编译某些东西时,我会查看开发库。

    环顾四周,我发现了这个

    sudo apt install libc6-dev
    

    见:https://askubuntu.com/questions/647583/how-to-fix-configure-error-c-compiler-cannot-create-executables

    【讨论】:

      猜你喜欢
      • 2014-12-26
      • 1970-01-01
      • 1970-01-01
      • 2020-04-21
      • 2019-06-20
      • 2019-05-29
      • 1970-01-01
      • 1970-01-01
      • 2017-05-14
      相关资源
      最近更新 更多