Repository navigation
cmake: drop the boost::filesystem dependency - #71926
Conversation
Boost.Process v1's POSIX pipe helpers use boost::system::error_code without including the header that declares it: boost/process/v1/detail/posix/pipe_in.hpp:79: boost::system::error_code ec; boost/process/v1/detail/posix/pipe_out.hpp:111: boost::system::error_code ec; These compile today only because boost/process pulls in boost/filesystem, whose headers declare boost::system on the way past. Every translation unit including boost/process therefore depends on an include that has nothing to do with what it asks for, and loses the declaration the moment that path changes. Include the header where it is used instead. Signed-off-by: Kefu Chai <[email protected]>
idryomov
left a comment
There was a problem hiding this comment.
Targets whose translation units reach std::filesystem through Boost.Process link StdFilesystem::filesystem, which supplies -lstdc++fs on toolchains that still need it and is empty elsewhere.
Do we still care about those toolchains? Looking at https://en.cppreference.com/cpp/filesystem#Notes:
GNU implementation prior to 9.1 requires linking with -lstdc++fs and LLVM implementation prior to LLVM 9.0 requires linking with -lc++fs.
Perhaps StdFilesystem::filesystem could be dropped too?
CephChecks.cmake stops the build if GCC is older than 8.1. But src/CMakeLists.txt already requires GCC 11 or newer (10 on win32, 13 with crimson). So the old check has no effect. Signed-off-by: Kefu Chai <[email protected]>
FindStdFilesystem finds the library that provides std::filesystem. It tries no library, then stdc++fs, then c++fs. Only compilers older than GCC 9.1 and LLVM 9.0 need a separate library. We need at least GCC 11 or Clang 16, and both have std::filesystem in the standard library. So the module always picks "no library", and StdFilesystem::filesystem is an empty target. Remove the module and all links to it. ceph_test_admin_socket_output was built only when StdFilesystem was found. It is always found, so always build the test. Suggested-by: Ilya Dryomov <[email protected]> Signed-off-by: Kefu Chai <[email protected]>
Our code has not used boost::filesystem since 71e2027 changed rgw_lua to std::filesystem. We still link the library because Boost.Process v1 uses it for boost::process::v1::filesystem by default. Two files call bp::search_path(): rgw_lua.cc and ProgressTracker.cc. ProgressTracker.cc is built into cephfs-journal-tool, cephfs-table-tool and cephfs-data-scan. cephfs-meta-injection does not build it, and it is the only tool in that directory that never linked the library. Define BOOST_PROCESS_USE_STD_FS, so bp::filesystem is std::filesystem, and remove the Boost filesystem component and its link entries. We define the macro for the whole tree, not per target. It changes the type of bp::filesystem::path in inline code, so linking objects built with and without it would violate the ODR. With our compilers std::filesystem needs no separate library, so we link nothing in its place. The WITH_RADOSGW_LUA_PACKAGES blocks in the rgw CMakeLists.txt files only linked Boost::filesystem, so remove them too. The bundled Boost now builds one library less. install-deps.sh still installs ceph-libboost-filesystem for WITH_SYSTEM_BOOST. That list also has header-only libraries, so leave it as is. Signed-off-by: Kefu Chai <[email protected]>
16f5454 to
c7f3a44
Compare
|
#71999 was inspired the cmake change. |
Nah. dropped.
indeed. gone. |
idryomov
left a comment
There was a problem hiding this comment.
Ack from the RBD perspective
|
This PR has been added to main integration testing by anuchaithra started 2026-09-24-06:02. |
RGW pr testing is completed and approved by @ivancich, more details in : https://tracker.ceph.com/issues/80827 |
No first-party code has used boost::filesystem since 71e2027 converted rgw_lua to
std::filesystem. The library survived becauseBoost.Processv1 aliasesboost::process::v1::filesystemto it by default, so the two callers ofbp::search_path()drag it in:rgw_lua.cc, andProgressTracker.cc, which is compiled into cephfs-journal-tool,cephfs-table-toolandcephfs-data-scan.cephfs-meta-injectionis the one tool in that directory that does not compileProgressTracker.cc, and the one that never linked the library.BOOST_PROCESS_USE_STD_FSsobp::filesystemisstd::filesystem, and drop the component requests and link entries. It is set tree-wide rather than per target because it changes the type ofbp::filesystem::pathin inline code: a binary linking objects built both ways would be an ODR violation.std::filesystemthroughBoost.ProcesslinkStdFilesystem::filesystem, which supplies-lstdc++fson toolchains that still need it and is empty elsewhere.WITH_SYSTEM_BOOSTpath; that list covers header-only libraries too, so it is left alone.Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.