Is it possible to build an R package, which use Rcpp and Boost.Thread, on [win-builder](http://win-builder.r-project.org/)?

微笑、不失礼 提交于 2019-12-12 11:52:53

问题


Recently, I have made an R package, which use Rcpp to integrate R and C++. And the C++ library Boost is used for multithreading. I wonder if is it possible for my package to be built on http://win-builder.r-project.org/?

I found that a Make variable --- BOOSTLIB --- is defined, as shown in http://cran.r-project.org/bin/windows/contrib/ThirdPartySoftware.html.

I tried to use the header-only libraries, it's OK, but when I tried to use separately-compiled library Boost.Thread, either "no such file" or "undefined reference" error came out. Maybe the lib path was wrong. However, I can hardly find any words explained on win-builder. Can I only use the header-only libraries or Is there a way to configure Makevars.win to find the separately-compiled Boost.Thread library?

Or maybe I can include Boost source filed in my package, but I don't think it is a good way, and I also don't know how to include (I haven't tried).

I found there is an R package BH trying to provide Boost for R. It is very helpful, and I appreciate the work done by the authors of BH very much, however, the Boost.Thread is not included when I asked this question. Maybe I can wait until when they include Boost.Thread. But I prefer to do it myself now, so I can learn more.


回答1:


Current BH maintainer here. Several points:

  • As noted, our BH package only provides (a subset of) headers from Boost. The package grows as needed, we may add more soon (as I have one request in).

  • Win-Builder supports BOOSTLIB to also set headers on Windows; as the comments say I do not think it provides libraries. In RQuantLib I only use it to get headers as well which are needed by the QuantLib classes.

  • Several package have fought the threading issue on Windows; the fellow BH-coauthors Jay and Mike tried in the context of their bigmemory package and its support packages such as synchronicity. But as of now, they are not provided Windows support because, well, Windows is different and at pains with some Unix idioms.

Edit: Here is the README from synchronicity:

synchronicity is currently only supported on unix platforms because of a bug in either Boost or MinGW with 64-bit Windows. We'll expand support to Windows as soon as these have been resolved.

If you want to use this package with 32-bit Windows, it may be possible (comment out the OS_type line in DESCRIPTION).

October 30, 2010. Modified configure to fix up a Solaris problem.

No in short there is no pre-built tool for you to rely on.



来源:https://stackoverflow.com/questions/19651954/is-it-possible-to-build-an-r-package-which-use-rcpp-and-boost-thread-on-win-b

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!