GETTING STARTED

PyCForge owns compiler integration and qualification of Crucible-generated C. The separate SDK authors conversion extensions through standardized format files; it does not invoke or probe PCFC11 or any other C compiler.

Build PCFC11 from source

Build the bundled PCFC11 0.2.57 compiler once with your local Python and GCC tools. PyCForge keeps it in a fixed location and checks the recorded build before use.

At O1, PCFC11 uses wider moves for ordinary struct and union assignment. It copies exactly the declared object size, including for packed values and odd-sized tails.

Compiler specifications and role

PCFC11 has its own C preprocessor, parser, conservative optimizer and x64 assembly generator. Its targets are Linux x86-64 with the LP64 data model and Windows x64 with LLP64; external GCC-compatible tools assemble and link the output. O0 is the baseline and O1 enables bounded integer optimizations. Shared control-flow, definition and liveness analyses preserve conservative fallback. Floating-point arithmetic uses no implicit fast-math or contraction.

Crucible supplies C from supported Python and conversion-import contracts; PCFC11 compiles that C, while the separate SDK supports import authoring and conversion checks. The full-width PCFC11 section at the bottom of About PyCForge summarizes this relationship, current features, engineering strategy and future objectives. Complete ISO C11 conformance is not established.

Requirements

HostLocal build tools
Windows x64Native 64-bit Python 3.11 or later and complete MinGW-w64 UCRT64 GCC, including its headers, libraries, assembler, linker and DLLs. MSYS2's UCRT64 environment supplies these tools. Select its ucrt64\bin\gcc.exe.
Linux x86-64Native 64-bit Python 3.11 or later, GCC, binutils and the system C headers/libraries. Bash is needed for the standalone shell test launcher.

The PyCForge application supports Python 3.11–3.13. The standalone compiler build and tests need no third-party Python packages. PCFC11 emits x86-64 code for these two hosts; macOS, ARM64 and 32-bit hosts are outside this bundled compiler's supported route. Other C Compilers remains available for its supported targets.

PCFC11 parses and compiles C itself; GCC supplies assembly, linking and system runtime support. Keep the complete GCC installation. A lone gcc.exe copied without its supporting files is insufficient. PyCForge supplies no installers, downloads no tools, and never builds PCFC11 at startup. Missing PCFC11 does not prevent editing or transpilation.

O1 can reuse the existing four callee-saved integer registers for eligible values whose lifetimes do not overlap. Complete liveness and parameter-entry checks protect values; excess or unsupported cases retain stack or dedicated-register placement. Calls and address-taking updates remain conservative. O0 and the calling convention are unchanged; performance depends on the program.

Array-parameter bracket qualifiers apply to the adjusted pointer. Both C11 qualifier/static orderings are accepted; static specifies a caller minimum-size contract without automatic runtime length checks. Linux prototype [*] is supported and rejected outside prototype scope. Array elements require complete object types, and VLA alignment follows the element. Windows retains its explicit VLA restriction.

In C parameter lists, earlier parameter names are visible to later bounds. Linux function definitions evaluate variable-length array parameter bounds on entry; Windows retains its explicit VLA restriction. Enumeration types use signed-int compatibility, and conflicting enum or parameter declarations report the earlier declaration location. These rules do not imply complete C11 conformance.

Guided setup

  1. Click the copper Compile button when PCFC11 is missing or changed. Setup is available before transpilation. Transpile → Build PCFC11… opens setup at any time.
  2. In Python executable, select a native 64-bit Python 3.11+ executable. In GCC executable, select the complete native toolchain's driver. Windows commonly uses C:\msys64\ucrt64\bin\gcc.exe; Linux commonly uses /usr/bin/gcc. Browse selects a file without executing it.
  3. Review the read-only Managed compiler path. PyCForge chooses this location; no destination chooser is provided. Adjust Build timeout if necessary; it defaults to 300 seconds and accepts 30–1200 seconds for the compiler build step. Prerequisite, identity and smoke checks have separate short limits. Each of the three Windows validation phases has its own 180-second limit.
  4. Choose Build PCFC11. The dialog checks tools, extracts the verified bundled source, builds PCFC11, checks its identity, and compiles and runs small verification programs at O0 and O1. On Windows, it then runs the bundled native acceptance checks described below. The log remains visible while the workspace stays responsive. Cancel Build stops the operation and its child processes.
  5. When ready, use Continue to Compile if current generated C is available, or close setup and transpile first. Successful tool paths are remembered. Recheck verifies an existing build; Rebuild PCFC11 explicitly rebuilds it. Copy Report copies status, paths and the current log, or the saved latest build report after reopening setup.

A failed or canceled rebuild preserves the previous compiler. Recheck can confirm a retained build with current verification evidence. Closing setup or the workspace during a build requests cancellation and waits for the worker to finish. Builds and program compilation share a lock across PyCForge windows; a busy compiler reports that another operation must finish first.

After an unsuccessful build

A failed replacement is never accepted. If the compiler already in use still verifies, Continue to Compile remains available and the failure stays visible. Clicking Compile again checks that retained compiler without starting another build.

If a different retained build is compatible with this PyCForge release and its exact files and verification records still match, setup offers Use verified PCFC11 with its version. Select it, then continue to compile. The choice is remembered and rechecked before use. The compilation dialog shows the actual selected compiler and version. A later successful bundled build supersedes that choice.

Preserved files alone are insufficient. An unsupported older version, changed toolchain, damaged executable or incomplete Windows verification cannot be selected. When no verified compiler qualifies, use Copy Report, choose Other C Compilers… for current generated C, or correct the problem before choosing Retry PCFC11 Build. Closing and reopening Compile does not retry the build or tests automatically. Editing and transpilation remain available.

Setup retains last-build-attempt.json in the managed slot so the latest build failure remains available after reopening PyCForge. A previous-compiler choice never turns a failed replacement or a program's unexecuted checks into a successful result.

Automatic Windows checks

Native Windows builds run five focused phases before the new compiler becomes ready: guarded stack growth; register preservation and native unwinding; ordinary integer updates; general Windows calling conventions, layouts, runtime headers and file/linker handling; and parser limits with controlled diagnostics and preserved output. O0/O1 programs are compared with independent GCC references and integer expectations. These checks use the Python and UCRT64 GCC already selected in setup. Everything else is bundled with PyCForge; no separate test package, Bash session or manual test command is required. These are general C compiler tests. They do not run Crucible conversions or SDK qualification. Each phase has a three-minute limit, and Cancel Build remains available. Upgrading from the earlier three-phase checks requires one explicit rebuild to establish the expanded results.

A failure, timeout, cancellation or incomplete result prevents acceptance of the new build. Use the visible phase log and Copy Report to inspect the outcome. The managed slot retains last-windows-validation.json and last-windows-validation.log for the latest attempt. A successful build also keeps current/windows-validation.json, bound to its exact executable, bundled inputs and selected tools. Recheck and startup verify that evidence without rerunning the suite. An older Windows build without it needs one explicit rebuild; setup reports this requirement. Linux builds retain their existing verification workflow.

This finite local acceptance suite checks the selected compiler and machine. It does not certify all C11 programs or replace broader compiler qualification.

Fixed location and startup verification

The managed slot is independent of the pip installation folder, virtual environment and working directory. This avoids requiring write access to site-packages and keeps the compiler available across PyCForge upgrades that bundle the same source. Its path includes the compiler release, source fingerprint and native target:

HostManaged executable
Windows%LOCALAPPDATA%\PyCForge\compilers\pcfc11\0.2.57-35da4f3b1256\x86_64-w64-mingw32\current\PCFC11-0.2.57\pcfc11.exe
Linux$XDG_DATA_HOME/PyCForge/compilers/pcfc11/0.2.57-35da4f3b1256/x86_64-linux-gnu/current/PCFC11-0.2.57/pcfc11, using ~/.local/share when XDG_DATA_HOME is unset or relative.

The setup dialog shows the exact path for your account. Keep the compiler source, adjacent headers and build record together. The current folder contains build.json and build.log; a successful rebuild retains the replaced folder as previous. Publication is protected by a lock and rollback. If interruption leaves only a recorded previous build, the next check can restore it.

Normal startup compares SHA-256 content fingerprints for the executable, bundled source/build inputs, headers and saved GCC driver. It then runs a bounded compiler identity probe for name, release, target and process interface. Compile repeats verification before use. A small copper loading panel appears while this check runs; Cancel dismisses the request without opening a compile or setup dialog. The original code-bracket PyCForge icon identifies these compiler dialogs. A changed executable is refused before its identity command is run. A saved timestamp alone is never enough. Missing files or failed checks lead to setup, not an automatic rebuild. Recovery startup defers this optional compiler probe.

These checks establish continuity with the locally recorded build. They are not a publisher digital signature, a full toolchain attestation or proof of compiler correctness. Replacing both files and their local record is outside that guarantee. GCC helper programs, libraries and DLLs must remain compatible; their availability is checked by actual build/use, not by recursively hashing the entire toolchain. Moving or updating the saved GCC driver requires rebuilding PCFC11.

When a later PyCForge release bundles different compiler source, it gets a separate slot. Existing slots and separately extracted source folders are not removed by a pip uninstall. Use the displayed location when reviewing disk usage; close PyCForge before manually removing an obsolete slot.

Compile your program

  1. Transpile the current Python source bundle in Typed or Runtime mode.
  2. Choose Compile beside Transpile, or Transpile → Compile with PCFC11… (Ctrl+Shift+Return).
  3. The verified PCFC11 executable, saved GCC assembler/linker and native target are already filled in and read-only. Choose object or executable output, your program's output filename, and O0 or O1. Program output cannot overwrite the managed compiler folder.
  4. An executable needs a no-argument entry function: Typed returns int; Runtime returns int or None. A function named start is a useful entry. Use object output for functions called by another C program.
  5. Choose Compile in the dialog and review the log and diagnostics. Copy Report preserves compiler identity, commands and result. Build PCFC11 from source… opens compiler setup.

Build children receive the selected backend directory in PATH without modifying the application or system environment. Editing a participating source cancels an outdated program build; failure or cancellation preserves previous output. Program compilation never runs your program. Setup runs only its bundled verification programs. PCFC11 remains separate from Transpile → Other C Compilers…, which retains GCC, Clang, MSVC and Clang-cl.

O1 follows short-circuit paths in compound conditions when analyzing integer values and unused stores. Evaluation order and conversions are preserved. Unsupported analysis cases use the established compilation path; O0 remains available without these optimizations.

Generated Runtime C includes its value routines and does not need Python to execute on a compatible host. Compiler setup does not alter the Runtime memory and collection contract; active collection remains opt-in.

An independent source copy

For compiler experiments and the original standalone test workflow, extract a separate working copy using the Python environment containing PyCForge, or run from the PyCForge source root:

python -m pycforge.pcfc11 --extract ./compilers

Windows can use py -m pycforge.pcfc11 --extract .\compilers. Extraction verifies the bundled archive's SHA-256, creates compilers/PCFC11-0.2.57 with complete source, headers, licenses and tests, and never executes them. It refuses to merge with an existing folder; choose another parent to make another copy.

The original archive is also present at pycforge/pcfc11/PCFC11-0.2.57-source.zip in the source distribution. Its provenance record identifies the exact release. Historical plans retained in the compiler archive do not replace this manual. The managed IDE route always builds its own pinned copy; use the command-line build service below for a separately built compiler.

Manual Windows build

Install MSYS2 and UCRT64 GCC separately using MSYS2's instructions. The UCRT64 package is mingw-w64-ucrt-x86_64-gcc. From PowerShell, adjust your MSYS2 path as needed:

cd .\compilers\PCFC11-0.2.57
$env:Path = "C:\msys64\ucrt64\bin;$env:Path"
py tools\build.py --cc "C:\msys64\ucrt64\bin\gcc.exe"
.\pcfc11.exe --version
.\pcfc11.exe -std=c11 -O1 examples\hello.c -o hello.exe
.\hello.exe

The PATH assignment applies to this PowerShell session and its children. It makes matching DLLs and helpers available for manual commands. The last command explicitly runs the smoke program. Keep pcfc11.exe beside its entire matching include directory. WSL builds the Linux compiler, not the native Windows compiler.

Manual Linux build

cd compilers/PCFC11-0.2.57
python tools/build.py --cc /usr/bin/gcc
./pcfc11 --version
./pcfc11 -std=c11 -O1 examples/hello.c -o hello
./hello

Substitute python3 and your GCC path if needed. Keep pcfc11 beside its matching include directory. These source builds need no administrator privileges once prerequisite tools are available.

For app.py containing def start() -> int: return 0, an explicit external-compiler invocation on Windows is:

py -m pycforge.build app.py --entry main.start --compiler-family pcfc11 --compiler "C:\path\PCFC11-0.2.57\pcfc11.exe" --toolchain "C:\msys64\ucrt64\bin\gcc.exe" --output program.exe

On Linux use python, native paths and output such as program. Add --runtime-values for Runtime conversion or --kind object for object output. This explicit command-line route is separate from the IDE's fixed managed slot.

Standalone compiler tests

The guided Windows build already runs its focused acceptance checks automatically. The broader standalone workflow below is available for maintainer checks in an independently extracted copy:

bash test-pcfc11.sh

On Windows use MSYS2 UCRT64 or Git Bash with native Windows Python 3.11+. The PowerShell alternative is:

py tools\test_windows.py --cc "C:\msys64\ucrt64\bin\gcc.exe"

The suite rebuilds the compiler and writes logs and a results ZIP under test-results. Running it inside the managed folder would replace the recorded executable and require setup again. Retain the results ZIP even on failure. OpenBLAS and LAPACKE are optional extra qualification, not basic prerequisites. Bundled PyCForge fixtures are historical inputs; test current application programs too. PyCForge's source distribution retains test-windows-gc.ps1 and WINDOWS-GC-TESTING.md for current generated-memory checks.

Structured diagnostics

PCFC11 reports stable codes for classified C errors, optional argument-count facts and related declarations. PCFC11-E0000 means unclassified; message wording is not an API. Use pcfc11 --diagnostic-catalog-json to read the installed compiler inventory. Columns count one-based UTF-8 bytes. A C error location does not automatically identify the corresponding Python expression.

Compiler errors, malformed diagnostics and incomplete output stop publication even if the compiler returns exit code zero. Source mappings are attached only to unambiguous in-bounds points in the generated input. Logs remain available for assembler and linker failures. Compiler diagnostics remain part of PyCForge. SDK reports describe conversion authoring only; historical SDK native reports remain historical evidence.

Driver, input/output, resource and process failures have distinct classified identities. A missing tool is distinguished from an external assembler or linker that reports failure. Token spelling records preserve physical locations behind #line; transformed and synthetic buffers remain explicitly unsuitable for exact source navigation. Build results identify associated source ranges, generated support code and unmapped locations. These associations do not prove a Python defect or authorize an automatic edit.

Troubleshooting

ProblemAction
Missing or changed compilerOpen Build PCFC11, review Python/GCC paths and build. Use Recheck to inspect retained builds. Choose Use verified PCFC11 when offered, or Other C Compilers; retry a failed build only after addressing its reported cause.
Wrong Python or GCCSelect native 64-bit tools. Windows requires UCRT64 GCC, not an MSYS compiler or an MSVCRT toolchain. Browse to the actual executable, not a launcher command with arguments.
Missing DLL, header or linkerRepair the complete selected toolchain. Do not mix UCRT64 and MSYS files. For manual Windows commands, set the session PATH above.
Another operation is using PCFC11Wait for it to finish or cancel it in the owning window, then choose Recheck. A stale lock file alone does not hold the operating-system lock.
Compile or Continue is disabledWait for checking/building to finish. Once the compiler is ready, transpile the current source successfully; edits and conversion errors invalidate old C. Build PCFC11 remains available from the Transpile menu.
Build timeoutInspect the log and tools. Increase the compiler build timeout if the machine needs more time, then explicitly rebuild.
Source extraction finds an existing folderKeep the working copy and choose another parent. Extraction does not replace it.
No executable entry or unsupported C featureA successful transpile may produce callable functions without an executable entry. The dialog explains the missing entry and keeps Compile disabled for Executable output. Supply a supported no-argument entry, transpile again and select it, or choose Object file for functions called from C. Review diagnostics and the compiler README. PCFC11 is not a claim of complete ISO C11 conformance; use another suitable compiler when needed.