【发布时间】:2020-11-27 04:50:13
【问题描述】:
以前版本的 Qt5 已经遇到过这个问题:Stack-overflow post (尚未回答)。我在使用更新的版本时遇到了同样的问题,并且我已经在线学习了几个教程:
即使所有这些教程都已过时,交叉编译 Qt5 的方法仍保持不变。我的目标板是运行 Raspbian Buster 的 Raspberry pi zero w。配置步骤运行良好(没有任何错误)。
我在执行 make 时遇到以下错误:
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"
# error "Qt requires C++11 support"
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:94:13: error: ‘QAtomicOps’ does not name a type
typedef QAtomicOps<T> Ops;
^
In file included from ~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/qglobal.h:1:0,
from ~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/src/corelib/global/qt_pch.h:56:
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:97:23: error: ‘QAtomicOpsSupport’ was not declared in this scope
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:121:68: note: in definition of macro ‘Q_STATIC_ASSERT_X’
# define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:97:51: error: ‘::IsSupported’ has not been declared
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:121:68: note: in definition of macro ‘Q_STATIC_ASSERT_X’
# define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/global/qglobal.h:121:49: error: non-constant condition for static assertion
# define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:97:5: note: in expansion of macro ‘Q_STATIC_ASSERT_X’
Q_STATIC_ASSERT_X(QAtomicOpsSupport<sizeof(T)>::IsSupported, "template parameter is an integral of a size not supported on this platform");
^
~/Documents/Raspbian/raspi/qt-everywhere-src-5.14.2/qtbase/include/QtCore/../../src/corelib/thread/qbasicatomic.h:97: confused by earlier errors, bailing out
make[3]: *** [Makefile:1836: .pch/Qt5Core.gch/c++] Error 1
make[3]: Leaving directory '~/Documents/Raspbian/raspi/qt5build/qtbase/src/corelib'
make[2]: *** [Makefile:228: sub-corelib-make_first] Error 2
make[2]: Leaving directory '~/Documents/Raspbian/raspi/qt5build/qtbase/src'
make[1]: *** [Makefile:51: sub-src-make_first] Error 2
make[1]: Leaving directory '~/Documents/Raspbian/raspi/qt5build/qtbase'
make: *** [Makefile:88: module-qtbase-make_first] Error 2
【问题讨论】:
-
你用的是什么编译器? - 对我来说看起来像一个 Windows 系统。是MSVS吗?还是明格? - 你能看到版本吗?您可能需要在 .pro 文件中指定 c++11 标志
CONFIG += c++11... -
@code_fodder 主机 pc 正在运行 ubuntu 20.04,我正在为 ARM 使用 gcc,因为我正在为 Rpi 进行交叉编译。我不太明白你在编译 qt 本身时将
CONFIG += c++11添加到 .pro 文件的意思。 -
能否请您更具体地了解您使用的编译器?你用的是哪个版本?发布您用于构建的命令可能会有所帮助,从而导致此错误。
-
@3.141592 我正在使用github.com/raspberrypi/tools 提供的gcc-arm-linux-gnueabihf 工具包(最新版本)。当我运行 make 命令时产生了错误
标签: c++ compilation raspberry-pi qt5 cross-compiling