| name | build-system-diagnostics |
| description | Use when a benchmark task involves compile.sh, executable generation, build failures, missing artifacts, toolchain issues, package managers, or making the final submission reproducible from a clean build. |
| tags | build, compile, diagnostics, programbench, executable |
Build System Diagnostics
Use this skill when the task depends on building, installing, or producing ./executable.
The goal is a reproducible build path, not just a working file in the current shell.
First Checks
Run small inspections:
pwd
ls -la
test -f compile.sh && sed -n '1,160p' compile.sh
find . -maxdepth 2 -type f \( -name 'Makefile' -o -name 'CMakeLists.txt' -o -name 'Cargo.toml' -o -name 'go.mod' -o -name 'package.json' -o -name 'pyproject.toml' -o -name 'setup.py' -o -name 'pom.xml' -o -name 'build.gradle' \) -print
Identify:
expected final artifact
language/toolchain
current compile.sh behavior
whether ./executable exists after build
whether executable bit is set
Build Smoke Test
Use a non-destructive smoke check first. Do not delete an existing ./executable until you know it is your generated candidate rather than the original oracle.
test -e ./executable && ls -l ./executable
if test -f compile.sh; then
sh ./compile.sh > /tmp/build.out 2> /tmp/build.err
code=$?
else
echo "compile.sh missing" > /tmp/build.err
: > /tmp/build.out
code=127
fi
echo "build_exit=$code"
tail -80 /tmp/build.out
tail -120 /tmp/build.err
ls -l ./executable 2>/dev/null || true
If the build fails, fix the first real error. Later errors are often cascades.
Only for a known generated candidate may you remove ./executable for a clean rebuild. Use a neutral backup name; reserve /tmp/original-executable only for the true original oracle:
cp ./executable /tmp/prebuild-executable-backup 2>/dev/null || true
test -x /tmp/original-executable && rm -f ./executable
test -f compile.sh && sh ./compile.sh
Common Fixes
Use the lowest-risk fix:
wrong output path -> copy/link generated binary to ./executable
missing executable bit -> chmod +x ./executable in compile.sh
Python script target -> write shebang wrapper or copy script to executable
Node package -> use existing node_modules or lockfile/offline cache only; avoid network install
Go project -> go build -o executable ./... only if module is valid
Rust project -> cargo build --release then copy target/release/name
C/C++ -> use existing Makefile/CMake when present; otherwise simple compiler command
Java -> produce a wrapper that invokes jar/class when build is reliable
Do not add network-dependent package installation.
compile.sh Contract
compile.sh should be simple and deterministic:
- starts from repository root
- exits nonzero on real build failure
- creates ./executable
- sets executable bit
- does not require original benchmark executable
- does not rely on absolute local paths
Useful pattern:
#!/bin/sh
set -eu
chmod +x ./executable
Runtime Check
After build:
test -x ./executable && echo executable-ok
timeout 5 ./executable >/tmp/run.out 2>/tmp/run.err; code=$?
echo "run_exit=$code"
tail -40 /tmp/run.out
tail -40 /tmp/run.err
If no-args is expected to fail, a nonzero exit is fine. The check is that the executable starts and behaves intentionally. If the task is not executable-oriented, replace this with the smallest relevant import/test command.
Report
Summarize:
build system:
compile.sh status:
artifact path:
fix applied:
build command:
runtime smoke:
remaining risk: