Problem
moon test --target native hangs indefinitely when testing packages that depend on moonbitlang/async (http, tls, socket).
Root Cause
The generated C file for the test binary is ~7MB (due to async + TLS + socket being linked together). The built-in TCC compiler (~/.moon/bin/internal/tcc) hangs when compiling this file — it shows 0% CPU usage and never completes.
Reproduction
# Any package that imports moonbitlang/async/http
moon test --target native -p client
# Hangs at TCC compilation step
The TCC process can be observed:
ps aux | grep tcc
# Shows: tcc @...client.whitebox_test.rspfile — 0% CPU, runs indefinitely
Verification
The same C file compiles in 0.97 seconds with clang:
time clang -O0 -g -I~/.moon/include -L~/.moon/lib \
-DMOONBIT_NATIVE_NO_SYS_HEADER -DMOONBIT_USE_SHARED_RUNTIME -fPIC \
...dylibs... \
_build/native/debug/test/client/client.whitebox_test.c \
-o /tmp/test
# 0.74s user, 0.97s total
Environment
- moon 0.1.20260330 (c527f57 2026-03-30)
- macOS Darwin 25.2.0 (arm64)
- Generated C file: 7.0MB
Workaround
None for local moon test --target native. The moon check command works fine for type checking. Only the test execution (which requires TCC compilation) is affected.
Suggestion
Consider supporting an external C compiler via environment variable (e.g., MOONC_CC=clang) for native target compilation, especially for large generated C files.
Problem
moon test --target nativehangs indefinitely when testing packages that depend onmoonbitlang/async(http, tls, socket).Root Cause
The generated C file for the test binary is ~7MB (due to async + TLS + socket being linked together). The built-in TCC compiler (
~/.moon/bin/internal/tcc) hangs when compiling this file — it shows 0% CPU usage and never completes.Reproduction
The TCC process can be observed:
Verification
The same C file compiles in 0.97 seconds with clang:
Environment
Workaround
None for local
moon test --target native. Themoon checkcommand works fine for type checking. Only the test execution (which requires TCC compilation) is affected.Suggestion
Consider supporting an external C compiler via environment variable (e.g.,
MOONC_CC=clang) for native target compilation, especially for large generated C files.