Reputation: 123
I wrote an R package called arbintools
for some work-related data analysis and put it on Github. I wrote it and have been using it on my Mac for a while without issue; Today, I tried to install the dev-1 branch on a Windows 7 laptop and something related to compiling some Rcpp functions seems to go wrong:
devtools::install_github("mjlacey/arbintools", ref = "dev1")
I get this:
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:\Rtools\mingw_32\bin\nm.exe: RcppExports.o: File format not recognized
C:\Rtools\mingw_32\bin\nm.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)
Installing other packages requiring some compilation (like dplyr
) worked fine. I also updated R on my Mac to the same version (3.3.0) and reinstalled the package successfully, it's just on the Windows PC it doesn't work. This is beyond my understanding, if anyone has a suggestion or solution I'd be very grateful.
Upvotes: 2
Views: 2501
Reputation: 20746
The issue is the .so
and .o
files are only viable with the same architecture e.g. OS X is 64 bit and Windows is 32bit (mingw_32
). Please remove them from dev-1/src and then you should be good to go. These files are automatically built on package install as they are the result of using a compiler.
After they are removed, try to create a .gitignore
file with the following:
src/*.o
src/*.so
src/*.dll
This will make OS specific files not selectable for staging and, in turn, commits.
As a general rule of thumb, only keep .cpp
or .h
files within /src
while using Rcpp
.
Upvotes: 9