2017-05-04 44 views
0

我希望將我的R包提交給CRAN,該CRAN使用RcppRcppGSL。我的問題是我無法構建通過R CMD check贏得構建器的包。我的理解是,因爲在R CMD check期間構建了i386包,但沒有安裝和檢查。 x64包建立並通過檢查(當我運行--no - multiarch檢查)。我的理解有點有缺陷,因爲我只有有限的時間讓這個windows版本在64位工作。 這是Makevars.win.gen由於i386構建無法通過R CMD檢查在Windows中由於i386構建

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 build的原因嗎?

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|@[email protected]|${GSL_LIBS}|" \ 
-e "s|@[email protected]|${GSL_CFLAGS}|" \ 
src/Makevars.win.gen > src/Makevars.win 

任何與建立依賴於預先建立的Windows庫的多拱R包相關的輔助信息將被讚賞。

回答

1

您的初始假設是錯誤的,methinks,並且您可能會使這太難。我認爲這是值得回踩:

爲了本地建立多拱門,你實際上需要本地適當的多拱安裝。這意味着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 
+0

一些複雜情況是由於封裝在包中的C庫導致的。我想與C庫同時構建包。其餘的複雜性是由於我對本地代碼和R包構建過程的理解不夠,我正在努力解決這個問題。 –

+0

我正要對此發表評論。Makefile看起來是這個部分,但你的問題沒有說!但我認爲,你們的缺陷幾乎完全是由於這一點。試着儘可能地簡化它 - 也許只是在src /'中包含所有的庫。 –

+0

(我手動添加了換行符)。你是什​​麼意思 ? –

0

configure.win在包源樹力要建只有主架構的存在,R CMD檢查失敗與像

<package> is not installed for architecture -- i386 

除非--no-消息多拱是存在的。由於Windows的CRAN構建過程檢查兩種體系結構(i386和x64),因此即使本地R CMD使用-no-multi-arch檢查可能會成功,R CMD檢查在CRAN提交過程中失敗。

+0

好的。當我需要它時,我在Makevars.win本身中插入了一些依賴於arch的「配置」(這裏是file-fetching) - 參見例如[here](https://github.com/Rblp/Rblpapi/blob/master /src/Makevars.win) –

相關問題