由于 i386 构建,无法在窗口中通过 R CMD 检查



我希望将我的R包提交给使用RcppRcppGSL的CRAN。我的问题是我无法构建一个在 win-builder 中通过R CMD check的软件包。我的理解是,因为i386包是构建的,但在R CMD check过程中没有安装和检查。x64包构建并通过检查(当我使用 --no--multiarch 运行检查时)。我的理解有点缺陷,因为我只有有限的时间来让这个 Windows 构建在 64 位上工作。 这是Makevars.win.gen

PKG_CPPFLAGS = $(GSL_CFLAGS) -I"$(LIB_GSL)/include" -I"$(LIB_GSL)/include/gsl" -I../inst/include  -I../inst -Wall -Wno-unused-but-set-variable  -Wno-long-long -Wno-sign-compare -Wno-deprecated -pedantic -pthread -fPIC -O2 -g
ARCH=x64
ifeq "$(WIN)" "64"
ARCH= i386
else
ARCH= x64
endif
RCPPGSL_LDFLAGS = `$(R_HOME)/bin/$(R_ARCH_BIN)/Rscript -e "RcppGSL:::LdFlags()"`
GRAPHM_OBJ =  ./algorithm_ca.o ./algorithm_ext.o ./algorithm_fsol.o  ./algorithm_iden.o ./algorithm_lp.o ./algorithm.o ./algorithm_path.o ./algorithm_qcv.o ./algorithm_rand.o ./algorithm_rank.o ./algorithm_umeyama.o ./algorithm_unif.o ./experiment.o ./graph.o ./hungarian.o  ./rpc.o
GRAPHM_OBJ_REL = $(addprefix ./graphm/,$(GRAPHM_OBJ) )
PKG_LIBS = $(LDFLAGS) -L"$(LIB_GSL)lib"$(R_ARCH_BIN) $(RCPPGSL_LDFLAGS)   $(GSL_LIBS) -lgsl -lgslcblas
CXX ?= g++
SHVER= 1
VPATH= ./graphm:./graphm-0.52

SOURCES=  graphmatch_rcpp.cpp RcppExports.cpp
OBJECTS= $(SOURCES:.cpp=.o) $(GRAPHM_OBJ_REL)
#all: $(SHLIB) $(OBJECTS)
$(SHLIB): $(OBJECTS)
#all:  $(ALLFILES) ../inst/libgraphm.a
#   cd graphm && $(MAKE)
#   $(CXX) $(CXXFLAGS)   $(OBJECTS)  ../inst/libgraphm.a $(PKG_LIBS)
./experiment.o:   experiment.cpp experiment.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c experiment.cpp  -o ./experiment.o
./rpc.o:   rpc.cpp rpc.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c rpc.cpp  -o ./rpc.o
./graph.o:   graph.cpp graph.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c graph.cpp  -o ./graph.o
./hungarian.o:   hungarian.cpp hungarian.h
cd graphm && $(CXX) $(PKG_CPPFLAGS)  -I"$(LIB_GSL)include" -c hungarian.cpp  -o ./hungarian.o
./algorithm.o:   algorithm.cpp algorithm.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm.cpp  -o ./algorithm.o
#graph matching algorithms
./algorithm_ca.o: algorithm_ca.cpp algorithm_ca.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_ca.cpp -o ./algorithm_ca.o
./algorithm_path.o: algorithm_path.cpp algorithm_path.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_path.cpp -o ./algorithm_path.o
./algorithm_ext.o:   algorithm_ext.cpp algorithm_ext.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_ext.cpp  -o ./algorithm_ext.o
./algorithm_fsol.o:   algorithm_fsol.cpp algorithm_fsol.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_fsol.cpp  -o ./algorithm_fsol.o
./algorithm_iden.o:   algorithm_iden.cpp algorithm_iden.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_iden.cpp  -o ./algorithm_iden.o
./algorithm_lp.o:   algorithm_lp.cpp algorithm_lp.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_lp.cpp  -o ./algorithm_lp.o
./algorithm_qcv.o:   algorithm_qcv.cpp algorithm_qcv.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_qcv.cpp  -o ./algorithm_qcv.o
./algorithm_rand.o:   algorithm_rand.cpp algorithm_rand.h
cd graphm && $(CXX) $(PKG_CPPFLAGS)  -I"$(LIB_GSL)include" -c algorithm_rand.cpp  -o ./algorithm_rand.o
./algorithm_rank.o:   algorithm_rank.cpp algorithm_rank.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_rank.cpp  -o ./algorithm_rank.o
./algorithm_umeyama.o:   algorithm_umeyama.cpp algorithm_umeyama.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_umeyama.cpp  -o ./algorithm_umeyama.o
./algorithm_unif.o:   algorithm_unif.cpp algorithm_unif.h
cd graphm && $(CXX) $(PKG_CPPFLAGS) -I"$(LIB_GSL)include" -c algorithm_unif.cpp  -o ./algorithm_unif.o
ALLOBJ: $(OBJECTS) $(GRAPHM_OBJ)
ALLFILES: $(OBJECTS) $(GRAPHM_OBJ_REL) ../inst/libgraphm.a

../inst/libgraphm.a: RcppExports.o $(GRAPHM_OBJ)
ar -rvs ../inst/libgraphm.a $(GRAPHM_OBJ_REL)

clean: cleana cleanb
cleana:
rm $(OBJECTS)
cleanb:
rm $(GRAPHM_OBJ_REL)
#.PHONY: all test clean

顺便说一下,我正在使用这个configure.win将正确的标志传递给Makevars.win。但这真的是不必要的,因为我从 Makevars.win.gen 中删除了@GSL_LIBS@。这是在R CMD检查期间未安装i386版本的原因吗?

ifeq "$(WIN)" "64"
R_ARCH_BIN="/x64"
else
R_ARCH_BIN="/i386"
endif
GSL_CFLAGS=`"${R_HOME}/bin$(R_ARCH_BIN)/Rscript.exe" -e "require(RcppGSL);RcppGSL:::CFlags()"`
GSL_LIBS=`"${R_HOME}/bin$(R_ARCH_BIN)/Rscript.exe"  -e "require(RcppGSL);RcppGSL:::LdFlags()"`
sed -e "s|@GSL_LIBS@|${GSL_LIBS}|" 
-e "s|@GSL_CFLAGS@|${GSL_CFLAGS}|" 
src/Makevars.win.gen > src/Makevars.win

任何与构建依赖于预构建窗口库的多架构 R 包相关的辅助信息将不胜感激。

我认为,你最初的假设是错误的,你可能把这做得太难了。 我认为值得退后一步:

为了在本地构建多架构,您实际上需要在本地进行适当的多架构设置。 这意味着GSL的32位和64位版本。

但是您不必在本地构建 - 您可以将源代码提交给两者

  • 共赢者
  • R 集线器

两者都可以为您运行一个或多个Windows版本! 我在每次上传之前都会使用它们。

另请注意,您不一定需要那么复杂的Makevars.win。 我的 RcppZiggurat 软件包(在 CRAN 上)只有以下两个说明:

PKG_CPPFLAGS = -I. -I../inst/include
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe"  
-e "RcppGSL:::LdFlags()")

(我手动添加了换行符)。

最后,RcppGSL有四个反向依赖,所以你有四个工作示例需要研究。 例如,mvabund 确实

## This assumes that the LIB_GSL variable points to working GSL libraries
PKG_CPPFLAGS=-std=c++0x -Wall -pedantic -I$(LIB_GSL)/include -I. -I../inst/include
PKG_LIBS=-L$(LIB_GSL)/lib -lgsl -lgslcblas 

软件包源代码树中存在 configure.win 强制仅构建主架构,R CMD 检查失败,并显示如下消息

<package> is not installed for architecture -- i386

除非存在 --no-multi-arch。由于Windows的CRAN构建过程会检查两种架构(i386和x64),因此R CMD检查在CRAN提交过程中失败,即使使用-no-multi-arch的本地R CMD检查可能会成功。

最新更新