Bitbake autotools 找不到 makefile

Bitbake autotools cannot find makefile

我正在尝试使用 autotools 来构建我的项目。我正在使用 Yocto 和 bitbake 制作 Linux 图像。

我阅读了一些 automake 教程并遵循了我在 GitHub 上找到的基本指南。这不适用于我当前的项目。

我的项目结构如下:

michael@michael-VirtualBox:~/Documents/MAIN_custom/MAIN_layers/meta-MAINapplication/recipes-core/MAIN_Application$ tree
.
├── files
│   ├── MAIN_Application
│   │   ├── autogen.sh
│   │   ├── configure.ac
│   │   ├── Makefile.am
│   │   ├── project.yml
│   │   ├── src
│   │   │   ├── include
│   │   │   │   ├── main.h
│   │   │   │   ├── scheduler.h
│   │   │   │   └── utilities
│   │   │   │       └── time_conversions.h
│   │   │   └── src
│   │   │       ├── main.c
│   │   │       ├── scheduler.c
│   │   │       └── utilities
│   │   │           └── time_conversions.c
│   │   └── test
│   │       ├── test_scheduler.c
│   │       └── test_time_conversions.c
│   └── services
│       └── mainapplication.service
└── mainapplication_0.0.bb

autogen.sh:

#!/bin/sh

echo "Generating configure files... may take a while."

autoreconf --install --force && \
  echo "Preparing was successful if there was no error messages above." && \
  echo "Now type:" && \
  echo "  ./configure && make"  && \
  echo "Run './configure --help' for more information"

Makefile.am

AUTOMAKE_OPTIONS = foreign

CFLAGS = -Wall -pedantic -O2
include_HEADERS = main.h

bin_PROGRAMS = EVCC_Application
EVCC_Application_SOURCES = main.c

configure.ac

#                                               -*- Autoconf -*-
AC_PREREQ(2.60)
AC_INIT([EVCC_Application],[0.0.1],[michaelminer@smartrendmfg.com])
AM_INIT_AUTOMAKE([1.9 foreign])
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AM_SILENT_RULES([yes])

AC_CONFIG_MACRO_DIRS([m4])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

我的bb文件也很简单:

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

FILESEXTRAPATHS:prepend := "${THISDIR}/files/MAIN_Application:"
FILESEXTRAPATHS:prepend := "${THISDIR}/files/MAIN_Application/src:"
FILESEXTRAPATHS:prepend := "${THISDIR}/files/services:"

SRC_URI = "\
    file://mainapplication.service \
    file://src/utilities/time_conversions.c \
    file://src/main.c \ 
    file://src/scheduler.c \    
    file://include/main.h \ 
    file://include/scheduler.h \        
    file://include/utilities/time_conversions.h \   
    file://Makefile \   
    "

inherit systemd autotools

S = "${WORKDIR}"

SYSTEMD_SERVICE_${PN} = "mainapplication.service"

do_install_append () {
    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${S}/mainapplication.service ${D}${systemd_system_unitdir}
    sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/mainapplication.service
}

当我在终端中 运行 autogen.sh 时,我得到以下输出:

configure.ac:4: installing './compile'
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
Makefile.am: installing './depcomp'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: executing depfiles commands

谁能解释为什么我的 bitbake 构建报告找不到 Makefile。

编辑:Bitbake 找不到我的 Makefile,因为它不存在。我有一个Makefile.am。当我将其重命名为 Makefile 时,出现 oe_runmake 错误。

这是我的评论:

我建议在不指定的情况下指定完整的项目文件夹 FILESEXTRAPATHS

SRC_URI = "file://MAIN_Application"
SRC_URI += "file://services/"

然后你需要指定 S 变量到源文件文件夹:

S = "${WORKDIR}/MAIN_Application"

此外,请注意 autotools class 将尝试在 ${S} 中查找以下文件之一:

  • 生成文件
  • 生成文件
  • GNUmakefile

如果存在,它将 运行 oe_runmake clean.

因此,请确保正确命名 Makefile 并向其添加 clean 目标。

有关 autotools 如何工作的更多详细信息,请查看此 link

中的 class

编辑

为了确保一切顺利,运行手动完成任务:

  • 检查S变量值:
bitbake -e mainapplication | grep ^S=
  • 解压并检查S下的文件:
bitbake mainapplication -c unpack

您需要查看文件夹 MAIN_Application 及其内容。

  • 尝试在systemd之前继承autotools

EDIT2

我试图为您的 Github 示例 link 创建配方,这是最终配方:

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=96af5705d6f64a88e035781ef00e98a8"
SRC_URI = "git://github.com/DynamicDevices/bbexample;protocol=https"
PV = "0.1+git${SRCPV}"
SRCREV = "b9fb7785e9e1f357f29bef63dce8f1d91adb6170"
S = "${WORKDIR}/git"
inherit autotools
EXTRA_OECONF = ""

它编译正确,因此,对于您的情况,只需设置:

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "\
    file://MAIN_Application \
    file://services \ 
    "

inherit autotools systemd

S = "${WORKDIR}/MAIN_Application"

SYSTEMD_SERVICE_${PN} = "mainapplication.service"

do_install_append () {
    install -d ${D}${systemd_system_unitdir}
    install -m 0644 ${WORKDIR}/services/mainapplication.service ${D}${systemd_system_unitdir}
    sed -i -e 's,@BINDIR@,${bindir},g' ${D}${systemd_system_unitdir}/mainapplication.service
}