交叉编译问题

时间:2016-09-02 08:08:25

标签: c linux gcc makefile

我想用ARM工具链在c中编译一个简单的测试程序。

我的Makefile如下:

CC=/project_path/arm-linux-uclibcgnueabi/bin/gcc

# the compiler: gcc for C program, define as g++ for C++
# compiler flags:
#  -g    adds debugging information to the executable file
#  -Wall turns on most, but not all, compiler warnings
CFLAGS  = -g -Wall
# the build target executable:
TARGET = test
all: $(TARGET)
$(TARGET): $(TARGET).c
        $(CC) $(CFLAGS) -o $(TARGET) $(TARGET).c

clean:
        $(RM) $(TARGET)

test.c文件仅用于编译测试:

#include <stdio.h>

int main(void) {
    printf("just for test \n");
    return 0;
}

当我执行make时,出现以下错误:

/project_path/arm-linux-uclibcgnueabi/bin/gcc -g -Wall -o test test.c
gcc: error trying to exec 'cc1': execvp: No such file or directory
Makefile:13: recipe for target 'test' failed
make: *** [test] Error 1

我的Makefile出了什么问题?

1 个答案:

答案 0 :(得分:1)

gcc将调用其他工具,如cc1,但该程序不在makefile的系统路径中,就像@ js441告诉你的那样。