2

I would like to compile a simple test program in c with an ARM toolchain.

My Makefile is as follows:

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)

The test.c file is a just for compilation test:

#include <stdio.h>

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

When I execute make, I get the following error:

/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

What is wrong with my Makefile?

js441
  • 1,134
  • 8
  • 16
Anis_Stack
  • 3,306
  • 4
  • 30
  • 53
  • Does `/project_path/arm-linux-uclibcgnueabi/bin/gcc` exist and has executable permissions? – dmi Sep 02 '16 at 08:13
  • 4
    Possible duplicate of [Gcc error: gcc: error trying to exec 'cc1': execvp: No such file or directory](http://stackoverflow.com/questions/11912878/gcc-error-gcc-error-trying-to-exec-cc1-execvp-no-such-file-or-directory) – js441 Sep 02 '16 at 08:14
  • yes /project_path/arm-linux-uclibcgnueabi/bin/gcc has exec permission : -rwxr-xr-x – Anis_Stack Sep 02 '16 at 08:19
  • when I compile with CC=gcc it works fine (not cross compile) – Anis_Stack Sep 02 '16 at 08:26

1 Answers1

1

gcc will invoke other tools like cc1, however that program wasn't in system path in your makefile, just as @js441 tells you.

njj
  • 11
  • 3