最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

makefile - Building a yocto recipe with autoconf and configure - Stack Overflow

programmeradmin2浏览0评论

I am learning about yocto build system and just almost a week into it. I randomly chose calcurse Github repository and decided to build it via Yocto recipe so that I can have some practice and I am having tough time.

Manually I am able to clone and build calcurse with the following steps on my x86_64 host machine :

$ ./autogen
$ ./configure
$ make
$ make install

Now I want to build the same with a Yocto recipe. Below is my build configuration for reference :

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"

I prepared the below recipe (which is added to meta-mylayer) and it fails at configure step.

LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://COPYING;md5=547ff6a749ae78798e7a1ab1c9177b9d"

SRC_URI = "git://github/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}
}

And this is the error I get when I run 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'

I am learning about yocto build system and just almost a week into it. I randomly chose calcurse Github repository and decided to build it via Yocto recipe so that I can have some practice and I am having tough time.

Manually I am able to clone and build calcurse with the following steps on my x86_64 host machine :

$ ./autogen
$ ./configure
$ make
$ make install

Now I want to build the same with a Yocto recipe. Below is my build configuration for reference :

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"

I prepared the below recipe (which is added to meta-mylayer) and it fails at configure step.

LICENSE = "Unknown"
LIC_FILES_CHKSUM = "file://COPYING;md5=547ff6a749ae78798e7a1ab1c9177b9d"

SRC_URI = "git://github/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}
}

And this is the error I get when I run 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'
Share Improve this question asked Mar 14 at 13:23 InsaneCoderInsaneCoder 8,32818 gold badges84 silver badges187 bronze badges 3
  • 1 When you have the option, it is better to start with an Autotools (source) distribution tarball, which will contain an already-built configure script and other, related artifacts. You then avoid autogen.sh or similar tools whose purpose is to build those artifacts. This is the intended usage mode of Autotools build systems for people who just want to build the software, not develop it, and it prevents exposure to issues related to differences between versions of the Autotools. – John Bollinger Commented Mar 14 at 14:28
  • 1 I'm uncertain how well it fits with bitbake / yocto, but since you can build the project manually, you can create a suitable distribution tarball. To do so, use make dist after configuring the project. – John Bollinger Commented Mar 14 at 14:32
  • Closely related: stackoverflow/q/8578181/2402272 – John Bollinger Commented Mar 14 at 14:36
Add a comment  | 

2 Answers 2

Reset to default 1

The errors you present come from the execution of autogen.sh, and they appear primarily to reflect that required components are missing from the package's bitbake compilation environment.

The documentation for calcurse gives the following build dependencies:

  • gcc
  • autoconf-archive
  • automake
  • autopoint
  • asciidoc
  • gettext with development files
  • ncurses with development files

It doesn't look like your recipe is ensuring that full list of dependencies (whether explicitly or by relying on defaults).

What's more, the package docs appear to overlook a build dependency on one or more pkgconf components, which your recipe also is not ensuring.


As a separate but related matter, packages with Autotools build systems are best built from Autotools distribution tarballs, such as can be built via the project's make dist. These will include pre-built configure scripts and other built Autools artefacts, which are intended to be used as-is, not rebuilt (via autogen.sh, autoreconf, or similar). In your particular case, using such a starting point and omitting execution of autogen.sh would slightly reduce the build dependency list (perhaps more so if some of those deps are optional, and you're ok with not including them), but it looks like that would still leave you with some unaccounted-for deps.

In General

You can remove a lot from your recipe. Yocto takes care of most build steps automatically, if:

  • you inherit the right classes
  • the build files properly respect $CC variables etc.

Calcurse Issue

I'm able to compile calcurse by adding inherit pkgconfig to your recipe and removing the manual tasks. Hint was the line:

configure.ac:30: error: macro PKG_CHECK_EXISTS is not defined

PKG_CHECK_EXISTS is a macro by pkg-config for autotools. Something depends on pkg-config during compilation, as John Bollinger pointed out in detail in their answer. man pkg-config says:

The macro PKG_CHECK_MODULES can be used in configure.ac to check whether modules exist.

Fixed Recipe

Content of calcurse.bb. Set the license correctly. Disable docs, due to asciidoc issues.

LICENSE = "BSD-2-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=547ff6a749ae78798e7a1ab1c9177b9d"

SRC_URI = "git://github/lfos/calcurse.git;protocol=https;branch=master"

PV = "1.0+git"
SRCREV = "95bb55f68b446e4461f27ef3a74a7d2eda950289"

S = "${WORKDIR}/git"

DEPENDS += "ncurses autoconf-archive-native"

inherit gettext autotools pkgconfig

# Specify any options you want to pass to the configure script using EXTRA_OECONF:
EXTRA_OECONF = "--disable-docs recipe-acl-native"

Running this should succeed:

$ bitbake calcurse
Loading cache: 100% |############### ...

Sstate summary: Wanted 56 Local 8 Mirrors 0 Missed 48 Current 36 (14% match, 47% complete)
NOTE: Executing Tasks
NOTE: Tasks Summary: Attempted 406 tasks of which 399 didn't need to be rerun and all succeeded.

发布评论

评论列表(0)

  1. 暂无评论