Page 1 of 1

RPi: aarch64-none-elf-gcc: fatal error: cannot execute 'cc1'

Posted: Wed Jun 09, 2021 6:33 pm
by Sammyueru
Hello I have been trying to compile my raspberry pi 4 OS for a long time but I think I'm close to getting it work.
Anyways I keep getting this error when ever trying to build:

Code: Select all

aarch64-none-elf-gcc: fatal error: cannot execute 'cc1': execvp: Permission denied
[/color]

I've tried to add:

Code: Select all

-print-prog-name=cc1
But it still doesn't work.

Here's the makefile:

Code: Select all

PROJECT_DIR= ../
CSRCFLAGS= -O2 -Wall -Wextra
LFLAGS= -ffreestanding -O2 -nostdlib
IMG_PATH= ../
BUILD_BACK_TWO= ../../../build
CFILES= $(wildcard *.c)
OFILES= $(CFILES:.c=.o)
GCCPATH= gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf
CFLAGSSTART= -ffreestanding -c
CFLAGSEND= -O2 -Wall -Wextra
GCCFLAGS= -Wall -O2 -ffreestanding -nostdinc -nostdlib -nostartfiles
GCCPATHAARCH= $(GCCPATH)/aarch64-none-elf/bin
GCCPATHBIN= $(GCCPATH)/bin
ASMCFLAGS= -f elf32 -F dwarf -g -w+all
ASM= -s

# Location of the files
THIS_DIR := $(dir $(abspath $(firstword $(MAKEFILE_LIST))))
KER_SRC = $(PROJECT_DIR)/src/kernel
KER_MENU_SRC = $(PROJECT_DIR)/src/kernel/menu
KER_HEAD = $(PROJECT_DIR)/include
COMMON_SRC = $(PROJECT_DIR)/src/common
UI_IMAGES = $(PROJECT_DIR)/images/ui
SPE_GAMES = ../spe_games
DINOBYTE = $(SPE_GAMES)/dinobyte
OBJ_DIR = $(PROJECT_DIR)/build/objects
ASMSOURCES = $(wildcard $(KER_SRC)/*.s)
KERSOURCES = $(wildcard $(KER_SRC)/*.c)
#KERSOURCES = $(wildcard $(KER_SRC)/$(ARCHDIR)/*.c)
COMMONSOURCES = $(wildcard $(COMMON_SRC)/*.c)
KERSOURCESCPP = $(wildcard $(KER_SRC)/*.cpp)
DINOBYTESOURCES = $(wildcard $(DINOBYTE)/src/*.cpp)
#KERSOURCESCPP = $(wildcard $(KER_SRC)/$(ARCHDIR)/*.cpp)
#KERMENUSOURCESC = $(wildcard $(KER_MENU_SRC)/*.c)
#KERMENUSOURCESCPP = $(wildcard $(KER_MENU_SRC)/*.cpp)
UISOURCES = $(wildcard $(UI_IMAGES)/*.png)
OBJECTS = $(patsubst $(KER_SRC)/%.s, $(OBJ_DIR)/%.o, $(ASMSOURCES))
#OBJECTS += $(patsubst $(KER_SRC)/%.s, $(OBJ_DIR)/%.o, $(ASMSOURCES))
OBJECTS += $(patsubst $(KER_SRC)/%.c, $(OBJ_DIR)/%.o, $(KERSOURCES))
OBJECTS += $(patsubst $(KER_SRC)/%.cpp, $(OBJ_DIR)/%.o, $(KERSOURCESCPP))
OBJECTS += $(patsubst $(COMMON_SRC)/%.c, $(OBJ_DIR)/%.o, $(COMMONSOURCES))
#OBJECTS += $(patsubst $(KER_MENU_SRC)/%.c, $(OBJ_DIR)/%.o, $(KERMENUSOURCESC))
#OBJECTS += $(patsubst $(KER_MENU_SRC)/%.cpp, $(OBJ_DIR)/%.o, $(KERMENUSOURCESCPP))
#OBJECTS += $(patsubst $(UI_IMAGES)/%.png, $(OBJ_DIR)/%.o, $(UISOURCES))

#Dinobyte objects [include Dinobyte headers here] (do later)
#OBJECTS += $(patsubst $(DINOBYTESOURCES)/src/%.cpp, $(OBJ_DIR)/%.o, $(DINOBYTESOURCES))

#Headers
HEADERS = $(wildcard $(KER_HEAD)/*.h)


IMG_NAME=SuperPiOS

#build: $(OBJECTS) $(HEADERS)
#$(CC) -T linker.ld -o $(IMG_NAME).elf $(LFLAGS) $(OBJECTS) #needs indent
#$(OBJCOPY) $(IMG_NAME).elf -O binary $(IMG_NAME).img #needs indent

#$(OBJ_DIR)/%.o: $(KER_SRC)/%.s
#mkdir -p $(@D) #needs indent
#$(CC) $(CFLAGS) -I$(KER_SRC) -c $< -o $@ #needs indent


#$(OBJ_DIR)/%.o: $(KER_MENU_SRC)/%.c
#	mkdir -p $(@D)
#	$(CC) $(CFLAGS) -I$(KER_SRC) -I$(KER_HEAD) -c $< -o $@ $(CSRCFLAGS)

#$(OBJ_DIR)/%.o: $(KER_MENU_SRC)/%.cpp
#	mkdir -p $(@D)
#	$(CC) $(CXXFLAGS) -I$(KER_SRC) -I$(KER_HEAD) -c $< -o $@ $(CSRCFLAGS)

$(OBJ_DIR)/%.o: $(KER_SRC)/%.s
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-as -c $^ -o $@
$(OBJ_DIR)/%.o: $(KER_SRC)/%.c
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-gcc -ffreestanding -c $^ -o $@ -O2 -Wall -Wextra
$(OBJ_DIR)/%.o: $(KER_SRC)/$(ARCHDIR)/%.c
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-gcc -ffreestanding -c $^ -o $@ -O2 -Wall -Wextra
$(OBJ_DIR)/%.o: $(KER_SRC)/%.cpp
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-gcc -ffreestanding -c $^ -o $@ -O2 -Wall -Wextra
$(OBJ_DIR)/%.o: $(KER_SRC)/$(ARCHDIR)/%.cpp
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-gcc -ffreestanding -c $^ -o $@ -O2 -Wall -Wextra
$(OBJ_DIR)/%.o: $(COMMON_SRC)/%.c
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-gcc -ffreestanding -c $^ -o $@ -O2 -Wall -Wextra -cc1

BUILD: $(OBJECTS) $(HEADERS)
	mkdir -p $(@D)
	@echo !==== COMPILING $^
	$(GCCPATHBIN)/aarch64-none-elf-ld -nostdlib -nostartfiles $(OBJECTS) -T linker.ld -o $(IMG_NAME).elf
	$(GCCPATHBIN)/aarch64-none-elf-objcopy -O binary $(IMG_NAME).elf  $(IMG_NAME).img


clean:
	rm -rf $(OBJ_DIR)
	rm $(IMG_NAME).elf
	rm $(IMG_NAME).img

#run: build
#	qemu-system-arm -m 128 -no-reboot -M raspi4 -serial stdio -kernel kernel.elf

#dbg:
#$(GDB) kernel.elf

#dbgrun: build gdbinit
#qemu-system-arm -m 128 -no-reboot -M raspi4 -serial stdio -kernel kernel.elf -S -s

start:
	@echo Starting
	mkdir $(OBJ_DIR)
	@echo .
	@echo .
	@echo .

.PHONY: start BUILD clean
If you can help please do.
Thanks in advance.

Re: RPi: aarch64-none-elf-gcc: fatal error: cannot execute '

Posted: Wed Jun 09, 2021 8:41 pm
by Octocontrabass
Sammyueru wrote:Anyways I keep getting this error when ever trying to build:
You probably need to use chmod to fix the permissions on cc1.
Sammyueru wrote:I've tried to add:
That flag will tell you where cc1 is. That flag does not fix anything by itself. Once you know where cc1 is, you can use chmod to fix the permissions.
Sammyueru wrote:But it still doesn't work.
Please don't add color to your text. It's difficult to read.