cmake + qt + vtk: ошибки компиляции в macOS Mojave - PullRequest
0 голосов
/ 28 марта 2019

Я использую macOS Mojave (10.14.3).После обновления до Mojave что-то в моей системе изменилось, и я больше не могу компилировать код, имеющий VTK и Qt.

. (Не) рабочий пример можно найти в примерахпредоставлено VTK .

Стоит отметить, что я могу скомпилировать другие примеры, не связанные с qt.

Я использую homebrew для установки всего, что мне нужно,

Здесь находятся журналы:

cmake ..
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- VTK_VERSION: 8.1.2
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/chraibi/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build

и

make 
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/mocs_compilation.cpp:2:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/moc_SideBySideRenderWindowsQt.cpp:9:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/../../../SideBySideRenderWindowsQt.h:6:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qmainwindow.h:44:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qwidget.h:52:
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:51:82: error: invalid token at start of a preprocessor expression
#if !defined(Q_CC_GNU) || defined(Q_CC_INTEL) || defined(Q_CC_CLANG) || Q_CC_GNU >= 408
                                                                                 ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:68:1: error: unknown type name 'Q_DECL_CONST_FUNCTION'
Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:68:23: error: expected unqualified-id
Q_DECL_CONST_FUNCTION inline uint qHash(QSizePolicy key, uint seed = 0) Q_DECL_NOTHROW;
                      ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:91:5: error: unknown type name 'Q_ENUM'
    Q_ENUM(Policy)
    ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:91:19: error: expected ';' at end of declaration list
    Q_ENUM(Policy)
                  ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:110:35: error: use of undeclared identifier 'ControlType'
    Q_DECLARE_FLAGS(ControlTypes, ControlType)
                                  ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:111:5: error: unknown type name 'Q_FLAG'
    Q_FLAG(ControlTypes)
    ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:111:12: error: duplicate member 'ControlTypes'
    Q_FLAG(ControlTypes)
           ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:110:21: note: previous declaration is here
    Q_DECLARE_FLAGS(ControlTypes, ControlType)
                    ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:111:25: error: expected ';' at end of declaration list
    Q_FLAG(ControlTypes)
                        ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:132:5: error: unknown type name 'Q_DECL_RELAXED_CONSTEXPR'
    Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) Q_DECL_NOTHROW { bits.horPolicy = d; }
    ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:132:30: error: expected member name or ';' after declaration specifiers
    Q_DECL_RELAXED_CONSTEXPR void setHorizontalPolicy(Policy d) Q_DECL_NOTHROW { bits.horPolicy = d; }
    ~~~~~~~~~~~~~~~~~~~~~~~~ ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:136:73: error: expected ';' at end of declaration list
    QT_SIZEPOLICY_CONSTEXPR Qt::Orientations expandingDirections() const Q_DECL_NOTHROW {
                                                                        ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:153:58: error: expected ';' at end of declaration list
    QT_SIZEPOLICY_CONSTEXPR int horizontalStretch() const Q_DECL_NOTHROW { return static_cast<int>(bits.horStretch); }
                                                         ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:176:47: error: expected ';' at end of declaration list
    QT_SIZEPOLICY_CONSTEXPR QSizePolicy(int i) Q_DECL_NOTHROW : data(i) { }
                                              ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:178:50: error: unknown type name 'Bits'
    QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) Q_DECL_NOTHROW : bits(b) { }
                                                 ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:178:57: error: expected ';' at end of declaration list
    QT_SIZEPOLICY_CONSTEXPR explicit QSizePolicy(Bits b) Q_DECL_NOTHROW : bits(b) { }
                                                        ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:223:9: error: unknown type name 'Bits'
        Bits bits;
        ^
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:231:33: error: use of undeclared identifier 'Q_RELOCATABLE_TYPE'; did you mean 'Q_MOVABLE_TYPE'?
Q_DECLARE_TYPEINFO(QSizePolicy, Q_RELOCATABLE_TYPE);
                                ^
/usr/local/include/QtCore/qglobal.h:2272:5: note: 'Q_MOVABLE_TYPE' declared here
    Q_MOVABLE_TYPE = 0x2,
    ^
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/mocs_compilation.cpp:2:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/moc_SideBySideRenderWindowsQt.cpp:9:
In file included from /Users/user/Downloads/VTK_Examples/SideBySideRenderWindowsQt/build/SideBySideRenderWindowsQt_autogen/EWIEGA46WW/../../../SideBySideRenderWindowsQt.h:6:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/QMainWindow:1:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qmainwindow.h:44:
In file included from /usr/local/opt/qt/lib/QtWidgets.framework/Headers/qwidget.h:52:
/usr/local/opt/qt/lib/QtWidgets.framework/Headers/qsizepolicy.h:231:33: error: use of undeclared identifier 'Q_RELOCATABLE_TYPE'; did you mean 'Q_MOVABLE_TYPE'?
Q_DECLARE_TYPEINFO(QSizePolicy, Q_RELOCATABLE_TYPE);
                                ^
/usr/local/include/QtCore/qglobal.h:2272:5: note: 'Q_MOVABLE_TYPE' declared here
    Q_MOVABLE_TYPE = 0x2,
    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [CMakeFiles/SideBySideRenderWindowsQt.dir/SideBySideRenderWindowsQt_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/SideBySideRenderWindowsQt.dir/all] Error 2
make: *** [all] Error 2

Аналогичная ошибка, которую я получаю с cmake -DCMAKE_CXX_COMPILER=g++-8, где g ++ - 8 устанавливается с brew

Может быть, стоит упомянуть, что есть программное обеспечение с использованием vtk и qt, которое я могу установить через brew без проблем.Одно и то же программное обеспечение не может быть скомпилировано напрямую (cmake -> make).

Может быть что-то с моей ОС не так?

...