Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error on systems with boost >= 1.85 #13795

Closed
2 tasks
jmickelin opened this issue Dec 19, 2024 · 2 comments
Closed
2 tasks

Build error on systems with boost >= 1.85 #13795

jmickelin opened this issue Dec 19, 2024 · 2 comments
Labels
Build Build issues

Comments

@jmickelin
Copy link
Contributor

jmickelin commented Dec 19, 2024

Description of the bug

This is a followup of sorts to my PR #13609, where a user reported one remaining build issue when using the Boost version supplied by their distro (Arch Linux with boost-1.86 in their case):

[ 86%] Building CXX object src/slic3r/CMakeFiles/libslic3r_gui.dir/GUI/Jobs/NotificationProgressIndicator.cpp.o
/tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/src/slic3r/Config/Version.cpp: In static member function ‘static std::vector<Slic3r::GUI::Config::Index> Slic3r::GUI::Config::Index::load_db()’:
/tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/src/slic3r/Config/Version.cpp:246:51: error: ‘directory_iterator’ is not a member of ‘boost::filesystem’; did you mean ‘directory_entry’?
  246 |         for (auto &dir_entry : boost::filesystem::directory_iterator(cache_dir))
      |                                                   ^~~~~~~~~~~~~~~~~~
      |                                                   directory_entry
/tmp/makepkg/prusa-slicer-git/src/PrusaSlicer/src/slic3r/Config/Version.cpp:259:47: error: ‘directory_iterator’ is not a member of ‘boost::filesystem’; did you mean ‘directory_entry’?
  259 |     for (auto &dir_entry : boost::filesystem::directory_iterator(vendor_dir))
      |                                               ^~~~~~~~~~~~~~~~~~
      |                                               directory_entry

While I -- strangely - could not replicate it myself when rebuilding PrusaSlicer with that version, I did an attempt to chase down why the offending import isn't found in 1.86.

This is my hypothesis:

The symbol boost:filesystem::directory_iterator is declared in boost/filesystem/directory.hpp, but PrusaSlicer's src/slic3r/Config/Version.cpp never explicitly imports it. Instead, it seems to be pulled in transitively by #include <boost/filesystem/operations.hpp>.

However, Boost versions prior to 1.85 only conditionally included it, guarded by a BOOST_FILESYSTEM_NO_DEPRECATED flag. This was removed as part of this commit:

diff --git a/include/boost/filesystem/operations.hpp b/include/boost/filesystem/operations.hpp
index 1c31803fe..034b54fda 100644
--- a/include/boost/filesystem/operations.hpp
+++ b/include/boost/filesystem/operations.hpp
@@ -20,12 +20,6 @@
 #include <boost/filesystem/path.hpp>
 #include <boost/filesystem/file_status.hpp>
 
-#ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-// These includes are left for backward compatibility and should be included directly by users, as needed
-#include <boost/filesystem/exception.hpp>
-#include <boost/filesystem/directory.hpp>
-#endif
-
 #include <boost/detail/bitmask.hpp>
 #include <boost/system/error_code.hpp>
 #include <boost/cstdint.hpp>

So although PrusaSlicer does not appear to have been relying on the deprecated functionality that was removed, it was affected by the includes changing.

It seems wise to just explicitly add this include to PrusaSlicer, as suggested by the comment in the above diff. This should make it compatible with all versions. I will create a PR shortly.

Big thanks to @sl1pkn07 for bringing this to attention. There is also some prior art from the Gentoo build system, where the maintainers appear to have run into the same issue.

Project file & How to reproduce

N/A

Checklist of files included above

  • Project file
  • Screenshot

Version of PrusaSlicer

2.9.0-rc1

Operating system

Linux: Arch, Gentoo

Printer model

N/A

jmickelin added a commit to jmickelin/PrusaSlicer that referenced this issue Dec 19, 2024
This mends the build process on distros with a boost version of 1.85
and above.

Fixes prusa3d#13795
@TerPuc TerPuc added the Build Build issues label Dec 19, 2024
@SachCZ
Copy link
Collaborator

SachCZ commented Dec 19, 2024

Hello @jmickelin, thank you. It makes sense. Sadly, this is a very unfortunate timing as the window in which the changes could have been merged to the upstream for next release just closed. Especially because it is such an easy fix. It will for sure be part of the release after that.

In the meantime I recommend you patch this wherever needed. Thank you for your time and effort!

@SachCZ
Copy link
Collaborator

SachCZ commented Dec 20, 2024

As you can see, in the end it got squeezed into the release 🍾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Build issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants