Buildroot启用webkitgtk时webkitgtk编译错误求助
我在Ubuntu 22.10 64位虚拟机中运行Buildroot 2022.02.7,启用midori包后自动选中webkitgtk(v2.36.7),源码下载与配置无报错,但编译阶段make抛出错误终止:
[ 45%] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir///WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-76.cpp.o
make[4]: *** [Source/WebCore/CMakeFiles/WebCore.dir/build.make:4281: Source/WebCore/CMakeFiles/WebCore.dir///WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-31.cpp.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [CMakeFiles/Makefile2:1018: Source/WebCore/CMakeFiles/WebCore.dir/all] Error 2
make[2]: *** [Makefile:156: all] Error 2
make[1]: *** [package/pkg-generic.mk:293: /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
回溯日志发现具体错误:
[ 45%] Building CXX object Source/WebCore/CMakeFiles/WebCore.dir///WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-52.cpp.o
In file included from /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/Source/WebCore/platform/graphics/filters/FESpecularLighting.h:25,
from /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/Source/WebCore/svg/SVGFESpecularLightingElement.h:25,
from /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/WebCore/DerivedSources/JSSVGFESpecularLightingElement.h:26,
from /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/WebCore/DerivedSources/JSDOMWindow.cpp:416,
from /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/WebCore/DerivedSources/unified-sources/UnifiedSource-3a52ce78-31.cpp:2:
/home/dev/workspace/pios4/output/build/webkitgtk-2.36.7/Source/WebCore/platform/graphics/filters/FELighting.h:72:41: error: ‘LightingData’ does not name a type
72 | inline void platformApplyNeon(const LightingData&, const LightSource::PaintingData&);
| ^~~~~~~~~~~~
因需保留当前Buildroot配置以兼容其他项,尝试了Stack Overflow相关回答中的方案2,但编译仍失败,求解决方法。
这个错误是WebKitGTK 2.36.7的代码兼容性问题:platformApplyNeon函数声明引用的LightingData类型未被正确引入,针对Buildroot环境可按以下步骤修复:
修改头文件补全类型引用
进入webkitgtk编译目录:cd /home/dev/workspace/pios4/output/build/webkitgtk-2.36.7编辑
Source/WebCore/platform/graphics/filters/FELighting.h,在文件开头的#include区域添加:#include "platform/graphics/filters/LightingData.h"或者直接在
class FELighting声明前添加前置声明:struct LightingData;强制重新编译webkitgtk
清理已有编译状态并重新编译:make package/webkitgtk/clean make package/webkitgtk/compile禁用NEON优化(备选)
如果头文件修改无效,可通过Buildroot配置关闭NEON优化:- 运行
make menuconfig - 进入
Target packages->Libraries->Graphics->webkitgtk - 取消勾选
Enable NEON optimizations选项 - 保存配置后重新执行编译
- 运行
若需要长期解决该问题,建议为Buildroot的webkitgtk 2.36.7包添加对应的补丁,避免每次构建都需手动修改代码。
内容的提问来源于stack exchange,提问作者JasonP

