Comments (17)
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.
from bh.
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.
from bh.
Looks like filesystem has been part of BH for some time, but it also looks like may need compilation. From its documentation:
Using the library
Boost.Filesystem is implemented as a separately compiled library, so you must install binaries in a location that can be found by your linker. If you followed the Boost Getting Started instructions, that's already been done for you.
So maybe we should remove it...
from bh.
I found this, and the following define
seems to solve the issue:
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 define
by default.
from bh.
Ok, I checked, If I actually want to invoke filesystem functions that seem system dependent ("does path exist?") I still get error, particularly boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)
being undefined. No free lunch...
from bh.
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.
from bh.
Agreed and retitled. I think on the next update I will remove it.
from bh.
This might be a dumb question, but why exactly is there talk about removing a component such as filesystem
? Personally I hope, this does not happen as I just included BH
provided boost::filesystem
into a project of mine.
Isn't it sufficient to add something like PKG_LIBS = -lboost_filesystem
to Makevars
for linking? To be honest, I was surprised how easy this was (maybe, I'm lucky that boost libs are available from one of my system library directories), but @eddelbuettel suggested this both on SO and is doing so in a package.
from bh.
Isn't it sufficient to add something like PKG_LIBS = -lboost_filesystem
Sure. Only that libboost_filesystem
is not part of this package, so you are now mixing your local installation with the package. Nothing "wrong" with that but you can't distribute that code.
And of course if you have a full Boost locally you don't need the BH
package....
from bh.
I understand that, but aren't you doing the same with rcppbdt?
from bh.
No I don't as it is header-only as well.
from bh.
I'm sorry, I did not read Makevars of rcppbdt correctly: PKG_LIBS
is commented out.
## Needed for the 'non-streams' variant charToPOSIXctNS
#PKG_LIBS = -lboost_date_time
So to do this properly, I need to add a configure
script to look up boost include & lib dirs on the target machine and maybe add boost as SystemRequirements
, right?
Do you off the top of your head know of a package that does something like this?
from bh.
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:
- newer mlpack (v3 is current, repo was called v2 initially to set it apart from v1)
- vowpalwabbit
So I in short I would recommend to you to avoid linking if CRAN is your goal.
from bh.
Thanks a lot for sharing your insight. One last question: I can easily swap boost::filesystem
for C++17 std::filesystem
. Is that also a problem with CRAN?
from bh.
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.
from bh.
Ok, thanks for the help!
from bh.
Preparing BH 1.72.0 now based on last week's Boost 1.72 release. I removed filesystem
from the list of explicitly added packages ... but some of its files are still coming in via bcp
and cross-library dependencies. Such is life ...
from bh.
Related Issues (20)
- BH 1.84.0 CRAN Release Planning HOT 2
- boost::geometry compilation failing with LLVM 19 HOT 2
- Include Boost Beast in next upstream update HOT 21
- Update BH to 1.75.0 and minor regressions requiring downstream changes HOT 37
- boost geometry C++14 R 3.6 patch HOT 8
- Include boost process? HOT 8
- Include boost ublas? HOT 3
- Upgrade to Boost 1.78 HOT 11
- Add Boost::Lambda2 ?
- Installation error r-devel-linux-x86_64-debian-gcc HOT 24
- A request to add timer/include/boost/progress.hpp HOT 11
- Compilation of `bigmemory` fails in Alpine Linux apparently due to BH version HOT 2
- BH 1.81.0 upgrade plan HOT 10
- CRAN warning "Found 'sprintf', possibly from 'sprintf' (C)" using BH HOT 5
- Compile failure of BH as a dependency of https://github.com/steven-shuken/permFDP HOT 4
- clang16 compatibility under C++17 HOT 6
- Undefined reference to `scoped_static_mutex_lock` on Windows R 3.6 HOT 1
- system.file("include", package = "BH") returns empty string HOT 4
- Current version breaks CRAN checks HOT 7
- QVM support HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bh.