Skip to content

Troubleshooting

Hugo edited this page Feb 26, 2026 · 1 revision

Troubleshooting

Build and toolchain issues

Error: unable to find clang executable in PATH

Checks:

which clang
which clang-20
echo "$CT_CLANG"

Fix options:

  • install matching LLVM/Clang version
  • set CT_CLANG to an existing clang binary
  • configure CMake with explicit LLVM_DIR and Clang_DIR

CMake error: Clang version mismatch

CMake verifies clang major version against LLVM major version. Use matching toolchain packages and avoid mixing system clang with LLVM package dirs.

C++ link behavior is wrong for object-only links

resolveDriverConfig() may inspect .o/.a symbols to infer C++ mode. If object inspection fails, you can force intent with explicit flags:

./build/cc --driver-mode=g++ foo.o bar.o
# or add explicit C++ stdlib flags
./build/cc foo.o bar.o -lstdc++

Compilation mode issues

Error: in-memory output only supports a single compilation job

--in-mem expects one compile job and no linker phase. Use one input unit at a time.

Error: no cc1 job found

This can happen when args do not produce compile jobs (for example, malformed link-only invocation). Re-check input files and compile/link flags.

Error: instrumentation only supports object or LLVM IR/bitcode output

When instrumentation runs in-process, supported frontend actions are object, LLVM IR, and bitcode emission. Avoid unsupported frontend-only modes for this path.

Runtime behavior issues

No trace output

Check runtime disable flags:

env | rg '^CT_DISABLE_|^CT_EARLY_TRACE|^CT_SHADOW'

CT_DISABLE_TRACE disables trace logs.

Expected auto-free but nothing is freed

Confirm both layers:

  • compile-time: built with --ct-autofree
  • runtime: optional scanner vars (CT_AUTOFREE_SCAN*) set as needed

Also note conservative scans can keep allocations alive when stale pointers remain in roots.

Diagnostic commands

./build/cc --help
./build/cc -v main.c -o app
./build/cc --instrument -v main.c -o app_inst

The -v flag is forwarded to clang and helps inspect include/lib resolution.

Clone this wiki locally