R package with c++ code failed installation, No DLL was created

为君一笑 提交于 2019-12-08 02:12:11

问题


I'm currently working on an R package which uses C++ code and includes external libraries (dlib, boost and an optimization library developed in the group). We're using Rcpp to integrate R and C++, but the problem is the package always fails to compile, and none of the similar questions I've found out there have worked for me.

The report generated by R CMD check is:

* installing *source* package 'IRTppExperimental' ...
** libs

*** arch - i386
c:/Rtools/mingw_32/bin/g++  -std=c++0x -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG    -I"C:/Users/Camilo/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"  -I../src/include   -O2 -Wall  -mtune=core2 -c RcppExports.cpp -o RcppExports.o
c:/Rtools/mingw_32/bin/g++  -std=c++0x -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG    -I"C:/Users/Camilo/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"  -I../src/include   -O2 -Wall  -mtune=core2 -c rcpp_hello_world.cpp -o rcpp_hello_world.o
c:/Rtools/mingw_32/bin/g++  -std=c++0x -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG    -I"C:/Users/Camilo/Documents/R/win-library/3.3/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"  -I../src/include   -O2 -Wall  -mtune=core2 -c test_multi.cpp -o test_multi.o
c:/Rtools/mingw_32/bin/g++ -shared -s -static-libgcc -o IRTppExperimental.dll tmp.def RcppExports.o rcpp_hello_world.o test_multi.o -LC:/PROGRA~1/R/R-33~1.1/bin/i386 -lRlapack -LC:/PROGRA~1/R/R-33~1.1/bin/i386 -lRblas IRTppExperimental.dll -L../src/include -Ld:/Compiler/gcc-4.9.3/local330/lib/i386 -Ld:/Compiler/gcc-4.9.3/local330/lib -LC:/PROGRA~1/R/R-33~1.1/bin/i386 -lR
g++.exe: error: IRTppExperimental.dll: No such file or directory
no DLL was created
ERROR: compilation failed for package 'IRTppExperimental'
* removing 'C:/Users/Camilo/Documents/UNAL/MIRT/Tests/Temps/IRTppExperimental.Rcheck/IRTppExperimental'

And the Makevars/Makevars.win files are as follows:

INCFOLDER = ../src/include
PKG_LIBS += $(LAPACK_LIBS) $(BLAS_LIBS) $(FPICFLAGS) $(SHLIB)
PKG_LIBS += -L$(INCFOLDER)
PKG_CXXFLAGS+=-I$(INCFOLDER)
CXXFLAGS+="-fno-stack-protector"
CXX_STD = CXX11

Lastly, the NAMESPACE file reads:

exportPattern("^[[:alpha:]]+")
importFrom(Rcpp,sourceCpp)
useDynLib(IRTppExperimental)

All the c++ source files are inside the src folder, including the external libraries. The package was created using the Rcpp.package.skeleton function, and used the compileAtributes function to create the RcppExports source files.

EDIT: As pointed out by Coatless, here is github link of the project: https://github.com/SICSresearch/IRTpp/tree/Uni-Multi-Merging

来源:https://stackoverflow.com/questions/38575678/r-package-with-c-code-failed-installation-no-dll-was-created

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!