加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

* .o:Windows 7无法识别文件格式

发布时间:2020-12-13 23:44:58 所属栏目:Windows 来源:网络整理
导读:我写了一个名为 arbintools 的R软件包,用于一些与工作相关的数据分析,并把它放在 Github上.我写了它并且已经在我的Mac上使用它一段时间没有问题;今天,我尝试在Windows 7笔记本电脑上安装 dev-1 branch,并且编译一些Rcpp功能的相关内容似乎出错了: devtools:
我写了一个名为 arbintools的R软件包,用于一些与工作相关的数据分析,并把它放在 Github上.我写了它并且已经在我的Mac上使用它一段时间没有问题;今天,我尝试在Windows 7笔记本电脑上安装 dev-1 branch,并且编译一些Rcpp功能的相关内容似乎出错了:
devtools::install_github("mjlacey/arbintools",ref = "dev1")

我明白了:

Downloading GitHub repo mjlacey/arbintools@dev1
from URL https://api.github.com/repos/mjlacey/arbintools/zipball/dev1
Installing arbintools
"C:/PROGRA~1/R/R-33~1.0/bin/x64/R" --no-site-file --no-environ --no-save  
  --no-restore --quiet CMD INSTALL  
  "C:/Users/matla332.USER/AppData/Local/Temp/Rtmp8WWkKC/devtools124c45026af1/mjlacey-arbintools-41dc363"  
  --library="C:/Users/matla332.USER/Documents/R/win-library/3.3"  
  --install-tests 

* installing *source* package 'arbintools' ...
** libs

*** arch - i386
C:Rtoolsmingw_32binnm.exe: RcppExports.o: File format not recognized
C:Rtoolsmingw_32binnm.exe: Rcpp_functions.o: File format not recognized
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o arbintools.dll tmp.def RcppExports.o Rcpp_functions.o -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-33~1.0/bin/i386 -lR
RcppExports.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
no DLL was created
ERROR: compilation failed for package 'arbintools'
* removing 'C:/Users/matla332.USER/Documents/R/win-library/3.3/arbintools'
* restoring previous 'C:/Users/matla332.USER/Documents/R/win-library/3.3/arbintools'
Error: Command failed (1)

安装其他需要编译的软件包(如dplyr)工作正常.我还在我的Mac上将R更新为相同版本(3.3.0)并成功重新安装了软件包,它只是在Windows PC上无法正常工作.这超出了我的理解,如果有人有任何建议或解决方案,我将非常感激.

问题是.so和.o文件仅适用于相同的架构,例如OS X为64位,Windows为32位(mingw_32).请从 dev-1/src删除它们然后你应该好好去.这些文件是在程序包安装时自动构建的,因为它们是使用编译器的结果.

删除它们后,尝试使用以下命令创建.gitignore文件:

src/*.o
src/*.so
src/*.dll

这将使操作系统特定的文件无法用于登台,反过来也可以提交.

作为一般经验法则,在使用Rcpp时,只在/ src中保留.cpp或.h文件.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读