minGw64编译Qt时遇到too many sections问题
时间: 2024-04-25 18:26:22 浏览: 7
这个问题是由于MinGW编译器版本太老导致的,可以尝试升级MinGW编译器。
另外,也可以在编译Qt时通过配置减少生成的section数量,具体可以在configure命令中加入参数“-no-dwarf2 -no-exceptions -no-rtti -no-optimized-qt3d -no-optimized-qtwebengine”,这样可以减少生成的section数量,从而避免该问题的发生。
相关问题
qt mingw编译vtk,File too big/too many sections
这个问题通常是因为编译器默认的obj文件格式与VTK中的文件格式不兼容导致的。解决方法是使用另一种obj文件格式,如COFF或ELF。
在使用Mingw编译时,可以在命令行中添加以下选项来指定使用COFF格式:
```
-mwindows -Wl,--enable-auto-import -Wl,--subsystem,windows -Wl,--output-def,libvtkCommonCore.def -Wl,--out-implib,libvtkCommonCore.a -Wl,--export-all-symbols -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base -fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--warn-common
```
如果还是不行,可以尝试使用64位的Mingw编译器或者使用其他编译器(如Visual Studio)进行编译。
qt5.12.12 minGw64 File too big too many sections (83249)
这个问题可能是由于使用的MinGW编译器版本太老,无法处理较大的目标文件而导致的。可以尝试升级MinGW编译器版本,或者使用其他编译器,例如Visual C++等。
另外,也可以在编译Qt时进行一些参数配置,以减少生成的目标文件的大小和section数量。具体可以在configure命令中加入一些参数,例如:
```
-opensource -confirm-license -debug-and-release -no-warnings-are-errors -platform win32-g++ -no-qml-debug -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -skip qtwebengine -skip qt3d -skip qtgamepad -skip qtlocation -skip qtwebchannel -skip qtwebsockets -skip qtx11extras -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwinextras -skip qtvirtualkeyboard -skip qttools -skip qtquickcontrols -skip qtandroidextras -skip qtcharts -skip qtdatavis3d -skip qtmacextras -skip qtpurchasing -skip qtremoteobjects -skip qtscript -skip qtscxml -skip qtsvg -skip qtwebview -no-angle
```
这些参数将会跳过一些不必要的模块,从而减少生成的目标文件的大小和section数量。