From 233d5550523bbaeaba3f51dfa30f80f25c906d6b Mon Sep 17 00:00:00 2001 From: Troy Rollo Date: Sun, 31 Oct 2021 10:48:51 +1100 Subject: [PATCH 1/2] Avoid a bug in ImageMagick or cassert headers At least on Debian bullseye as at today, the ImageMagick headers include with an ImageMagick namespace current. and the headers it then pulls in also do not set the namespace. Those headers then declare functions such as __assert_fail, which end up in the ImageMagick namespace. This causes failures in other parts of the build, such as the ZeroMQ code. This seems to be a bug in either the ImageMagick headers or the header, but can be easily worked around by including before any ImageMagick header. This change does so. --- src/MagickUtilities.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/MagickUtilities.h b/src/MagickUtilities.h index bb3e832d..9246da1e 100644 --- a/src/MagickUtilities.h +++ b/src/MagickUtilities.h @@ -14,6 +14,13 @@ #ifdef USE_IMAGEMAGICK + // Avoid a bug in the interaction between ImageMagick + // and the standard C insertion headers, which can + // cause functions used by macros in the standard C + // assertion code to be put in an ImageMagick library + // namespace instead of the global namespace + #include + // Exclude a warning message with IM6 headers #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wignored-qualifiers" From fe58e8028dacf19c6c33bead23686978ab548093 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Mon, 1 Nov 2021 11:04:31 -0400 Subject: [PATCH 2/2] Move some headers around --- src/ChunkReader.cpp | 2 ++ src/Clip.cpp | 11 +++++++---- src/FFmpegReader.cpp | 1 + src/Frame.cpp | 10 ++++++++-- src/Frame.h | 20 ++++++++++++-------- src/FrameMapper.cpp | 1 + src/Qt/PlayerPrivate.cpp | 1 + src/Qt/VideoCacheThread.cpp | 3 ++- src/Qt/VideoPlaybackThread.cpp | 1 + src/TrackedObjectBBox.cpp | 2 ++ 10 files changed, 37 insertions(+), 15 deletions(-) diff --git a/src/ChunkReader.cpp b/src/ChunkReader.cpp index 806f1a86..f8dfa503 100644 --- a/src/ChunkReader.cpp +++ b/src/ChunkReader.cpp @@ -10,6 +10,8 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later +#include + #include "ChunkReader.h" #include "Exceptions.h" #include "FFmpegReader.h" diff --git a/src/Clip.cpp b/src/Clip.cpp index c28a7a55..81d2e524 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -14,14 +14,17 @@ #include "Exceptions.h" #include "FFmpegReader.h" #include "FrameMapper.h" -#ifdef USE_IMAGEMAGICK - #include "ImageReader.h" - #include "TextReader.h" -#endif #include "QtImageReader.h" #include "ChunkReader.h" #include "DummyReader.h" #include "Timeline.h" +#include "ZmqLogger.h" + +#ifdef USE_IMAGEMAGICK + #include "MagickUtilities.h" + #include "ImageReader.h" + #include "TextReader.h" +#endif #include diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 6cf0203a..f1ef5922 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -18,6 +18,7 @@ #include "FFmpegReader.h" #include "Exceptions.h" #include "Timeline.h" +#include "ZmqLogger.h" #include // for std::this_thread::sleep_for #include // for std::chrono::milliseconds diff --git a/src/Frame.cpp b/src/Frame.cpp index c8a041bc..155ba2b4 100644 --- a/src/Frame.cpp +++ b/src/Frame.cpp @@ -10,6 +10,11 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later +#include // for std::this_thread::sleep_for +#include // for std::chrono::milliseconds +#include +#include + #include "Frame.h" #include @@ -27,8 +32,9 @@ #include #include -#include // for std::this_thread::sleep_for -#include // for std::chrono::milliseconds +#ifdef USE_IMAGEMAGICK + #include "MagickUtilities.h" +#endif using namespace std; using namespace openshot; diff --git a/src/Frame.h b/src/Frame.h index 5205aa7c..fdf78239 100644 --- a/src/Frame.h +++ b/src/Frame.h @@ -21,24 +21,28 @@ #undef int64 #endif - -#include -#include #include -#include -#include #include -#include -#include "ZmqLogger.h" + #include "ChannelLayouts.h" #include "AudioBufferSource.h" #include "AudioResampler.h" #include "Fraction.h" + #include + +#include +#include + #ifdef USE_IMAGEMAGICK - #include "MagickUtilities.h" +// Forward declare Magick::Image +namespace Magick { + class Image; +} #endif +class QApplication; + namespace openshot { /** diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index 981bc548..59e03782 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -17,6 +17,7 @@ #include "FrameMapper.h" #include "Exceptions.h" #include "Clip.h" +#include "ZmqLogger.h" using namespace std; using namespace openshot; diff --git a/src/Qt/PlayerPrivate.cpp b/src/Qt/PlayerPrivate.cpp index 40de28fd..0594513b 100644 --- a/src/Qt/PlayerPrivate.cpp +++ b/src/Qt/PlayerPrivate.cpp @@ -13,6 +13,7 @@ #include "PlayerPrivate.h" #include "Exceptions.h" +#include "ZmqLogger.h" #include // for std::this_thread::sleep_for #include // for std::chrono milliseconds, high_resolution_clock diff --git a/src/Qt/VideoCacheThread.cpp b/src/Qt/VideoCacheThread.cpp index 7d37fa59..e642cddc 100644 --- a/src/Qt/VideoCacheThread.cpp +++ b/src/Qt/VideoCacheThread.cpp @@ -12,8 +12,9 @@ #include "VideoCacheThread.h" #include "Exceptions.h" -#include +#include "ZmqLogger.h" +#include #include // for std::this_thread::sleep_for #include // for std::chrono::milliseconds diff --git a/src/Qt/VideoPlaybackThread.cpp b/src/Qt/VideoPlaybackThread.cpp index 16019911..87c9cdd9 100644 --- a/src/Qt/VideoPlaybackThread.cpp +++ b/src/Qt/VideoPlaybackThread.cpp @@ -12,6 +12,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "VideoPlaybackThread.h" +#include "ZmqLogger.h" namespace openshot { diff --git a/src/TrackedObjectBBox.cpp b/src/TrackedObjectBBox.cpp index 87751607..bd042c10 100644 --- a/src/TrackedObjectBBox.cpp +++ b/src/TrackedObjectBBox.cpp @@ -11,6 +11,8 @@ // // SPDX-License-Identifier: LGPL-3.0-or-later +#include + #include "TrackedObjectBBox.h" #include "Clip.h"