我想用 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 有什么问题?
最佳答案
gcc 将调用其他工具,例如 cc1,但是正如 @js441 告诉您的那样,该程序不在您的 makefile 的系统路径中。
关于c - 交叉编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39287377/