使用 MinGW-64 构建 Qt 5.15.2:构建错误(缺少 EGL/egl.h)

时间:2021-06-29 11:50:35

标签: c++ qt opengl-es mingw

我已经尝试构建 Qt 5.15.2 好几天了。我解决了几个问题,但我找不到关于这个最后一个错误(或过时)的太多信息。

配置成功但使用 mingw32-make 命令构建失败并出现此错误:

<块引用>

qwindowseglcontext.h: 45: 10: 致命错误: EGL / egl.h: 没有那个文件或目录

我知道它缺少标题,但我找不到有关如何更正此问题的可行解释。经过一番研究,我发现了 https://cn.khronos.org/egl/ 但下载链接已失效,我还看到有人说可以使用 OpenGL ES AMD SDK,但我不知道它到底是什么。

如果有人能帮我解决这个问题,那将不胜感激。谢谢

这是我在编译前用来配置 Qt 的参数列表:

<块引用>

./configure.bat -skip qtimageformats -skip qtwinextras -no-feature-action -no-feature-animation -no-feature-big_codecs -no-feature-buttongroup -no-feature-calendarwidget -no-feature-codecs -no-feature-colordialog -no-feature-columnview -no-feature-combobox -no-feature-commandlinkbutton -no-feature-completer -no-feature-concatenatetablesproxymodel -no-feature-contextmenu -no-feature-cups -no -feature-cupsjobwidget -no-feature-datetimeedit -no-feature-dbus -no-feature-debug -no-feature-debug_and_release -no-feature-developer-build -no-feature-dial -no-feature-dirmodel -no -feature-dockwidget -no-feature-draganddrop -no-feature-easingcurve -no-feature-effects -no-feature-errormessage -no-feature-filedialog -feature-filesystemmodel -feature-filesystemwatcher -no-feature-fontcombobox -no -feature-fontdialog -no-feature-force_debug_info -no-feature-fscompleter -no-feature-gestures -no-feature-graphicseffect -no-feature-graphicsview -no-feature-groupbox -no-feature-hijricalendar -no-feature -一世conv -no-feature-icu -no-feature-identityproxymodel -no-feature-im -no-feature-image_heuristic_mask -no-feature-image_text -no-feature-imageformat_bmp -no-feature-imageformat_jpeg -no-feature-imageformat_ppm - no-feature-imageformat_xbm -no-feature-inotify -no-feature-inputdialog -no-feature-islamiccivilcalendar -no-feature-itemviews -no-feature-jalalicalendar -no-feature-keysequenceedit -no-feature-lcdnumber -no- feature-lineedit -no-feature-listview -no-feature-listwidget -no-feature-mainwindow -no-feature-mdiaarea -no-feature-menu -no-feature-menubar -no-feature-mimetype -no-feature- mimetype-database -no-feature-movie -no-feature-optimize_debug -feature-optimize_size -no-feature-pdf -no-feature-printdialog -no-feature-printer -no-feature-printpreviewdialog -no-feature-printpreviewwidget - no-feature-progressbar -no-feature-progressdialog -no-feature-proxymodel -no-feature-radiobutton -no-feature-raster-64bit -no-feature-release_tools -no-feature-resizehandler -no-feature-rubberband -不- feature-scrollarea -no-feature-scrollbar -no-feature-scroller -no-feature-separate_debug_info -no-feature-shared -no-feature-sizegrip -no-feature-slider -no-feature-sortfilterproxymodel -no-feature- spinbox -no-feature-splashscreen -no-feature-splitter -no-feature-stackedwidget -no-feature-standarditemmodel -no-feature-statemachine -feature-static -feature-static_runtime -no-feature-statusbar -no-feature- statustip -no-feature-stringlistmodel -no-feature-syntaxhighlighter -no-feature-systemtrayicon -no-feature-tabbar -no-feature-tabletevent -no-feature-tableview -no-feature-tablewidget -no-feature-tabwidget - no-feature-textbrowser -no-feature-textedit -no-feature-texthtmlparser -no-feature-textmarkdownreader -no-feature-textmarkdownwriter -no-feature-textodfwriter -no-feature-timezone -n​​o-feature-toolbar -no-功能工具箱 -no-feature-toolbutton -no-feature-tooltip -no-feature-topleveldomain -no-feature-translation -no-feature-transposeproxymodel -no-feature-treeview -no-feature-treewid get -no-feature-undocommand -no-feature-undogroup -no-feature-undostack -no-feature-undoview -no-feature-validator -no-feature-whatsthis -no-feature-wheelevent -no-feature-widgettextcontrol - no-feature-wizard -confirm-license -nomake 示例 -nomake 测试 -nomake 工具 -opensource -platform win32-g++ -prefix "C:\Qt\Static\5.15.2"

此列表随附我想使用此 Qt 构建的项目。

1 个答案:

答案 0 :(得分:0)

使用来自 https://github.com/McNopper/EGL 的 EGL

这是我从 MSYS2 构建和安装它的方法,以便它与 Qt 一起使用:

# change the install path below as needed
INSTALLPREFIX=/D/Prog/build

# fix missing egl.pc
cat > egl.pc << EOF
prefix=$INSTALLPREFIX
libdir=\${prefix}/lib
includedir=\${prefix}/include

Name: egl
Description: EGL implementation supporting OpenGL
Version: $VERSION
Libs: -L\${libdir} -legl
Cflags: -I\${includedir}
EOF
# fix EGL/CMakeLists.txt
patch -ulbf EGL/CMakeLists.txt << EOF
@@ -25,2 +25,5 @@
     \${EGL_SOURCES})
+add_library(egl_shared SHARED
+    \${EGL_SOURCES})
+set_target_properties(egl_shared PROPERTIES OUTPUT_NAME egl)

@@ -28,2 +31,4 @@
     \${CMAKE_CURRENT_LIST_DIR}/include)
+target_include_directories(egl_shared PUBLIC
+    \${CMAKE_CURRENT_LIST_DIR}/include)
 add_definitions(-DEGLAPI=)
EOF
mkdir -p build &&
 cmake.exe -Wno-dev -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX -DCMAKE_BUILD_TYPE:STRING=Release -SEGL -Bbuild &&
 echo "-Wl,--as-needed -lopengl32 -lglew32" >> build/CMakeFiles/egl_shared.dir/linklibs.rsp &&
 make -Cbuild &&
 strip build/*.dll &&
 mkdir -p $INSTALLPREFIX/include $INSTALLPREFIX/lib/pkgconfig $INSTALLPREFIX/bin &&
 cp -rf EGL/include/* $INSTALLPREFIX/include/ &&
 cp -f build/lib*.a $INSTALLPREFIX/lib/ &&
 cp -f build/*.dll $INSTALLPREFIX/bin/ &&
 cp -f egl.pc $INSTALLPREFIX/lib/pkgconfig/ &&
 echo SUCCESS

以上依赖于glew,它可以像这样从http://sourceforge.net/projects/glew/files/glew/的源代码构建:

# change the install path below as needed
INSTALLPREFIX=/D/Prog/build

mkdir -p build_win &&
 cmake.exe -Wno-dev -GNinja -DCMAKE_INSTALL_PREFIX:PATH=$INSTALLPREFIX -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_UTILS:BOOL=ON -Sbuild/cmake -Bbuild_win &&
 ninja -Cbuild_win &&
 # manually build libglew32mx
 gcc -DGLEW_MX -O2 -Wall -W -Iinclude -DGLEW_BUILD -o src/glew.mx.o -c src/glew.c &&
 gcc -fno-builtin -fno-stack-protector -shared -s -Wl,-soname,libglew32mx.dll -Wl,--out-implib,lib/libglew32mx.dll.a -o lib/glew32mx.dll src/glew.mx.o -Wl,--as-needed -lglu32 -lopengl32 -lgdi32 -luser32 -lkernel32 -nostdlib &&
 ar cr lib/libglew32mx.a src/glew.mx.o &&
 ninja -Cbuild_win install/strip &&
 # manually install libglew32mx
 cp -f lib/libglew32mx*.a $INSTALLPREFIX/lib/ &&
 cp -f lib/glew32mx.dll $INSTALLPREFIX/bin/ &&
 sed -e "s/-lglew32/-lglew32mx/; s/^Cflags: /&-DGLEW_MX /" $INSTALLPREFIX/lib/pkgconfig/glew.pc > $INSTALLPREFIX/lib/pkgconfig/glewmx.pc &&
 # manually install where needed
 cp -f include/GL/eglew.h $INSTALLPREFIX/include/GL/ &&
 mkdir -p $INSTALLPREFIX/cmake &&
 cp -f build/cmake/*.cmake $INSTALLPREFIX/cmake/ &&
 cp -f build_win/CMakeFiles/Export/lib/cmake/glew/*.cmake $INSTALLPREFIX/cmake/ &&
 sed -i -z -e "s/\(get_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\n\)\{3\}/\1/" $INSTALLPREFIX/cmake/glew-targets.cmake &&
 echo SUCCESS
相关问题