From e7e66a9e3644e5a8d8ed1648d22fc19249852466 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Mon, 27 Feb 2023 09:56:00 +0900 Subject: [PATCH] Backport upstream fix for build with Boost 1.79+ --- ...m_ofstream-deprecation-1_79-followup.patch | 31 +++++++ ...filesystem_ofstream-deprecation-1_79.patch | 81 +++++++++++++++++++ prusa-slicer-pr8304-boost-1_79-fix.patch | 43 ++++++++++ prusa-slicer.spec | 13 ++- 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 prusa-slicer-boost_filesystem_ofstream-deprecation-1_79-followup.patch create mode 100644 prusa-slicer-boost_filesystem_ofstream-deprecation-1_79.patch create mode 100644 prusa-slicer-pr8304-boost-1_79-fix.patch diff --git a/prusa-slicer-boost_filesystem_ofstream-deprecation-1_79-followup.patch b/prusa-slicer-boost_filesystem_ofstream-deprecation-1_79-followup.patch new file mode 100644 index 0000000..6217ece --- /dev/null +++ b/prusa-slicer-boost_filesystem_ofstream-deprecation-1_79-followup.patch @@ -0,0 +1,31 @@ +From 926ae0471800abd1e5335e251a5934570eb8f6ff Mon Sep 17 00:00:00 2001 +From: Vojtech Bubnik +Date: Mon, 25 Apr 2022 11:32:03 +0200 +Subject: [PATCH] Follow-up to 408e56f0390f20aaf793e0aa0c70c4d9544401d4 Fixing + compilation of tests on latest GCC/boost + +--- + tests/fff_print/test_data.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tests/fff_print/test_data.cpp b/tests/fff_print/test_data.cpp +index 32e31c264c..f7077007db 100644 +--- a/tests/fff_print/test_data.cpp ++++ b/tests/fff_print/test_data.cpp +@@ -11,6 +11,7 @@ + #include + + #include ++#include + #include + #include + +@@ -286,7 +287,7 @@ std::string gcode(Print & print) + print.set_status_silent(); + print.process(); + print.export_gcode(temp.string(), nullptr, nullptr); +- std::ifstream t(temp.string()); ++ boost::nowide::ifstream t(temp.string()); + std::string str((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + boost::nowide::remove(temp.string().c_str()); + return str; diff --git a/prusa-slicer-boost_filesystem_ofstream-deprecation-1_79.patch b/prusa-slicer-boost_filesystem_ofstream-deprecation-1_79.patch new file mode 100644 index 0000000..f3ad855 --- /dev/null +++ b/prusa-slicer-boost_filesystem_ofstream-deprecation-1_79.patch @@ -0,0 +1,81 @@ +From 408e56f0390f20aaf793e0aa0c70c4d9544401d4 Mon Sep 17 00:00:00 2001 +From: Vojtech Bubnik +Date: Mon, 25 Apr 2022 08:33:48 +0200 +Subject: [PATCH] Fix of Boost 1.79 deprecated boost::filesystem::ofstream + #8238 Replacing boost::filesystem::fstream with boost::nowide::fstream + variants with the unfortunate cost of string path conversion on Windows from + 16 bits to UTF8 and back to 16 bits. + +Unfortunately we cannot use std::filesystem yet as it is missing +on older MACs and because the interface is crooked minefield on Windows +see https://github.com/microsoft/STL/issues/909 +--- + src/hints/HintsToPot.cpp | 2 +- + src/libslic3r/Preset.cpp | 2 +- + src/slic3r/GUI/HintNotification.cpp | 8 +++++--- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/hints/HintsToPot.cpp b/src/hints/HintsToPot.cpp +index 7c8029cdeb..4791f0612f 100644 +--- a/src/hints/HintsToPot.cpp ++++ b/src/hints/HintsToPot.cpp +@@ -9,7 +9,7 @@ + + bool write_to_pot(boost::filesystem::path path, const std::vector>& data) + { +- boost::filesystem::ofstream file(std::move(path), std::ios_base::app); ++ boost::nowide::ofstream file(path.string(), std::ios_base::app); + for (const auto& element : data) + { + //Example of .pot element +diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp +index f3a1c15b3e..f171cb14dd 100644 +--- a/src/libslic3r/Preset.cpp ++++ b/src/libslic3r/Preset.cpp +@@ -84,7 +84,7 @@ ConfigFileType guess_config_file_type(const ptree &tree) + VendorProfile VendorProfile::from_ini(const boost::filesystem::path &path, bool load_all) + { + ptree tree; +- boost::filesystem::ifstream ifs(path); ++ boost::nowide::ifstream ifs(path.string()); + boost::property_tree::read_ini(ifs, tree); + return VendorProfile::from_ini(tree, path, load_all); + } +diff --git a/src/slic3r/GUI/HintNotification.cpp b/src/slic3r/GUI/HintNotification.cpp +index 93e0fb3259..820b74eedb 100644 +--- a/src/slic3r/GUI/HintNotification.cpp ++++ b/src/slic3r/GUI/HintNotification.cpp +@@ -14,12 +14,14 @@ + #include "libslic3r/Config.hpp" + #include "libslic3r/PrintConfig.hpp" + ++#include ++ + #include + #include + #include + #include + #include +-#include ++ + #include + #include + #include +@@ -65,7 +67,7 @@ inline void push_style_color(ImGuiCol idx, const ImVec4& col, bool fading_out, f + + void write_used_binary(const std::vector& ids) + { +- boost::filesystem::ofstream file((boost::filesystem::path(data_dir()) / "cache" / "hints.cereal"), std::ios::binary); ++ boost::nowide::ofstream file((boost::filesystem::path(data_dir()) / "cache" / "hints.cereal").string(), std::ios::binary); + cereal::BinaryOutputArchive archive(file); + HintsCerealData cd { ids }; + try +@@ -84,7 +86,7 @@ void read_used_binary(std::vector& ids) + BOOST_LOG_TRIVIAL(warning) << "Failed to load to hints.cereal. File does not exists. " << path.string(); + return; + } +- boost::filesystem::ifstream file(path); ++ boost::nowide::ifstream file(path.string()); + cereal::BinaryInputArchive archive(file); + HintsCerealData cd; + try diff --git a/prusa-slicer-pr8304-boost-1_79-fix.patch b/prusa-slicer-pr8304-boost-1_79-fix.patch new file mode 100644 index 0000000..100f465 --- /dev/null +++ b/prusa-slicer-pr8304-boost-1_79-fix.patch @@ -0,0 +1,43 @@ +From f9f8e811526dbf41c4987400924b1028c2dadd1a Mon Sep 17 00:00:00 2001 +From: KARBOWSKI Piotr +Date: Mon, 9 May 2022 10:35:50 +0200 +Subject: [PATCH] Fix building with new Boost 1.79.0. + +Fixes #8302 +--- + src/slic3r/GUI/DesktopIntegrationDialog.cpp | 3 ++- + src/slic3r/GUI/GUI_App.cpp | 1 + + src/slic3r/Utils/AppUpdater.cpp | 3 ++- + 3 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/slic3r/GUI/DesktopIntegrationDialog.cpp b/src/slic3r/GUI/DesktopIntegrationDialog.cpp +index 81c681bc3a..7f99a505c6 100644 +--- a/src/slic3r/GUI/DesktopIntegrationDialog.cpp ++++ b/src/slic3r/GUI/DesktopIntegrationDialog.cpp +@@ -10,6 +10,7 @@ + #include "libslic3r/Platform.hpp" + #include "libslic3r/Config.hpp" + ++#include + #include + #include + #include +@@ -503,4 +504,4 @@ DesktopIntegrationDialog::~DesktopIntegrationDialog() + + } // namespace GUI + } // namespace Slic3r +-#endif // __linux__ +\ No newline at end of file ++#endif // __linux__ +diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp +index 8533854f4d..4435f836b3 100644 +--- a/src/slic3r/GUI/GUI_App.cpp ++++ b/src/slic3r/GUI/GUI_App.cpp +@@ -13,6 +13,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git a/prusa-slicer.spec b/prusa-slicer.spec index 6a8ea27..6584e95 100644 --- a/prusa-slicer.spec +++ b/prusa-slicer.spec @@ -8,7 +8,7 @@ Name: prusa-slicer Version: 2.4.2 -Release: 8%{?dist} +Release: 9%{?dist} Summary: 3D printing slicer optimized for Prusa printers # The main PrusaSlicer code and resources are AGPLv3, with small parts as @@ -42,6 +42,14 @@ Patch4: prusa-slicer-fix-uninitialized-imgui-segfault.patch # OpenEXR 3 fixes Patch351: https://github.com/archlinux/svntogit-community/blob/1dea61c0b5/trunk/prusa-slicer-openexr3.patch +# Boost 1.79 fixes +# https://github.com/prusa3d/PrusaSlicer/pull/8304 +Patch391: prusa-slicer-pr8304-boost-1_79-fix.patch +# https://github.com/prusa3d/PrusaSlicer/commit/408e56f0390f20aaf793e0aa0c70c4d9544401d4 +Patch392: prusa-slicer-boost_filesystem_ofstream-deprecation-1_79.patch +# https://github.com/prusa3d/PrusaSlicer/commit/926ae0471800abd1e5335e251a5934570eb8f6ff +Patch393: prusa-slicer-boost_filesystem_ofstream-deprecation-1_79-followup.patch + # Highly-parallel uild can run out of memory on PPC64le %ifarch ppc64le %global _smp_ncpus_max 8 @@ -395,6 +403,9 @@ desktop-file-validate %buildroot%_datadir/applications/PrusaGcodeviewer.desktop %endif %changelog +* Mon Feb 27 2023 Mamoru TASAKA - 2.4.2-9 +- Backport upstream fix for build with Boost 1.79+ + * Mon Feb 20 2023 Jonathan Wakely - 2.4.2-8 - Rebuilt for Boost 1.81