Skip to content

Commit 522de7e

Browse files
committed
Fix DTB not being built for SYSTEM on macOS-arm64
The DTB dependency was inside the 'ifeq CC_IS_EMCC' block, which meant it was only added when building with emcc. However, mk/system.mk uses 'deps_emcc' for device object files regardless of the compiler. The fix moves the DTB dependency setup outside the CC_IS_EMCC block so it is always added when SYSTEM=1 and ELF_LOADER=0, regardless of the compiler being used.
1 parent f024aeb commit 522de7e

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

mk/wasm.mk

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,6 @@ $(OUT)/elf_list.js: artifact tools/gen-elf-list-js.py
6565
# used to download all dependencies of elf executable and bundle into single wasm
6666
deps_emcc += artifact $(OUT)/elf_list.js $(DOOM_DATA) $(QUAKE_DATA) $(TIMIDITY_DATA)
6767

68-
# For SYSTEM mode, emscripten needs the DTB file to embed
69-
# DTB is only built when SYSTEM=1 and ELF_LOADER=0
70-
ifeq ($(call has, SYSTEM), 1)
71-
ifeq ($(call has, ELF_LOADER), 0)
72-
# Add DTB as dependency for compilation stages
73-
deps_emcc += $(BUILD_DTB) $(BUILD_DTB2C)
74-
75-
# For linking stage: ensure DTB exists before emcc embeds it
76-
# Make BIN directly depend on DTB files as regular prerequisites
77-
# This will cause them to be built, but they'll also be passed to the linker
78-
# We need to filter them out in the linker command
79-
$(BIN): $(BUILD_DTB) $(BUILD_DTB2C)
80-
endif
81-
endif
82-
8368
# check browser version if supports TCO
8469
CHROME_MAJOR :=
8570
CHROME_MAJOR_VERSION_CHECK_CMD :=
@@ -181,3 +166,21 @@ start-web: $(start_web_deps)
181166
.PHONY: check-demo-dir-exist start-web
182167

183168
endif
169+
170+
# For SYSTEM mode, DTB needs to be built regardless of whether we're using emcc
171+
# DTB is only built when SYSTEM=1 and ELF_LOADER=0
172+
ifeq ($(call has, SYSTEM), 1)
173+
ifeq ($(call has, ELF_LOADER), 0)
174+
# Add DTB as dependency for compilation stages
175+
# This is used by mk/system.mk for device object files
176+
deps_emcc += $(BUILD_DTB) $(BUILD_DTB2C)
177+
178+
# For emcc builds: ensure DTB exists before emcc embeds it
179+
# Make BIN directly depend on DTB files as regular prerequisites
180+
# This will cause them to be built, but they'll also be passed to the linker
181+
# We need to filter them out in the linker command
182+
ifeq ("$(CC_IS_EMCC)", "1")
183+
$(BIN): $(BUILD_DTB) $(BUILD_DTB2C)
184+
endif
185+
endif
186+
endif

0 commit comments

Comments
 (0)