2017-05-04 2 views
0

Je souhaite soumettre mon package R à CRAN qui utilise Rcpp et RcppGSL. Mon problème est que je suis incapable de générer un package qui passe R CMD check dans win-builder. Ma compréhension est que parce que le paquet i386 est construit, mais pas installé et vérifié pendant R CMD check. Le paquet x64 construit et passe les vérifications (quand je cours vérifier avec --no - multiarch). Ma compréhension est un peu erronée, car j'avais peu de temps pour que cette version de Windows fonctionne en 64 bits. Ce est le Makevars.win.genimpossible de transmettre R CMD vérifier dans windows en raison de i386 build

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 

Soit dit en passant, je me sers de ce configure.win pour passer les drapeaux à droite Makevars.win. Mais c'est vraiment inutile, puisque j'ai supprimé @ GSL_LIBS @ de Makevars.win.gen. Est-ce la raison pour laquelle i386 build n'est pas installé lors de la vérification R CMD?

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 

Toute information auxiliaire qui est pertinente pour la construction d'un ensemble de R multiarchitecture qui dépend de fenêtres pré-construit les bibliothèques seraient appréciées.

Répondre

1

Vos hypothèses de départ sont fausses, il me semble, et vous pourriez rendre cela trop difficile. Je pense qu'il vaut la peine de faire marche arrière:

Pour localement construire multi-arch, vous avez réellement besoin d'une configuration multi-arch appropriée localement. Cela impliquerait des builds 32 et 64 bits du GSL.

Mais vous ne devez pas construire localement - vous pouvez soumettre vos sources à la fois

  • gagnant-constructeur
  • R Hub

les deux peuvent exécuter un ou plusieurs Windows construit pour vous! Je les utilise avant chaque téléchargement.

Notez également que vous n'avez pas nécessairement besoin d'un Makevars.win si compliqué. Mon paquet RcppZiggurat (sur CRAN) vient de ces deux instructions:

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()") 

(et j'ajouté le saut de ligne à la main). Enfin, RcppGSL a quatre Depends inverses, donc vous avez quatre exemples de travail à étudier. Par exemple, mvabund ne

## 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

Une partie de la complication est due à la bibliothèque C qui est enroulée autour du package. Je veux construire le paquet en même temps que la bibliothèque C. Le reste de la complication est due à ma faible compréhension du code natif et du processus de construction du paquet R que j'essaie de résoudre. –

+0

J'étais sur le point de commenter cela.Le Makefile regarde la partie, mais votre question n'a pas dit! Mais vos difficultés sont, je pense, presque entièrement dues à cela. Essayez de simplifier cela autant que vous le pouvez - peut-être simplement inclure toute cette bibliothèque dans 'src /'. –

+0

(et j'ai ajouté le changement de ligne à la main). Que veux-tu dire par là ? –

0

L'existence de configure.win dans les forces de l'arbre source du package que l'architecture principale à construire, vérifier R CMD échoue avec un message comme

<package> is not installed for architecture -- i386 

moins --no- multi-arch est présent. Puisque le processus de construction CRAN pour Windows vérifie les deux architectures (i386 et x64), les vérifications R CMD échouent pendant le processus de soumission CRAN, même si les vérifications CMD locales avec -no-multi-arch peuvent réussir.

+0

Bonne prise. Quand j'en avais besoin, j'ai placé une «configuration» dépendant de l'architecture (ici: extraction de fichier) dans Makevars.win lui-même - voir par exemple [ici] (https://github.com/Rblp/Rblpapi/blob/master /src/Makevars.win) –