From 08a3ac3ccb6d260874a53c936cdb751e5c5f142a Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Sat, 14 Sep 2024 22:13:13 +0800 Subject: [PATCH 1/2] Fix missing gdbstub dependency in Makefile When compiling with ENABLE_GDBSTUB=1 using the command: make ENABLE_GDBSTUB=1 -j$(nproc) The following compilation error occurs: In file included from src/syscall.c:14: src/riscv_private.h:11:10: fatal error: mini-gdbstub/include/gdbstub.h: No such file or directory 11 | #include "mini-gdbstub/include/gdbstub.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:213: build/syscall.o] Error 1 make: *** Waiting for unfinished jobs.... In file included from src/softfloat.h:11, from src/emulate.c:19: src/riscv_private.h:11:10: fatal error: mini-gdbstub/include/gdbstub.h: No such file or directory 11 | #include "mini-gdbstub/include/gdbstub.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make: *** [Makefile:212: build/emulate.o] Error 1 In file included from src/riscv.c:28: src/riscv_private.h:11:10: fatal error: mini-gdbstub/include/gdbstub.h: No such file or directory 11 | #include "mini-gdbstub/include/gdbstub.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. The error is due to the improper handling of the gdbstub library dependency in the Makefile. This patch ensures that the gdbstub library is correctly compiled before source files that depend on it. --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4aa1411b..1ce6c5bc 100644 --- a/Makefile +++ b/Makefile @@ -124,8 +124,6 @@ src/mini-gdbstub/Makefile: GDBSTUB_LIB := $(GDBSTUB_OUT)/libgdbstub.a $(GDBSTUB_LIB): src/mini-gdbstub/Makefile $(MAKE) -C $(dir $<) O=$(dir $@) -# FIXME: track gdbstub dependency properly -$(OUT)/decode.o: $(GDBSTUB_LIB) OBJS_EXT += gdbstub.o breakpoint.o CFLAGS += -D'GDBSTUB_COMM="$(GDBSTUB_COMM)"' LDFLAGS += $(GDBSTUB_LIB) -pthread @@ -219,6 +217,10 @@ ifeq ($(call has, EXT_F), 1) $(OBJS): $(SOFTFLOAT_LIB) endif +ifeq ($(call has, GDBSTUB), 1) +$(OBJS): $(GDBSTUB_LIB) +endif + $(OUT)/%.o: src/%.c $(deps_emcc) $(VECHO) " CC\t$@\n" $(Q)$(CC) -o $@ $(CFLAGS) $(CFLAGS_emcc) -c -MMD -MF $@.d $< From b4a2d7754a8b74776390594605a7b8c118f8ae11 Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Sat, 14 Sep 2024 22:32:49 +0800 Subject: [PATCH 2/2] CI: Enable parallel compilation in default build and gdbstub tests Parallel compilation with -j$(nproc) is introduced to the default build and gdbstub tests. By utilizing all available CPU cores, this change improves the speed of the build and testing process, reducing CI execution time. --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b628c262..c7b3ef7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -49,7 +49,7 @@ jobs: sudo ./llvm.sh 17 shell: bash - name: default build - run: make + run: make -j$(nproc) - name: check + tests run: | make check -j$(nproc) @@ -65,7 +65,7 @@ jobs: make distclean && make ENABLE_SDL=0 check -j$(nproc) - name: gdbstub test run: | - make distclean ENABLE_GDBSTUB=1 gdbstub-test + make distclean && make ENABLE_GDBSTUB=1 gdbstub-test -j$(nproc) - name: JIT test run: | make ENABLE_JIT=1 clean && make ENABLE_JIT=1 check -j$(nproc)