构建基于Autoconf/Configure的Calcurse Yocto Recipe时配置报错求助
Yocto Recipe构建calcurse时configure阶段报错求助
背景
接触Yocto构建系统仅一周,为练习编写Yocto Recipe,选择了calcurse的GitHub仓库。已能在x86_64主机通过以下步骤手动编译calcurse:
$ ./autogen $ ./configure $ make $ make install
构建配置
Build Configuration: BB_VERSION = "2.8.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal" TARGET_SYS = "aarch64-poky-linux" MACHINE = "qemuarm64" DISTRO = "poky" DISTRO_VERSION = "5.0.6" TUNE_FEATURES = "aarch64 crc cortexa57" TARGET_FPU = "" meta meta-poky meta-yocto-bsp = "scarthgap:60b5842348f50ad44b6a64fc6201952bbbc46849" meta-clang = "scarthgap:9fbfa9db33131abdf3870a94f00199eb53e276e5" meta-oe meta-python = "scarthgap:3c293e14492f01e22a64004e2330fb620c27578a" meta-mylayer workspace = "scarthgap:60b5842348f50ad44b6a64fc6201952bbbc46849"
编写的Recipe(添加至meta-mylayer)
LICENSE = "Unknown" LIC_FILES_CHKSUM = "file://COPYING;md5=547ff6a749ae78798e7a1ab1c9177b9d" SRC_URI = "git://github.com/lfos/calcurse.git;protocol=https;branch=master" PV = "1.0+git" SRCREV = "95bb55f68b446e4461f27ef3a74a7d2eda950289" S = "${WORKDIR}/git" DEPENDS = "ncurses" DEPENDS += "autoconf-archive-native" inherit gettext autotools # Specify any options you want to pass to the configure script using EXTRA_OECONF: EXTRA_OECONF = "--with-ncursesw" do_configure() { bbplain "WORKDIR=${WORKDIR}" bbplain "S=${S}" cd ${S} ${S}/autogen.sh ${S}/configure --host=${TARGET_SYS} --prefix=/usr } do_compile() { cd ${S} oe_runmake } do_install() { cd ${S} oe_runmake install DESTDIR=${D} }
报错信息
执行bitbake calcurse-dev时出现如下错误:
| configure.ac:30: error: macro PKG_CHECK_EXISTS is not defined; is a m4 file missing? | /mnt/secondary/poky/build/tmp/work/cortexa57-poky-linux/calcurse-dev/1.0+git/recipe-sysroot-native/usr/share/aclocal/ax_require_defined.m4:35: AX_REQUIRE_DEFINED is expanded from... | /mnt/secondary/poky/build/tmp/work/cortexa57-poky-linux/calcurse-dev/1.0+git/recipe-sysroot-native/usr/share/aclocal/ax_with_curses.m4:197: _FIND_CURSES_FLAGS is expanded from... | ../autoconf-2.72e/lib/m4sugar/m4sh.m4:697: AS_IF is expanded from... | /mnt/secondary/poky/build/tmp/work/cortexa57-poky-linux/calcurse-dev/1.0+git/recipe-sysroot-native/usr/share/aclocal/ax_with_curses.m4:250: AX_WITH_CURSES is expanded from... | configure.ac:30: the top level | autom4te: error: m4 failed with exit status: 1 | aclocal: error: autom4te failed with exit status: 1 | configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found. | configure.ac: You should verify that configure.ac invokes AM_INIT_AUTOMAKE, | configure.ac: that aclocal.m4 is present in the top-level directory, | configure.ac: and that aclocal.m4 was recently regenerated (using aclocal) | configure.ac:15: installing './config.guess' | configure.ac:15: installing './config.sub' | Makefile.am:7: error: ENABLE_DOCS does not appear in AM_CONDITIONAL | doc/Makefile.am:3: error: HAVE_ASCIIDOC does not appear in AM_CONDITIONAL | doc/Makefile.am:10: error: HAVE_A2X does not appear in AM_CONDITIONAL | doc/Makefile.am:61: error: HAVE_ASCIIDOC does not appear in AM_CONDITIONAL | doc/Makefile.am:66: error: HAVE_A2X does not appear in AM_CONDITIONAL | src/Makefile.am: installing './depcomp'
解决方法
1. 补充缺失的依赖与m4宏支持
报错中的PKG_CHECK_EXISTS属于pkg-config相关宏,需添加pkgconfig-native依赖;同时要补充完整的autotools工具链,确保m4文件能被正确加载:
DEPENDS = "ncurses pkgconfig-native" DEPENDS += "autoconf-archive-native automake-native libtool-native"
2. 利用autotools类的默认逻辑,删除自定义do_configure
重写do_configure会跳过autotools类的环境初始化流程,导致宏路径、交叉编译环境变量未正确设置。添加AUTORECONF = "1"让系统自动执行autogen.sh,并通过EXTRA_OECONF传递配置参数,删除自定义的do_configure块:
AUTORECONF = "1" EXTRA_OECONF = "--with-ncursesw"
3. 修正LICENSE字段
calcurse采用BSD-2-Clause许可证,替换原有的Unknown:
LICENSE = "BSD-2-Clause"
4. 禁用文档构建(可选)
报错里的HAVE_ASCIIDOC等错误源于文档构建依赖,若不需要生成文档,可在EXTRA_OECONF中添加禁用选项:
EXTRA_OECONF = "--with-ncursesw --disable-docs"
最终修正后的Recipe
LICENSE = "BSD-2-Clause" LIC_FILES_CHKSUM = "file://COPYING;md5=547ff6a749ae78798e7a1ab1c9177b9d" SRC_URI = "git://github.com/lfos/calcurse.git;protocol=https;branch=master" PV = "1.0+git" SRCREV = "95bb55f68b446e4461f27ef3a74a7d2eda950289" S = "${WORKDIR}/git" DEPENDS = "ncurses pkgconfig-native" DEPENDS += "autoconf-archive-native automake-native libtool-native" inherit gettext autotools AUTORECONF = "1" EXTRA_OECONF = "--with-ncursesw --disable-docs" # 若无特殊需求,可删除自定义的do_compile和do_install,使用autotools类默认逻辑
验证
重新执行bitbake calcurse-dev,即可完成configure阶段并继续后续构建流程。
内容的提问来源于stack exchange,提问作者InsaneCoder
相关产品推荐
相关产品推荐

