Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upConsider removing boost::filesystem #55
Comments
|
I suspect that some headers lead to a linking requirement. That is the same for some other Boost libraries. So there may be both supported and unsupported use case. |
|
Looks like filesystem has been part of BH for some time, but it also looks like may need compilation. From its documentation:
So maybe we should remove it... |
|
I found this, and the following Rcpp::sourceCpp(code='
#include <Rcpp.h>
// Rcpp::depends("BH")
#define BOOST_ERROR_CODE_HEADER_ONLY
#include <boost/filesystem.hpp>
// [[Rcpp::export]]
int hello() { return 0; }
')If this is enough to make it work, maybe BH should set that |
|
Dang, that is excellent. I was actually just looking at Boost filesystem a few weeks ago for this commit in RcppCNPy and ended up going to R instead because of the linking issue. Need to look some into this. We may need a new FAQ vignette with this in it. |
|
Ok, I checked, If I actually want to invoke filesystem functions that seem system dependent ("does path exist?") I still get error, particularly |
|
That's a pity, but sounds reasonable though. It appears that only some path utilities (which are nothing but string manipulations) can be used without linking. I'd vote for removing it then. |
|
Agreed and retitled. I think on the next update I will remove it. |
|
This might be a dumb question, but why exactly is there talk about removing a component such as Isn't it sufficient to add something like |
Sure. Only that And of course if you have a full Boost locally you don't need the |
|
I understand that, but aren't you doing the same with rcppbdt? |
|
No I don't as it is header-only as well. |
|
I'm sorry, I did not read Makevars of rcppbdt correctly:
So to do this properly, I need to add a Do you off the top of your head know of a package that does something like this? |
|
Correct. (And I myself had forgotten I once had a tester function needing linking. The intent for all this Boost use was always portability -- no linking.) Because it is a real problem. I have two projects I am involved in blocked from CRAN access because they require linking with boost:
So I in short I would recommend to you to avoid linking if CRAN is your goal. |
|
Thanks a lot for sharing your insight. One last question: I can easily swap |
|
Sadly, yes. Some packages currently use C++14 but as far as I know nothing beyond. Once the Rtools set gets updated (to, I think, g++ 8) you can assume it on Windows. |
|
Ok, thanks for the help! |
|
Preparing BH 1.72.0 now based on last week's Boost 1.72 release. I removed |
I tried to use
boost::filesystem, which is listed as available in BH, but it seems that it requires linking toboost::system:gives
undefined symbol: boost::system::generic_category().