简体   繁体   中英

Bitbake autotools cannot find makefile

I am attempting to use autotools to build my project. I am using Yocto and bitbake to make a Linux image.

I have read a few automake tutorials and followed a basic guide I found on 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:

#!/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

My bb file is also very simple:

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:

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.

Edit: Bitbake cannot find my Makefile because it does not exist. I have a Makefile.am. When I rename this to Makefile I get an oe_runmake error.

Here are my comments:

I recommend specifying the full project folder whithout specifying FILESEXTRAPATHS

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

Then you need to specify the S variable to the source files folder:

S = "${WORKDIR}/MAIN_Application"

Also, be aware that autotools class will try to look for one of the following files in ${S} :

  • Makefile
  • makefile
  • GNUmakefile

If one exists it will run oe_runmake clean .

So, make sure you name the Makefile correctly and add clean target to it.

Fore more detailed info about how autotools work check the class in this link

EDIT

In order to make sure that everything will go well, run the tasks manually:

  • Check the S variable value:
bitbake -e mainapplication | grep ^S=
  • Unpack and check files under S :
bitbake mainapplication -c unpack

You need to see the folder MAIN_Application with its content there.

  • Try to inherit autotools before systemd .

EDIT2

I tried to create a recipe for your Github example link, and here is the final recipe:

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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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