Skip to content

Commit 08a3ac3

Browse files
committed
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.
1 parent 8939a82 commit 08a3ac3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ src/mini-gdbstub/Makefile:
124124
GDBSTUB_LIB := $(GDBSTUB_OUT)/libgdbstub.a
125125
$(GDBSTUB_LIB): src/mini-gdbstub/Makefile
126126
$(MAKE) -C $(dir $<) O=$(dir $@)
127-
# FIXME: track gdbstub dependency properly
128-
$(OUT)/decode.o: $(GDBSTUB_LIB)
129127
OBJS_EXT += gdbstub.o breakpoint.o
130128
CFLAGS += -D'GDBSTUB_COMM="$(GDBSTUB_COMM)"'
131129
LDFLAGS += $(GDBSTUB_LIB) -pthread
@@ -219,6 +217,10 @@ ifeq ($(call has, EXT_F), 1)
219217
$(OBJS): $(SOFTFLOAT_LIB)
220218
endif
221219

220+
ifeq ($(call has, GDBSTUB), 1)
221+
$(OBJS): $(GDBSTUB_LIB)
222+
endif
223+
222224
$(OUT)/%.o: src/%.c $(deps_emcc)
223225
$(VECHO) " CC\t$@\n"
224226
$(Q)$(CC) -o $@ $(CFLAGS) $(CFLAGS_emcc) -c -MMD -MF $@.d $<

0 commit comments

Comments
 (0)