簡體   English   中英

Bitbake 自動工具找不到 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

配置文件

#                                               -*- 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 時,我得到以下 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

誰能解釋為什么我的 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}中查找以下文件之一:

  • Makefile
  • makefile
  • GNUmakefile

如果存在,它將運行oe_runmake clean

因此,請確保正確命名 Makefile 並向其添加clean的目標。

有關自動工具如何工作的更多詳細信息,請查看此鏈接中的autotools

編輯

go 為了確保一切順利,請手動運行任務:

  • 檢查S變量值:
bitbake -e mainapplication | grep ^S=
  • 解壓並檢查S下的文件:
bitbake mainapplication -c unpack

您需要查看文件夾MAIN_Application及其內容。

  • 嘗試在systemd之前繼承autotools

編輯2

我試圖為您的 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 = ""

它編譯正確,因此,對於您的情況,只需設置:

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