Ben*_*ler 4 c++ qt gcc build qt5
我已经使用 GCC/MinGW-w64 在 Windows 上成功构建 Qt 5 很长时间了。当我在 GCC 11.1 上尝试同样的操作时,构建失败并出现奇怪的错误消息。我该怎么做才能让它发挥作用?
我自己使用https://github.com/niXman/mingw-buildsdevelop的分支和以下命令构建了编译器:
../build --mode=gcc-11.1.0 --arch=x86_64 --buildroot=/c/mingw-builds/BuildRoot --update-sources --exceptions=seh --threads=posix --enable-languages=c++ --jobs=48 --rt-version=v7
Run Code Online (Sandbox Code Playgroud)
然后我在 MSYS2 控制台上像这样检索 Qt:
# Ensure that the right Perl is being used to prevent the possible later compilation error "fatal error: QVector: No such file or directory"
export PATH=/c/Strawberry/perl/bin/:$PATH
cd /c
cd Libraries/
mkdir Qt
cd Qt
git clone git://code.qt.io/qt/qt5.git
cd qt5
git checkout v5.13.2
perl init-repository --module-subset=essential --berlin
cd ..
Run Code Online (Sandbox Code Playgroud)
然后我尝试构建 Qt:
mkdir Build
cd Build
../qt5/configure -prefix ../Install -release -recheck-all -confirm-license -opensource -platform win32-g++ -opengl desktop -nomake examples -nomake tests -skip qtconnectivity -skip qtdeclarative -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtsensors -skip qtwebsockets -skip qtwinextras -skip qtwebchannel -skip qtwebengine
mingw32-make -j 48
Run Code Online (Sandbox Code Playgroud)
但configure显示很多类似这样的错误:
qt5/qtbase/src/corelib/global/qendian.h:333:35: error: 'numeric_limits' is not a member of 'std'
Run Code Online (Sandbox Code Playgroud)
我该如何修复它?
此外,我想将其链接到由“Open CASCADE”分发的“FreeType”库(为 MinGW 构建的版本)(请参阅https://dev.opencascade.org/resources/download/3rd-party-components)。这怎么可能?
有几个问题需要解决。
首先,我必须修补 Qt,因为在 GCC 11 中,一些标头依赖项已更改,并且 Qt 5.13.2 并不总是包含正确的标头(请参阅https://gcc.gnu.org/gcc-11/porting_to.html或如何我通过编译标志包含头文件?)。
因此我添加了这一行
#include <limits>
Run Code Online (Sandbox Code Playgroud)
#ifdef __cplusplus在文件块内
qt5/qtbase/src/corelib/global/qglobal.h
Run Code Online (Sandbox Code Playgroud)
如果没有使用自己的 FreeType 库,则构建现在会成功。
但是当我添加configure命令选项时
-system-freetype -I /c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/include -L/c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/bin -L/c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/lib
Run Code Online (Sandbox Code Playgroud)
然后运行mingw32-make -j 48,我收到以下错误消息:
internal error in mingw32_gt_pch_use_address, at config/i386/host-mingw32.c:186: MapViewOfFileEx: Attempt to access invalid address.
Run Code Online (Sandbox Code Playgroud)
-no-pch这可以通过在命令中添加选项来解决configure。现在的调用如下所示:
../qt5/configure -prefix ../Install -release -recheck-all -confirm-license -no-pch -opensource -platform win32-g++ -opengl desktop -nomake examples -nomake tests -system-freetype -I /c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/include -L/c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/bin -L/c/Libraries/OpenCascade/3rdPartyMingw64/freetype-2.6.3-mingw-64/lib -skip qtconnectivity -skip qtdeclarative -skip qtlocation -skip qtmultimedia -skip qtquickcontrols -skip qtquickcontrols2 -skip qtsensors -skip qtwebsockets -skip qtwinextras -skip qtwebchannel -skip qtwebengine
Run Code Online (Sandbox Code Playgroud)
运行configure构建后可以运行
mingw32-make -j 48
Run Code Online (Sandbox Code Playgroud)
它成功了。
| 归档时间: |
|
| 查看次数: |
3265 次 |
| 最近记录: |