c - 交叉编译问题

标签 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 有什么问题?

最佳答案

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

关于c - 交叉编译问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39287377/

相关文章:

c - 为什么我的STM32程序没有从第一行开始?

c - fseek 的性能开销是多少?

r - 在 linux 上用 R 绘制图形时代码困惑

linux - linux 中接口(interface)的特定接口(interface)名称

mysql - 尝试启动mysql时出现pthread_create错误13(权限)

gcc - cygwin 64 位上的简单 gcc 编译

c++ - gcc 4.7.1 构建以 undefined reference 结束

c - 使用 htons 确定字节顺序

c++ - 更改 boost::error_info 可见性

c - *** 检测到堆栈崩溃 ***//尝试打印一个字符