简体   繁体   English

Bitbake 自动工具找不到 makefile

[英]Bitbake autotools cannot find makefile

I am attempting to use autotools to build my project.我正在尝试使用 autotools 来构建我的项目。 I am using Yocto and bitbake to make a Linux image.我正在使用 Yocto 和 bitbake 制作 Linux 图像。

I have read a few automake tutorials and followed a basic guide I found on GitHub .我已经阅读了一些 automake 教程并遵循了我在GitHub上找到的基本指南。 This does not work so well with my current project.这不适用于我当前的项目。

My project structure is as follows:我的项目结构如下:

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: 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 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

My bb file is also very simple:我的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
}

When I run autogen.sh in my terminal I get the following output:当我在终端中运行 autogen.sh 时,我得到以下 output:

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

Can anyone explain why my bitbake build reports that it cannot find the Makefile.谁能解释为什么我的 bitbake 构建报告它找不到 Makefile。

Edit: Bitbake cannot find my Makefile because it does not exist.编辑:Bitbake 找不到我的 Makefile,因为它不存在。 I have a Makefile.am.我有一个 Makefile.am。 When I rename this to Makefile I get an oe_runmake error.当我将其重命名为 Makefile 时,出现 oe_runmake 错误。

Here are my comments:这是我的评论:

I recommend specifying the full project folder whithout specifying FILESEXTRAPATHS我建议指定完整的项目文件夹而不指定FILESEXTRAPATHS

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

Then you need to specify the S variable to the source files folder:然后您需要将S变量指定给源文件文件夹:

S = "${WORKDIR}/MAIN_Application"

Also, be aware that autotools class will try to look for one of the following files in ${S} :另外,请注意autotools class 将尝试在${S}中查找以下文件之一:

  • Makefile Makefile
  • makefile makefile
  • GNUmakefile GNUmakefile

If one exists it will run oe_runmake clean .如果存在,它将运行oe_runmake clean

So, make sure you name the Makefile correctly and add clean target to it.因此,请确保正确命名 Makefile 并向其添加clean的目标。

Fore more detailed info about how autotools work check the class in this link有关自动工具如何工作的更多详细信息,请查看此链接中的autotools

EDIT编辑

In order to make sure that everything will go well, run the tasks manually: go 为了确保一切顺利,请手动运行任务:

  • Check the S variable value:检查S变量值:
bitbake -e mainapplication | grep ^S=
  • Unpack and check files under S :解压并检查S下的文件:
bitbake mainapplication -c unpack

You need to see the folder MAIN_Application with its content there.您需要查看文件夹MAIN_Application及其内容。

  • Try to inherit autotools before systemd .尝试在systemd之前继承autotools

EDIT2编辑2

I tried to create a recipe for your Github example link, and here is the final recipe:我试图为您的 Github 示例链接创建一个配方,这是最终配方:

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 = ""

it compiles correctly, so, for your case just set:它编译正确,因此,对于您的情况,只需设置:

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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM