Hi, Recently, I made an R package that used the C++ library Boost.Thread (http://www.boost.org/doc/libs/1_54_0/doc/html/thread.html) for multithreading. Previously, I have posted a question at stackoverflow (http://stackoverflow.com/questions/19651954/is-it-possible-to-build-an-r-package-which-use-rcpp-and-boost-thread-on-http), and I also asked at rcpp-devel (http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2013-November/006777.html). Dirk Eddelbuettel suggested me ask here. After some tries on win-builder and some research on CRAN, there are still some doubts:
1) For my package to be accepted by CRAN, I am not so sure if it is acceptable to let users to install Boost library themselves? If not, are there any solutions? I found there are some third party external software or libraries used by other R packages, such as OpenMP and gtk, some of which have corresponding R packages, but there are little discuss about Boost. (I now know there are some other ways to host my package, but I think CRAN is more straight forward, though it may be stricter.) 2) As I said in my question at stackoverflow (http://stackoverflow.com/questions/19651954/is-it-possible-to-build-an-r-package-which-use-rcpp-and-boost-thread-on-http), I have tried MAKE variable BOOSTLIB on win-builder (http://win-builder.r-project.org/), It is OK for header-only Boost libraries. I am not sure whether it is OK for separately-compiled libraries such as Boost.Thread, after many fails. Is it possible? Are there any special variables or path for Boost.Thread? May I suppose that it is acceptable for 1) if there are, or at least for header-only Boost libraies? (There are an R package called BH provides header-only Boost libraries, but BOOSTLIB make me imagine something else.) Simon PS: Below are the source files and results of my tries for exploring BOOSTLIB on win-builder, please forgive me use win-builder as a test machine, so I post my questions here. The test package is derived from command Rscript -e "Rcpp.package.skeleton()", below just lists some modifications by me. The outputs in 00install.out are too long to be pasted here. ------------------------------- rcpp_hello_world.cpp ------------------------------- #include "rcpp_hello_world.h" #include "boost/lambda/lambda.hpp" #include <iostream> #include <iterator> #include <algorithm> #include <vector> #include "boost/thread.hpp" void wait(int seconds) { boost::this_thread::sleep(boost::posix_time::seconds(seconds)); } void thread() { for (int i = 0; i < 5; i++) { wait(1); std::cout << i << std::endl; } } SEXP rcpp_hello_world(){ using namespace Rcpp ; using namespace boost::lambda; std::vector<int> a; a.push_back(1); a.push_back(2); // std::for_each( a.begin(), a.end(), _1 = 1); boost::thread t(thread); t.join(); return wrap(a); } ------------------------------- Makevars.win (try 1: try to find if there is a file called libboost_thread*) ------------------------------- ## Use the R_HOME indirection to support installations of multiple R version ## PKG_CXXFLAGS = `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` PKG_CPPFLAGS = -I${BOOSTLIB} PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") ${BOOSTLIB}/lib/libboost_thread* ------------------------------- Makevars.win (try 2: try to find something in lib) ------------------------------- ## Use the R_HOME indirection to support installations of multiple R version ## PKG_CXXFLAGS = `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` PKG_CPPFLAGS = -I${BOOSTLIB} PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") `ls ${BOOSTLIB}/lib/*` ------------------------------- Makevars.win (try 3: try to find something in libs) ------------------------------- ## Use the R_HOME indirection to support installations of multiple R version ## PKG_CXXFLAGS = `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` PKG_CPPFLAGS = -I${BOOSTLIB} PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") `ls ${BOOSTLIB}/libs/*` ------------------------------- Makevars.win (try 4: try to figure out what are in ${BOOSTLIB}) ------------------------------- ## Use the R_HOME indirection to support installations of multiple R version ## PKG_CXXFLAGS = `$(R_HOME)/bin/Rscript -e "Rcpp:::CxxFlags()"` PKG_CPPFLAGS = -I${BOOSTLIB} PKG_LIBS = $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "Rcpp:::LdFlags()") `ls ${BOOSTLIB}/*` [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel