2022-12-31 12:06:50 +0100 12:06 SAT 31 DEC

Long time no post – whatever, I guess. I’ll just post about something I just ran into and might need to do again in the future. Maybe this will even be useful to someone else.

Builds fail with some strange type errors

Environment: Both Qt5 and Qt6 are installed via Homebrew, the Qt5 directory is in the $PATH environment variable.

Problem: some components fail to build with something like this in the logs:

[4/77] Building CXX object src/i18n/CMakeFiles/KF5I18n.dir/common_helpers.cpp.o
FAILED: src/i18n/CMakeFiles/KF5I18n.dir/common_helpers.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ [some flags omitted] -I/opt/homebrew/include -iframework /opt/homebrew/opt/qt@5/lib -isystem /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers -isystem /opt/homebrew/opt/qt@5/./mkspecs/macx-clang-arm64 [more flags omitted] -o src/i18n/CMakeFiles/KF5I18n.dir/common_helpers.cpp.o -c /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers.cpp
In file included from /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers.cpp:7:
In file included from /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers_p.h:10:
In file included from /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/QString:1:
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qstring.h:78:7: error: definition of type 'QStringList' conflicts with type alias of the same name
class QStringList;
      ^
/opt/homebrew/include/QtCore/qcontainerfwd.h:28:7: note: 'QStringList' declared here
using QStringList = QList<QString>;
      ^
In file included from /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers.cpp:7:
In file included from /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers_p.h:10:
In file included from /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/QString:1:
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qstring.h:81:29: error: redefinition of 'QVector' as different kind of symbol
template <typename T> class QVector;
                            ^
/opt/homebrew/include/QtCore/qcontainerfwd.h:27:22: note: previous definition is here
template<typename T> using QVector = QList<T>;
                     ^
In file included from /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers.cpp:7:
In file included from /Users/foxy/kde/src/frameworks/ki18n/src/i18n/common_helpers_p.h:10:
In file included from /opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/QString:1:
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qstring.h:261:13: error: unknown type name 'QStringData'
    typedef QStringData Data;
            ^
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qstring.h:967:37: error: unknown type name 'QStringDataPtr'
    Q_DECL_CONSTEXPR inline QString(QStringDataPtr dd) : d(dd.ptr) {}
                                    ^
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qstring.h:273:72: error: 'QString::Data' (aka 'int') is not a class, namespace, or enumeration
    inline QString(QString && other) noexcept : d(other.d) { other.d = Data::sharedNull(); }
                                                                       ^
/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/qstring.h:277:39: error: member reference base type 'QString::Data' (aka 'int') is not a structure or union
    inline int size() const { return d->size; }
                                     ~^ ~~~~

Solution: Run brew unlink qt@6. This needs to be done every time after brew upgrade updates qt@6.

This removes all the symlinks Homebrew creates for Qt6 inside e.g. /opt/homebrew/include. I only noticed this after having a closer look at the paths the compiler spit out at me – some Qt6 libraries already got included which made the Qt5 one upset.

No icons in the apps

Problem: There are no icons in the apps.

Solution: Build breeze-icons and create a special symlink for each app you want to run:

# build breeze-icons
kdesrc-build breeze-icons

# create an app-specific symlink of the compiled breeze-icons resource
# to ~/Library/Application\ Support/<app>
#
# e.g. for Konsole:
ln -s ~/kde/usr/share/icons/breeze/breeze-icons.rcc ~/Library/Application\ Support/konsole/icontheme.rcc

This method has a downside though, when switching to dark mode the icons do not change to their light/dark variants. Since I use the light mode everywhere this doesn’t bother me too much, so I haven’t looked into how to improve that (yet).

Yes, you can subscribe to this blog using your favourite feed reader.
Home
Projects
Uses
Blog