【发布时间】:2016-09-02 08:08:24
【问题描述】:
我想用 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 出了什么问题?
【问题讨论】:
-
/project_path/arm-linux-uclibcgnueabi/bin/gcc是否存在并具有可执行权限? -
是 /project_path/arm-linux-uclibcgnueabi/bin/gcc 有执行权限:-rwxr-xr-x
-
当我用 CC=gcc 编译时它工作正常(不是交叉编译)