Skip to content

Commit dd82f51

Browse files
committed
[temp] probe: musl gcc passes in termux-docker and the emulator sandbox
1 parent 476a92c commit dd82f51

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎.github/probe/termux_docker.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ docker run --rm --privileged --entrypoint /system/bin/sh \
3838
say "- pass 2 (/bin -> /system/bin) exit: ${PIPESTATUS[0]}, wall: $(( $(date +%s) - start )) s"
3939

4040
# Pass 3: as pass 2, with the static musl gcc an Android default would use (D21).
41-
mkdir -p "$LOGS/pass3"; chmod 777 "$LOGS/pass3"
41+
mkdir -p "$LOGS/pass3"; chmod 777 "$LOGS/pass3"; echo "--toolchain gcc@15.1.0-musl" > "$LOGS/pass3/build-args"; chmod 666 "$LOGS/pass3/build-args"
4242
start=$(date +%s)
4343
docker run --rm --privileged --entrypoint /system/bin/sh \
4444
-v "$DL:/mnt/dl:ro" -v "$LOGS/pass3:/mnt/logs" -e PROBE_BUILD_ARGS="--toolchain gcc@15.1.0-musl" \
@@ -48,7 +48,7 @@ say "- pass 3 (/bin -> /system/bin, --toolchain gcc@15.1.0-musl) exit: ${PIPESTA
4848

4949
say '### environment'
5050
say '```'
51-
for f in "$LOGS/container.log" "$LOGS/pass2/container.log" "$LOGS/pass3/container.log"; do echo "-- $f" >> "$S"; grep -E "^(ENV|UNAME|ID|HARDLINK|XLINGS|MCPP|STAGE|TIMING|ELF)" "$f" | head -60 >> "$S"; done
51+
for f in "$LOGS/container.log" "$LOGS/pass2/container.log" "$LOGS/pass3/container.log"; do echo "-- $f" >> "$S"; grep -E "^(ENV|UNAME|ID|HARDLINK|XLINGS|MCPP|STAGE|TIMING|ELF|BUILD)" "$f" | head -60 >> "$S"; done
5252
say '```'
5353
for pass in . pass2 pass3; do
5454
say "### first run ($pass): key lines"

‎.github/probe/termux_emulator.sh‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ run)
5353
timeout 3000 adb shell run-as com.termux $A/usr/bin/env $TENVB \
5454
PROBE_OUT=$A/probe/outB PROBE_TARBALL=$A/probe/mcpp.tar.gz PROBE_HOME=$A/homeB \
5555
$A/usr/bin/sh $A/probe/termux_inner.sh 2>&1 | sed 's/^/[B] /' | tee -a "$LOGS/inner.log"
56+
# Session C: as B, with the static musl gcc an Android default would use (D21).
57+
adb shell run-as com.termux sh -c "'mkdir -p $A/probe/outC && echo --toolchain gcc@15.1.0-musl > $A/probe/outC/build-args'"
58+
TENVC="PREFIX=$A/usr HOME=$A/homeC TMPDIR=$A/usr/tmp PATH=$A/usr/bin LANG=en_US.UTF-8"
59+
timeout 3000 adb shell run-as com.termux $A/usr/bin/env $TENVC \
60+
PROBE_OUT=$A/probe/outC PROBE_TARBALL=$A/probe/mcpp.tar.gz PROBE_HOME=$A/homeC \
61+
$A/usr/bin/sh $A/probe/termux_inner.sh 2>&1 | sed 's/^/[C] /' | tee -a "$LOGS/inner.log"
5662
say "- wall: $(( $(date +%s) - start )) s"
5763
for f in first-build.log; do
5864
adb shell run-as com.termux cat "$A/probe/out/$f" > "$LOGS/$f" 2>/dev/null
@@ -61,12 +67,12 @@ run)
6167
say '### sandbox'
6268
say '```'
6369
cat "$LOGS/sandbox.txt" >> "$S"
64-
grep -E '^(\[B\] )?(ENV|UNAME|ID|HARDLINK|MCPP|TIMING|XLINGS|STAGE|ELF)' "$LOGS/inner.log" >> "$S"
70+
grep -E '^(\[[BC]\] )?(ENV|UNAME|ID|HARDLINK|MCPP|TIMING|XLINGS|STAGE|ELF|BUILD)' "$LOGS/inner.log" >> "$S"
6571
say '```'
6672
say '### first run: key lines'
6773
say '```'
6874
grep -E 'First run|Resolving|Resolved|Installing|Downloading|error|warning|hint|Finished|glibc|llvm|musl|Can.t create|did not complete' \
69-
"$LOGS/inner.log" | head -90 >> "$S"
75+
"$LOGS/inner.log" | head -150 >> "$S"
7076
say '```'
7177
say '### plan stage timings'
7278
say '```'

‎.github/probe/termux_inner.sh‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ cd "$HOME/hello"
4141
printf '[package]\nname = "hello"\nversion = "0.1.0"\n\n[targets.hello]\nkind = "bin"\nmain = "src/main.cpp"\n' > mcpp.toml
4242
printf 'import std;\nint main() { std::println("hello from termux"); }\n' > src/main.cpp
4343

44+
[ -f "$OUT/build-args" ] && PROBE_BUILD_ARGS=$(cat "$OUT/build-args")
45+
echo "BUILD ARGS: ${PROBE_BUILD_ARGS:-<none>}"
4446
echo "ELF mcpp: $(od -An -tx1 -j16 -N2 "$MCPP" | tr -d ' \n') (0200=ET_EXEC 0300=ET_DYN)"
4547
t0=$(date +%s)
4648
MCPP_LOG_LEVEL=info timeout 3600 "$MCPP" build --verbose ${PROBE_BUILD_ARGS:-} > "$OUT/first-build.log" 2>&1

0 commit comments

Comments
 (0)