我希望將我的R包提交給CRAN,該CRAN使用Rcpp
和RcppGSL
。我的問題是我無法構建通過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包相關的輔助信息將被讚賞。
一些複雜情況是由於封裝在包中的C庫導致的。我想與C庫同時構建包。其餘的複雜性是由於我對本地代碼和R包構建過程的理解不夠,我正在努力解決這個問題。 –
我正要對此發表評論。Makefile看起來是這個部分,但你的問題沒有說!但我認爲,你們的缺陷幾乎完全是由於這一點。試着儘可能地簡化它 - 也許只是在src /'中包含所有的庫。 –
(我手動添加了換行符)。你是什麼意思 ? –