Skip to content

Commit 7711e50

Browse files
committed
Fix build system regressions
This commit consolidates multiple build system fixes: 1. DTB compilation regression - Fixed unconditional DTB build in user-space mode - Fixed WebAssembly build missing DTB dependencies - Fixed DTB not being built on macOS-arm64 for SYSTEM mode 2. Makefile syntax error - Fixed TAB characters before $(warning) in mk/toolchain.mk - This prevented entire Makefile from parsing correctly 3. emcc configuration pollution - Fixed .config persistence causing ENABLE_SYSTEM=1 to leak - Added distclean before emcc builds to ensure clean state 4. Ubuntu ARM64 apt-get failures - Ignore non-critical dep11 (AppStream metadata) failures - Only retry on critical package index failures (Packages/Sources/Release) - Use || true for apt install to prevent exit code 100 from dep11 issues - Verify critical packages (make, git, curl, clang, bc) are installed - Exit with error only if actual package installation fails
1 parent 2cc7b01 commit 7711e50

File tree

4 files changed

+71
-18
lines changed

4 files changed

+71
-18
lines changed

.github/workflows/main.yml

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,15 @@ jobs:
135135
- name: default build using emcc
136136
if: success()
137137
run: |
138+
make distclean
138139
make CC=emcc ENABLE_JIT=0 $PARALLEL
139140
140141
- name: default build for system emulation using emcc
141142
if: success()
142143
run: |
143144
make distclean
144145
make CC=emcc ENABLE_SYSTEM=1 ENABLE_JIT=0 $PARALLEL
145-
make distclean ENABLE_SYSTEM=1
146+
make distclean
146147
147148
- name: Build with various optimization levels
148149
if: success()
@@ -301,17 +302,50 @@ jobs:
301302
githubToken: ${{ github.token }}
302303
# No 'sudo' is available
303304
install: |
304-
apt update -qq
305-
apt install -yqq make git curl wget clang libsdl2-dev libsdl2-mixer-dev lsb-release software-properties-common gnupg bc
306-
which wget || echo "WARNING: wget not found after installation"
305+
# Retry apt update with exponential backoff for mirror sync issues
306+
# Note: dep11 (AppStream metadata) failures are non-critical for build tools
307+
for i in 1 2 3; do
308+
apt update -qq --allow-releaseinfo-change 2>&1 | tee /tmp/apt-update.log
309+
# Check for critical failures (package indices), ignore dep11 metadata
310+
if ! grep -E "Failed to fetch.*/(Packages|Sources|Release)" /tmp/apt-update.log; then
311+
echo "apt update succeeded (core package lists available)"
312+
break
313+
fi
314+
if [ $i -lt 3 ]; then
315+
delay=$((i * 30))
316+
echo "apt update attempt $i: core package list errors, waiting ${delay}s..."
317+
sleep $delay
318+
else
319+
echo "Warning: Proceeding after 3 attempts - dep11 metadata may be incomplete"
320+
fi
321+
done
322+
# Install packages - exit 0 even if dep11 metadata is incomplete
323+
apt install -yqq make git curl wget clang libsdl2-dev libsdl2-mixer-dev lsb-release software-properties-common gnupg bc 2>&1 | tee /tmp/apt-install.log || true
324+
# Verify critical packages were installed
325+
for pkg in make git curl clang bc; do
326+
if ! command -v $pkg >/dev/null 2>&1; then
327+
echo "ERROR: Critical package $pkg failed to install!"
328+
cat /tmp/apt-install.log
329+
exit 1
330+
fi
331+
done
332+
echo "All critical build tools installed successfully"
307333
# FIXME: gcc build fails on Aarch64/Linux hosts
308334
env: |
309335
CC: clang-18
310336
# Append custom commands here
311337
run: |
312338
# Verify and install wget if needed (workaround for install step issues)
313339
if ! command -v wget > /dev/null 2>&1; then
314-
apt update -qq && apt install -yqq wget
340+
echo "wget not found, attempting to install..."
341+
apt update -qq --allow-releaseinfo-change 2>&1 | tee /tmp/apt-update-wget.log || true
342+
apt install -yqq wget 2>&1 | tee /tmp/wget-install.log || true
343+
if ! command -v wget > /dev/null 2>&1; then
344+
echo "ERROR: wget installation failed!"
345+
cat /tmp/wget-install.log
346+
exit 1
347+
fi
348+
echo "wget installed successfully"
315349
fi
316350
git config --global --add safe.directory ${{ github.workspace }}
317351
git config --global --add safe.directory ${{ github.workspace }}/src/softfloat
@@ -435,14 +469,15 @@ jobs:
435469
- name: default build using emcc
436470
if: success()
437471
run: |
472+
make distclean
438473
make CC=emcc ENABLE_JIT=0 $PARALLEL
439474
440475
- name: default build for system emulation using emcc
441476
if: success()
442477
run: |
443478
make distclean
444479
make CC=emcc ENABLE_SYSTEM=1 ENABLE_JIT=0 $PARALLEL
445-
make distclean ENABLE_SYSTEM=1
480+
make distclean
446481
447482
- name: check + tests
448483
if: success()
@@ -499,14 +534,14 @@ jobs:
499534
fi
500535
done
501536
502-
- name: JIT debug test
503-
env:
504-
CC: ${{ steps.install_cc.outputs.cc }}
505-
run: |
506-
# Run JIT tests with debug mode to catch register allocation and cache coherency issues
507-
make distclean && make ENABLE_JIT=1 ENABLE_JIT_DEBUG=1 check $PARALLEL
508-
make distclean && make ENABLE_EXT_C=0 ENABLE_JIT=1 ENABLE_JIT_DEBUG=1 check $PARALLEL
509-
if: ${{ always() }}
537+
- name: JIT debug test
538+
env:
539+
CC: ${{ steps.install_cc.outputs.cc }}
540+
run: |
541+
# Run JIT tests with debug mode to catch register allocation and cache coherency issues
542+
make distclean && make ENABLE_JIT=1 ENABLE_JIT_DEBUG=1 check $PARALLEL
543+
make distclean && make ENABLE_EXT_C=0 ENABLE_JIT=1 ENABLE_JIT_DEBUG=1 check $PARALLEL
544+
if: ${{ always() }}
510545

511546
- name: undefined behavior test
512547
if: (success() || failure()) && steps.install_cc.outputs.cc == 'clang' # gcc on macOS/arm64 does not support sanitizers

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ DTB_DEPS := $(BUILD_DTB) $(BUILD_DTB2C)
392392
endif
393393
endif
394394

395-
all: config $(DTB_DEPS) $(BUILD_DTB) $(BUILD_DTB2C) $(BIN)
395+
all: config $(DTB_DEPS) $(BIN)
396396

397397
OBJS := \
398398
map.o \
@@ -437,7 +437,7 @@ $(OUT):
437437

438438
$(BIN): $(OBJS) $(DEV_OBJS) | $(OUT)
439439
$(VECHO) " LD\t$@\n"
440-
$(Q)$(CC) -o $@ $(CFLAGS_emcc) $^ $(LDFLAGS)
440+
$(Q)$(CC) -o $@ $(CFLAGS_emcc) $(filter-out %.dtb %.h,$^) $(LDFLAGS)
441441

442442
$(CONFIG_FILE): FORCE
443443
$(Q)mkdir -p $(OUT)

mk/toolchain.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ ifneq ($(shell $(CC) --version | head -n 1 | grep emcc),)
2222
$(warning $(SDL_MUSIC_CANNOT_PLAY_WARNING))
2323
endif
2424
else
25-
$(warning $(SDL_MUSIC_CANNOT_PLAY_WARNING))
25+
$(warning $(SDL_MUSIC_CANNOT_PLAY_WARNING))
2626
endif
2727
else
28-
$(warning $(SDL_MUSIC_CANNOT_PLAY_WARNING))
28+
$(warning $(SDL_MUSIC_CANNOT_PLAY_WARNING))
2929
endif
3030

3131
# see commit 165c1a3 of emscripten

mk/wasm.mk

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,21 @@ start-web: $(start_web_deps)
166166
.PHONY: check-demo-dir-exist start-web
167167

168168
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)