如何解决Yocto构建系统编译CouchDB适配Erlang v24失败问题
Yocto编译Erlang 24(CouchDB适配版)失败的排查与解决
使用meta-erlang层编译CouchDB推荐的Erlang 24版本时编译失败,报错中包含wxWidgets依赖警告,且最终出现sed: can't read .../config.h的致命错误。配方中未声明wxWidgets依赖,疑惑是否需要手动添加wxwidgets-native。
报错信息
| configure: WARNING: No GLU headers found, wx will NOT be usable | configure: WARNING: | wxWidgets must be installed on your system. | | Please check that wx-config is in path, the directory | where wxWidgets libraries are installed (returned by | 'wx-config --libs' or 'wx-config --static --libs' command) | is in LD_LIBRARY_PATH or equivalent variable and | wxWidgets version is 3.0.2 or above. | | ********************************************************************* | ********************** APPLICATIONS DISABLED ********************** | ********************************************************************* | | jinterface : Java compiler disabled by user | observer : User gave --without-observer option | odbc : User gave --without-odbc option | | ********************************************************************* | ********************************************************************* | ********************** APPLICATIONS INFORMATION ******************* | ********************************************************************* | | wx : No GLU headers found, wx will NOT be usable | wxWidgets was not compiled with --enable-webview or wxWebView developer package is not installed, wxWebView will NOT be available | | wxWidgets must be installed on your system. | | Please check that wx-config is in path, the directory | where wxWidgets libraries are installed (returned by | 'wx-config --libs' or 'wx-config --static --libs' command) | is in LD_LIBRARY_PATH or equivalent variable and | wxWidgets version is 3.0.2 or above. | | ********************************************************************* | ********************************************************************* | ********************** DOCUMENTATION INFORMATION ****************** | ********************************************************************* | | documentation : | xsltproc is missing. | fop is missing. | xmllint is missing. | The documentation cannot be built. | | | ********************************************************************* | sed: can't read /mnt/project/tmp/work/cortexa7t2hf-neon-ino-linux-musleabi/erlang/25.3.2.8/git/erts/arm-ino-linux-musleabi-gnu/config.h: No such file or directory | WARNING: exit code 2 from a shell command.
问题分析
- 版本不匹配:报错中显示编译的是Erlang 25.3.2.8,而非目标的24版本,说明meta-erlang层默认拉取的版本不符,需强制指定24版本。
- wxWidgets警告非致命:wx相关警告是configure阶段的检查提示,若不需要Erlang的GUI工具(如observer),可通过配置选项跳过检查,无需添加
wxwidgets-native依赖。 - 致命错误根源:
config.h缺失是编译失败的核心原因,通常是configure阶段未正确生成文件,可能因文档依赖缺失(xsltproc、fop等)或交叉编译环境配置异常导致。
解决方案
- 指定Erlang 24版本:在自定义layer中创建
erlang_24.bbappend文件,强制使用目标版本:ERLANG_VERSION = "24.3.4.14" SRC_URI = "git://github.com/erlang/otp.git;tag=OTP-${ERLANG_VERSION}" - 跳过不必要的检查与编译:在bbappend中添加额外配置选项,禁用wx、文档及非必需组件:
EXTRA_OECONF += "--without-wx --disable-docs --without-observer --without-odbc --without-jinterface" - 修复交叉编译环境:确保目标架构的musl头文件完整,若使用自定义distro,需包含
meta-oe等基础层以提供必要的编译工具链。
内容的提问来源于stack exchange,提问作者BlameCapitalism
相关产品推荐
相关产品推荐

