【问题标题】:Issue with cross compilation交叉编译问题
【发布时间】: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 出了什么问题?

【问题讨论】:

标签: c linux gcc makefile


【解决方案1】:

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

【讨论】:

  • 在系统路径中制作 cc1 的任何解决方案!
  • echo 'export PATH=your-path/bin:$PATH' >> /etc/profile with root 权限,然后 source /etc/profile.因为有些 linux 不能使用 .bashrc
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-10
  • 1970-01-01
  • 1970-01-01
  • 2016-07-11
  • 2021-07-26
  • 2020-12-05
相关资源
最近更新 更多