首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Petalinux中多个C文件的执行错误

Petalinux中多个C文件的执行错误
EN

Stack Overflow用户
提问于 2018-09-26 11:55:24
回答 1查看 1.3K关注 0票数 0

我是新的2016.4。我在目标Zybo-Z7板上成功地安装了linux操作系统。我还构建了一个helloworld应用程序,到目前为止还不错。目前,我想测试我的应用程序,它的名称是test.c,有额外的一个头和C文件(new.cnew.h)。文件test.c、new.c、new.h位于路径中:

/$Petalinux-project-dir/project-spec/meta-user/recipes-apps/test/test

C有代码:

代码语言:javascript
复制
#include <stdio.h>
#include "new.h"

int main(int argc, char **argv)
{
        printf("Hello World!\n");

        return 0;
} 

new.c有以下代码:

代码语言:javascript
复制
#include "new.h"

void fun(void)
{
    printf("my function!\n");

}

new.h有以下单行代码:

代码语言:javascript
复制
#include <stdio.h>

Makefile有以下内容:

代码语言:javascript
复制
APP = test

# Add any other object files to this list below
APP_OBJS = test.o
APP_OBJS += new.o


all: build

build: $(APP)

$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

clean:
    $(RM) $(APP) $(OBJS)

最后,bitbake文件test.bb:

代码语言:javascript
复制
#
# This file is the test recipe.
#

SUMMARY = "Simple test application"
SECTION = "PETALINUX/apps"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

SRC_URI = "file://test.c \
           file://new.c \
           file://new.h \
           file://Makefile \
          "

S = "${WORKDIR}"

do_compile() {
         oe_runmake
}

do_install() {
         install -d ${D}${bindir}
         install -m 0755 test ${D}${bindir}
         install -m 0755 new ${D}${bindir}
}

然后,我尝试通过输入命令构建应用程序:

代码语言:javascript
复制
petalinux-build -c test -x build 

但是,我在log.do_configure中得到了以下错误消息:

代码语言:javascript
复制
DEBUG: Executing python function sysroot_cleansstate
DEBUG: Python function sysroot_cleansstate finished
DEBUG: Executing shell function do_configure
NOTE: make clean
make: *** No rule to make target 'clean'.  Stop.

petalinux-build -c test -x build 
ERROR: oe_runmake failed


ERROR: Function failed: do_configure (log file is located at /$petalinux-project-directory/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/test/1.0-r0/temp/log.do_configure.7230)

我在控制台中有以下内容:

代码语言:javascript
复制
    petalinux-build -c test -x build
    [INFO] building test
    [INFO] sourcing bitbake
    INFO: bitbake test -c build
    Loading cache: 100% |###########################################| ETA:  00:00:00
    Loaded 2942 entries from dependency cache.
    Parsing recipes: 100% |#########################################| Time: 00:00:02
    Parsing of 2326 .bb files complete (2292 cached, 34 parsed). 2941 targets, 196 skipped, 0 masked, 0 errors.
    NOTE: Resolving any missing task queue dependencies
    NOTE: Preparing RunQueue
    NOTE: Checking sstate mirror object availability (for 38 objects)
    NOTE: Executing SetScene Tasks
    NOTE: Executing RunQueue Tasks
    ERROR: test-1.0-r0 do_configure: oe_runmake failed
    ERROR: test-1.0-r0 do_configure: Function failed: do_configure (log file is located at /$Petalinux-project-dir/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/test/1.0-r0/temp/log.do_configure.7230)
    ERROR: Logfile of failure stored in: /$Petalinux-project-dir/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/test/1.0-r0/temp/log.do_configure.7230
    Log data follows:
    | DEBUG: Executing python function sysroot_cleansstate
    | DEBUG: Python function sysroot_cleansstate finished
    | DEBUG: Executing shell function do_configure
    | NOTE: make clean
    | make: *** No rule to make target 'clean'.  Stop.
    | ERROR: oe_runmake failed
    | ERROR: Function failed: do_configure (log file is located at /$Petalinux-project-dir/build/tmp/work/cortexa9hf-neon-xilinx-linux-gnueabi/test/1.0-r0/temp/log.do_configure.7230)
    ERROR: Task 5 (/$Petalinux-project-dir/project-spec/meta-user/recipes-apps/test/test.bb, do_configure) failed with exit code '1'
    NOTE: Tasks Summary: Attempted 610 tasks of which 605 didn't need to be rerun and 1 failed.
    Waiting for 0 running tasks to finish:

    Summary: 1 task failed:
      /$Petalinux-project-dir/project-spec/meta-user/recipes-apps/test/test.bb, do_configure
    Summary: There were 2 ERROR messages shown, returning a non-zero exit code.
    ERROR: Failed to build test

我试过:https://forums.xilinx.com/t5/Embedded-Linux/How-to-build-when-multiple-source-files-in-rootfs-of-petalinux/td-p/780949https://www.xilinx.com/support/answers/67189.html,还有这个类似的问题,How to build when multiple source files in rootfs in embedded linux?,但是它不起作用!

你能帮帮我吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-26 14:30:28

生成文件中没有clean目标。尝试:

代码语言:javascript
复制
APP := test

APP_OBJS := test.o new.o

.PHONY: all build clean

all: build

build: $(APP)

$(APP): $(APP_OBJS)
    $(CC) $(LDFLAGS) -o $@ $(APP_OBJS) $(LDLIBS)

clean:
    $(RM) $(APP) $(OBJS)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52517180

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档