C++ 从源代码构建Qt5.8-配置:未知命令行选项'-c++;11';

C++ 从源代码构建Qt5.8-配置:未知命令行选项'-c++;11';,c++,qt,c++11,qmake,mingw-w64,C++,Qt,C++11,Qmake,Mingw W64,我按照中的说明,在MSYS2 shell和MinGW-w64-Win64 shell中使用选项A:buildqt gcc-v说: Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-6.

我按照中的说明,在MSYS2 shell和MinGW-w64-Win64 shell中使用选项A:buildqt

gcc-v说:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/6.3.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../gcc-6.3.0/configure
--build=x86_64-w64-mingw32
--disable-isl-version-check
--disable-libstdcxx-debug
--disable-libstdcxx-pch
--disable-multilib
--disable-nls
--disable-rpath
--disable-symvers
--disable-werror
--disable-win32-registry
--enable-bootstrap
--enable-checking=release
--enable-fully-dynamic-string
--enable-graphite
--enable-languages=c,lto,c++,objc,obj-c++,fortran,ada
--enable-libatomic
--enable-libgomp
--enable-libstdcxx-time=yes
--enable-lto
--enable-shared
--enable-static
--enable-threads=posix
--host=x86_64-w64-mingw32
--libexecdir=/mingw64/lib
--prefix=/mingw64
--target=x86_64-w64-mingw32
--with-arch=x86-64
--with-bugurl=https://sourceforge.net/projects/msys2
--with-gmp=/mingw64
--with-gnu-as
--with-gnu-ld
--with-isl=/mingw64
--with-libiconv
--with-local-prefix=/mingw64/local
--with-mpc=/mingw64
--with-mpfr=/mingw64
--with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include
--with-pkgversion='Rev1, Built by MSYS2 project'
--with-system-zlib
--with-tune=generic
Thread model: posix
gcc version 6.3.0 (Rev1, Built by MSYS2 project)
我下载了源代码

git clone https://code.qt.io/qt/qt5.git
cd qt5
perl init-repository
git checkout 5.8
我知道还有其他选择:

  • git克隆
  • wget
我发现第二个选项(归档)也存在同样的问题

在安装了所有先决条件之后,我构建了OpenSSL和ICU-安装在

  • /usr/local/openssl
  • /usr/本地/重症监护病房
但从那以后,说明就不那么清楚了。声明使用windows命令shell来设置一些环境变量。但是后来我使用了MSYS2 64位shell,所以这些都没有效果。以下是我所做的:

export INCLUDE=/usr/local/icu/include:/usr/local/openssl/include
export LIB=/usr/local/icu/lib:/usr/local/openssl/lib
export QMAKESPEC=
export QTDIR=
windows2unix() { local pathPcs=() split pathTmp IFS=\;; read -ra split <<< "$*"; for pathTmp in "${split[@],}"; do pathPcs+=( "/${pathTmp//+([:\\])//}" ); done; echo "${pathPcs[*]}"; }; systemrootP=$(windows2unix "$SYSTEMROOT"); export PATH="$PWD/qtbase/bin:$PWD/gnuwin32/bin:/c/msys64/mingw64/bin:/c/msys64/usr/bin:/c/msys64/usr/local/icu/lib"
export MAKE_COMMAND=
./configure -debug-and-release -opensource -confirm-license -platform win32-g++ -developer-build -c++11 -icu -opengl desktop -openssl -plugin-sql-odbc -nomake examples -nomake tests

也许我忘了在什么地方挂国旗了,但现在我被困在这里了。有人知道如何继续吗?

根据Andrei R.的评论,我删除了flag-c++11,这是为了解决问题

This is the Qt Open Source Edition.
You have already accepted the terms of the Open Source license.
Running configuration tests...
Checking for gold linker... no
Checking for valid makespec... yes
Checking for target architecture... x86_64
Checking for SSE2 instructions... yes
Checking for SSE3 instructions... yes
Checking for SSSE3 instructions... yes
Checking for SSE4.1 instructions... yes
Checking for SSE4.2 instructions... yes
Checking for AVX instructions... yes
Checking for bugfree AVX support in compiler... yes
Checking for AVX2 instructions... yes
Checking for AVX512 F instructions... no
Checking for C++14 support... yes
Checking for C++1z support... yes
Checking for compiler defaulting to C++11 or higher... yes

根据Andrei R.的评论,我删除了flag-c++11,这是为了解决这个问题

This is the Qt Open Source Edition.
You have already accepted the terms of the Open Source license.
Running configuration tests...
Checking for gold linker... no
Checking for valid makespec... yes
Checking for target architecture... x86_64
Checking for SSE2 instructions... yes
Checking for SSE3 instructions... yes
Checking for SSSE3 instructions... yes
Checking for SSE4.1 instructions... yes
Checking for SSE4.2 instructions... yes
Checking for AVX instructions... yes
Checking for bugfree AVX support in compiler... yes
Checking for AVX2 instructions... yes
Checking for AVX512 F instructions... no
Checking for C++14 support... yes
Checking for C++1z support... yes
Checking for compiler defaulting to C++11 or higher... yes

正确的编译器标志应该是-std=c++11,而不是-c++11


无论如何,GCC6.x隐式使用C++11,因此没有必要这样做。这在作者的日志中也很明显。

正确的编译器标志应该是-std=c++11,而不是-c++11


无论如何,GCC6.x隐式使用C++11,因此没有必要这样做。这一点在作者的日志中也很明显。

Qt5.8如果没有编译器中的c++11支持将无法编译,这使得-c++11标志可用。如果没有编译器中的c++11支持,Qt5.8将无法编译,这使得-c++11标志无用