error: qualified reference to 'QFixed' is a constructor name rather than a type in this context building Paraview

error: qualified reference to 'QFixed' is a constructor name rather than a type in this context building Paraview

我一直在尝试构建 ParaView 以在 MacOS 上测试自定义应用示例 here

我已按照超级构建的站点说明进行操作 here

我似乎对 Qt 部分有问题。

这些是我完成的步骤:

$ mkdir pv
$ cd pv
$ git clone https://gitlab.kitware.com/paraview/paraview-superbuild.git
$ cd paraview-superbuild
$ git fetch origin # ensure you have the latest state from the main repo
$ git submodule update

$ cd ..
$ mkdir paraview_build
$ cd paraview_build
$ cmake ../paraview-superbuild
$ ccmake -DCMAKE_OSX_SDK=macosx10.14 ../paraview-superbuild

我启用了 CMake 变量:

ENABLE_qt5
ENABLE_python
ENABLE_python2

然后运行:

$ make

我得到的错误:

[ 87%] Performing build step for 'qt5'
Info: creating cache file /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/build/qtbase/.qmake.cache
ld: warning: direct access in function 'QHash<QString, int>::insert(QString const&, int const&)' from file '/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/build/qtbase/lib/libQt5Bootstrap.a(qcommandlineparser.o)' to global weak symbol 'QHash<QString, int>::deleteNode2(QHashData::Node*)' from file '.obj/rcc.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'QHash<QString, int>::insert(QString const&, int const&)' from file '/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/build/qtbase/lib/libQt5Bootstrap.a(qcommandlineparser.o)' to global weak symbol 'QHash<QString, int>::deleteNode2(QHashData::Node*)' from file '.obj/rcc.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'QHash<QString, int>::insert(QString const&, int const&)' from file '/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/build/qtbase/lib/libQt5Bootstrap.a(qcommandlineparser.o)' to global weak symbol 'QHash<QString, int>::duplicateNode(QHashData::Node*, void*)' from file '.obj/rcc.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
ld: warning: direct access in function 'QCommandLineParserPrivate::~QCommandLineParserPrivate()' from file '/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/build/qtbase/lib/libQt5Bootstrap.a(qcommandlineparser.o)' to global weak symbol 'QHash<QString, int>::deleteNode2(QHashData::Node*)' from file '.obj/rcc.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../lib/libqtharfbuzz.a(hb-warning.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: ../../../lib/libqtharfbuzz.a(hb-warning.o) has no symbols
Makefile:2392: warning: overriding commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPlugin'
Makefile:2024: warning: ignoring old commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPlugin'
Makefile:2396: warning: overriding commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPluginFactory'
Makefile:2020: warning: ignoring old commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPluginFactory'
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/network/access/qnetworkaccessdebugpipebackend_p.h:0: Note: No relevant classes found. No output generated.
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm:833:20: error: qualified reference to 'QFixed' is a constructor name rather than a type in this context
    return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
                   ^
1 error generated.
make[7]: *** [.obj/qfontengine_coretext.o] Error 1
make[7]: *** Waiting for unfinished jobs....
make[6]: *** [sub-fontdatabases-make_first] Error 2
make[5]: *** [sub-platformsupport-make_first] Error 2
make[5]: *** Waiting for unfinished jobs....
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/widgets/widgets/qdialogbuttonbox.cpp:868:14: warning: comparison of two values with different enumeration types in switch statement ('QDialogButtonBox::ButtonRole' and 'QPlatformDialogHelper::ButtonRole') [-Wenum-compare-switch]
        case QPlatformDialogHelper::HelpRole:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/widgets/widgets/qdialogbuttonbox.cpp:865:14: warning: comparison of two values with different enumeration types in switch statement ('QDialogButtonBox::ButtonRole' and 'QPlatformDialogHelper::ButtonRole') [-Wenum-compare-switch]
        case QPlatformDialogHelper::NoRole:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/widgets/widgets/qdialogbuttonbox.cpp:864:14: warning: comparison of two values with different enumeration types in switch statement ('QDialogButtonBox::ButtonRole' and 'QPlatformDialogHelper::ButtonRole') [-Wenum-compare-switch]
        case QPlatformDialogHelper::RejectRole:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/widgets/widgets/qdialogbuttonbox.cpp:861:14: warning: comparison of two values with different enumeration types in switch statement ('QDialogButtonBox::ButtonRole' and 'QPlatformDialogHelper::ButtonRole') [-Wenum-compare-switch]
        case QPlatformDialogHelper::YesRole:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/widgets/widgets/qdialogbuttonbox.cpp:860:14: warning: comparison of two values with different enumeration types in switch statement ('QDialogButtonBox::ButtonRole' and 'QPlatformDialogHelper::ButtonRole') [-Wenum-compare-switch]
        case QPlatformDialogHelper::AcceptRole:
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 warnings generated.
make[4]: *** [sub-src-make_first] Error 2
make[3]: *** [module-qtbase-make_first] Error 2
CMake Error at /Users/username/Desktop/dev/pv/paraview_build/superbuild/sb-qt5-build.cmake:47 (message):
  Failed with exit code 2


make[2]: *** [superbuild/qt5/stamp/qt5-build] Error 1
make[1]: *** [superbuild/CMakeFiles/qt5.dir/all] Error 2
make: *** [all] Error 2

我能做什么?

日志中的错误:

qfontengine_coretext.mm:833:20: error: qualified reference to 'QFixed' is a constructor name rather than a type in this context

是由 Qt 5.9.5 的一个已知错误引起的,记录在案 here。那里也有一个 MacOS 修复程序,它涉及修改 qfontengine_coretext.mm 文件中的一行代码。您的文件位于此处:

/Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm

在第 833 行,将 return 语句更改为:

QFixed QCoreTextFontEngine::emSquareSize() const
{
    return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
}

至此(去掉多余的QFixed::使其不再指定构造函数):

QFixed QCoreTextFontEngine::emSquareSize() const
{
    return QFixed(int(CTFontGetUnitsPerEm(ctfont)));
}

然后,重新运行make验证更新的源代码修复了这个问题。