Before the first compile of NEMU, $(CONFIG_CC) is not set by KConfig. So calling CC = $(call remove_quote,$(CONFIG_CC)) clears $(CC) by mistake, which leads to the probable failure of make menuconfig when compiling fixdeps.c . And that failure seems distribution dependent (specifically, default GNU Make configuration in each distribution). e.g. Arch Linux seems giving a default value cc to $(CC) for each make instance but Nix does not, which causes error in the latter.
#84 and #89 resolve this problem by adding a check of $(CONFIG_CC), setting $(CC) only if config variable is not empty. However, it doesn't really solve the missing compiler problem but leaving it behind to uncertain fallback value. IMO, as a build prerequisite, the compiling process and tools should be well-defined to ensure menuconfig would work.
So my suggestion is, $(CC) should be explicitly set in tools/fixdep/Makefile :
--- a/nemu/tools/fixdep/Makefile
+++ b/nemu/tools/fixdep/Makefile
@@ -1,3 +1,4 @@
NAME = fixdep
SRCS = fixdep.c
+CC = gcc
include $(NEMU_HOME)/scripts/build.mk
Before the first compile of NEMU, $(CONFIG_CC) is not set by KConfig. So calling
CC = $(call remove_quote,$(CONFIG_CC))clears$(CC)by mistake, which leads to the probable failure ofmake menuconfigwhen compilingfixdeps.c. And that failure seems distribution dependent (specifically, default GNU Make configuration in each distribution). e.g. Arch Linux seems giving a default valueccto$(CC)for eachmakeinstance but Nix does not, which causes error in the latter.#84 and #89 resolve this problem by adding a check of
$(CONFIG_CC), setting$(CC)only if config variable is not empty. However, it doesn't really solve the missing compiler problem but leaving it behind to uncertain fallback value. IMO, as a build prerequisite, the compiling process and tools should be well-defined to ensuremenuconfigwould work.So my suggestion is,
$(CC)should be explicitly set intools/fixdep/Makefile: