[Solved] aarch64-none-elf-gcc: fatal error: cannot execute ‘cc1’: execvp: No such file or directory

root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# make
mkdir -p build
aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
make: aarch64-none-elf-gcc: Command not found
Makefile:16: recipe for target 'build/kernel_c.o' failed
make: *** [build/kernel_c.o] Error 127
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# export PATH="$PATH:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/"
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# aarch64-none-elf-gcc --version
aarch64-none-elf-gcc (GNU Toolchain for the A-profile Architecture 10.3-2021.07 (arm-10.29)) 10.3.1 20210621
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Still report error
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# make
mkdir -p build
aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
make: aarch64-none-elf-gcc: Command not found
Makefile:16: recipe for target 'build/kernel_c.o' failed
make: *** [build/kernel_c.o] Error 127
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
aarch64-none-elf-gcc: fatal error: cannot execute 'cc1': execvp: No such file or directory
compilation terminated.
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31#

 

root@ubuntu:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf# find ./ -name cc1
./libexec/gcc/aarch64-none-elf/10.3.1/cc1
root@ubuntu:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf#

 

root@ubuntu:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf# ls /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1 
/root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1

 

root@ubuntu:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf# ln -s /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1  /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin/cc1
root@ubuntu:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf# make
make: *** No targets specified and no makefile found.  Stop.
root@ubuntu:~/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf# cd -
/root/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# make
mkdir -p build
aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
make: aarch64-none-elf-gcc: Command not found
Makefile:16: recipe for target 'build/kernel_c.o' failed
make: *** [build/kernel_c.o] Error 127
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
aarch64-none-elf-gcc: fatal error: cannot execute 'cc1': execvp: No such file or directory
compilation terminated.
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# ls /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin
aarch64-none-elf-addr2line   aarch64-none-elf-gcc-nm         aarch64-none-elf-lto-dump
aarch64-none-elf-ar          aarch64-none-elf-gcc-ranlib     aarch64-none-elf-nm
aarch64-none-elf-as          aarch64-none-elf-gcov           aarch64-none-elf-objcopy
aarch64-none-elf-c++         aarch64-none-elf-gcov-dump      aarch64-none-elf-objdump
aarch64-none-elf-c++filt     aarch64-none-elf-gcov-tool      aarch64-none-elf-ranlib
aarch64-none-elf-cpp         aarch64-none-elf-gdb            aarch64-none-elf-readelf
aarch64-none-elf-elfedit     aarch64-none-elf-gdb-add-index  aarch64-none-elf-size
aarch64-none-elf-g++         aarch64-none-elf-gfortran       aarch64-none-elf-strings
aarch64-none-elf-gcc         aarch64-none-elf-gprof          aarch64-none-elf-strip
aarch64-none-elf-gcc-10.3.1  aarch64-none-elf-ld             cc1
aarch64-none-elf-gcc-ar      aarch64-none-elf-ld.bfd
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# ls /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/bin -al
total 161476
drwxr-xr-x 2  802  802     4096 Mar 16 23:09 .
drwxr-xr-x 8  802  802     4096 Jul 13  2021 ..
-rwxr-xr-x 1  802  802  1222520 Jul  2  2021 aarch64-none-elf-addr2line
-rwxr-xr-x 2  802  802  1252664 Jul  2  2021 aarch64-none-elf-ar
-rwxr-xr-x 2  802  802  2331488 Jul  2  2021 aarch64-none-elf-as
-rwxr-xr-x 2  802  802  1345616 Jul  2  2021 aarch64-none-elf-c++
-rwxr-xr-x 1  802  802  1217312 Jul  2  2021 aarch64-none-elf-c++filt
-rwxr-xr-x 1  802  802  1353952 Jul  2  2021 aarch64-none-elf-cpp
-rwxr-xr-x 1  802  802    43704 Jul  2  2021 aarch64-none-elf-elfedit
-rwxr-xr-x 2  802  802  1345616 Jul  2  2021 aarch64-none-elf-g++
-rwxr-xr-x 2  802  802  1345576 Jul  2  2021 aarch64-none-elf-gcc
-rwxr-xr-x 2  802  802  1345576 Jul  2  2021 aarch64-none-elf-gcc-10.3.1
-rwxr-xr-x 1  802  802    36808 Jul  2  2021 aarch64-none-elf-gcc-ar
-rwxr-xr-x 1  802  802    36808 Jul  2  2021 aarch64-none-elf-gcc-nm
-rwxr-xr-x 1  802  802    36816 Jul  2  2021 aarch64-none-elf-gcc-ranlib
-rwxr-xr-x 1  802  802   878096 Jul  2  2021 aarch64-none-elf-gcov
-rwxr-xr-x 1  802  802   600296 Jul  2  2021 aarch64-none-elf-gcov-dump
-rwxr-xr-x 1  802  802   622296 Jul  2  2021 aarch64-none-elf-gcov-tool
-rwxr-xr-x 1  802  802 99760976 Jul  2  2021 aarch64-none-elf-gdb
-rwxr-xr-x 1  802  802     4045 Jul  2  2021 aarch64-none-elf-gdb-add-index
-rwxr-xr-x 1  802  802  1345960 Jul  2  2021 aarch64-none-elf-gfortran
-rwxr-xr-x 1  802  802  1291344 Jul  2  2021 aarch64-none-elf-gprof
-rwxr-xr-x 4  802  802  3341640 Jul  2  2021 aarch64-none-elf-ld
-rwxr-xr-x 4  802  802  3341640 Jul  2  2021 aarch64-none-elf-ld.bfd
-rwxr-xr-x 1  802  802 29902472 Jul  2  2021 aarch64-none-elf-lto-dump
-rwxr-xr-x 2  802  802  1233792 Jul  2  2021 aarch64-none-elf-nm
-rwxr-xr-x 2  802  802  1358320 Jul  2  2021 aarch64-none-elf-objcopy
-rwxr-xr-x 2  802  802  2681488 Jul  2  2021 aarch64-none-elf-objdump
-rwxr-xr-x 2  802  802  1252672 Jul  2  2021 aarch64-none-elf-ranlib
-rwxr-xr-x 2  802  802   951736 Jul  2  2021 aarch64-none-elf-readelf
-rwxr-xr-x 1  802  802  1226864 Jul  2  2021 aarch64-none-elf-size
-rwxr-xr-x 1  802  802  1222328 Jul  2  2021 aarch64-none-elf-strings
-rwxr-xr-x 2  802  802  1358320 Jul  2  2021 aarch64-none-elf-strip
lrwxrwxrwx 1 root root       95 Mar 16 23:09 cc1 -> /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# ls /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1
/root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# ls /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1 -al
-rwxr-xr-x 1 802 802 31068504 Jul  2  2021 /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1

 

Solution: add /usr/bin/cc1 as below.

root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# ln -s /root/arm/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf/libexec/gcc/aarch64-none-elf/10.3.1/cc1  /usr/bin/cc1
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# make
mkdir -p build
aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
make: aarch64-none-elf-gcc: Command not found
Makefile:16: recipe for target 'build/kernel_c.o' failed
make: *** [build/kernel_c.o] Error 127
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31# aarch64-none-elf-gcc -Wall -nostdlib -nostartfiles -ffreestanding -Iinclude -mgeneral-regs-only -g -MMD -c src/kernel.c -o build/kernel_c.o
In file included from src/kernel.c:1:
include/printf.h:94:10: fatal error: stdarg.h: No such file or directory
   94 | #include <stdarg.h>
      |          ^~~~~~~~~~
compilation terminated.
root@ubuntu:~/arm/raspberry-pi-os/exercises/lesson05/3/bl4ckout31#

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *