Backport upstream fix for build with Boost 1.79+

This commit is contained in:
Mamoru TASAKA 2023-02-27 09:56:00 +09:00
parent 991b979a79
commit e7e66a9e36
4 changed files with 167 additions and 1 deletions

View File

@ -0,0 +1,31 @@
From 926ae0471800abd1e5335e251a5934570eb8f6ff Mon Sep 17 00:00:00 2001
From: Vojtech Bubnik <bubnikv@gmail.com>
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 <string>
#include <boost/nowide/cstdio.hpp>
+#include <boost/nowide/fstream.hpp>
#include <boost/filesystem.hpp>
#include <libslic3r/ModelArrange.hpp>
@@ -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<char>(t)), std::istreambuf_iterator<char>());
boost::nowide::remove(temp.string().c_str());
return str;

View File

@ -0,0 +1,81 @@
From 408e56f0390f20aaf793e0aa0c70c4d9544401d4 Mon Sep 17 00:00:00 2001
From: Vojtech Bubnik <bubnikv@gmail.com>
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<std::pair<std::string, std::string>>& 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 <map>
+
#include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/log/trivial.hpp>
#include <boost/property_tree/ini_parser.hpp>
-#include <map>
+
#include <cereal/archives/binary.hpp>
#include <cereal/types/string.hpp>
#include <cereal/types/vector.hpp>
@@ -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<std::string>& 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<std::string>& 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

View File

@ -0,0 +1,43 @@
From f9f8e811526dbf41c4987400924b1028c2dadd1a Mon Sep 17 00:00:00 2001
From: KARBOWSKI Piotr <piotr.karbowski@gmail.com>
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 <boost/nowide/fstream.hpp>
#include <boost/filesystem.hpp>
#include <boost/log/trivial.hpp>
#include <boost/dll/runtime_symbol_info.hpp>
@@ -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 <cstdlib>
#include <regex>
#include <string_view>
+#include <boost/nowide/fstream.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>

View File

@ -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 <mtasaka@fedoraproject.org> - 2.4.2-9
- Backport upstream fix for build with Boost 1.79+
* Mon Feb 20 2023 Jonathan Wakely <jwakely@redhat.com> - 2.4.2-8
- Rebuilt for Boost 1.81