Error when compiling with Qt6 on macOS

pdv pdvisschere at edpnet.be
Fri Mar 26 11:00:32 UTC 2021


On 25/03/2021 17:31, Kornel Benko wrote:
> Am Thu, 25 Mar 2021 14:50:20 +0100
> schrieb Christoph Schmitz <chr.schmitz at web.de>:
> 
>> One library is obviously not installed by Homebrew: Qt6MacExtrasConfig. I searched for
>> the two files manually, but without success.
>>
>> -- CMake error message:
>>
>> TOP_SRC_DIR = /Users/chris/Git/LyX
>>
>> Building out-of-source
>> Selecting build type defaults from configure.ac
>>
>> CXX11_FLAG_DETECTED = "--std=c++17 -Wno-deprecated-register"
>> Compiler supports std_regex
>> Using clang
>> CMake Error at CMakeLists.txt:793 (find_package):
>> Could not find a package configuration file provided by "Qt6MacExtras" with
>> any of the following names:
>>
>> Qt6MacExtrasConfig.cmake
>> qt6macextras-config.cmake
>>
>> Add the installation prefix of "Qt6MacExtras" to CMAKE_PREFIX_PATH or set
>> "Qt6MacExtras_DIR" to a directory containing one of the above files. If
>> "Qt6MacExtras" provides a separate development package or SDK, be sure it
>> has been installed.
> 
> OK, I will ignore Qt6MacExtras for Qt6. (commit 9b03680a)
> 
>> Configuring incomplete, errors occurred!
>> See also "/Users/chris/Git/LyX/build/CMakeFiles/CMakeOutput.log".
>> See also "/Users/chris/Git/LyX/build/CMakeFiles/CMakeError.log".
>>
>> Chris
>>
>>
> 	Kornel
> 
> 

I also must exclude the QMacPasteboardMimeGraphics class in 
GuiApplication.cpp since QMacPasteboard is not available anymore with qt6.

and add an #include <QStandardPaths> in support/Package.cpp (I suppose 
this will pose no problem for qt5 but have not checked it, it's only 
needed with USE_MACOSX_PACKAGING)

(patch included)

P. De Visschere
-------------- next part --------------
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index e6964edfb2..aaff335266 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -153,7 +153,7 @@
 #endif
 #endif
 
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
 #include <QMacPasteboardMime>
 #endif // Q_OS_MAC
 
@@ -752,7 +752,7 @@ public:
 //
 ////////////////////////////////////////////////////////////////////////
 
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
 // QMacPasteboardMimeGraphics can only be compiled on Mac.
 
 class QMacPasteboardMimeGraphics : public QMacPasteboardMime
@@ -1048,7 +1048,7 @@ struct GuiApplication::Private
 	Qt::ApplicationState last_state_;
 #endif
 
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && (QT_VERSION < 0x060000)
 	/// Linkback mime handler for MacOSX.
 	QMacPasteboardMimeGraphics mac_pasteboard_mime_;
 #endif
diff --git a/src/support/Package.cpp b/src/support/Package.cpp
index a349a5e755..a779544f99 100644
--- a/src/support/Package.cpp
+++ b/src/support/Package.cpp
@@ -43,6 +43,7 @@
 # include "support/qstring_helpers.h"
 # include <QDir>
 # include <QDesktopServices>
+# include <QStandardPaths>
 #endif
 
 using namespace std;


More information about the lyx-devel mailing list