Skip to content

[Infra][Build] Unified Multi-Target Build Manager #6

@copparihollmann

Description

@copparihollmann

Context

We currently maintain multiple bash scripts (build_debug_asan.sh, riscv_spacemit/build_debug.sh, etc.) to handle diverse build configurations. This fragmentation makes it hard for Agents to reliably "build the project." We need a single Python source of truth (src/tools/builder.py) that abstracts these flags.

Objective

Upgrade the run_build python tool to support a profile argument that maps to our specific CMake presets.

Scope of Work

  1. Profile Registry: Implement the following profiles in builder.py:
    • HOST_DEBUG: Standard RelWithDebInfo.
    • HOST_ASAN: Clang + LD_PRELOAD + ASAN flags (Derived from build_debug_asan.sh).
    • RISCV_FIRESIM: Bare-metal cross-compilation using riscv_firesim.toolchain.cmake and linker specs.
    • RISCV_SPACEMIT: Linux cross-compilation for SpacemiT K1 using riscv.toolchain.cmake.
  2. Environment Management:
    • Auto-detect RISCV_TOOLCHAIN_ROOT or fail gracefully.
    • Handle LD_PRELOAD injection for Python subprocesses when running ASAN builds.

Acceptance Criteria

  • Test 1 (Host): builder.py build --profile host_debug -> Success if iree-compile is generated.
  • Test 2 (ASAN): builder.py build --profile host_asan -> Success if libclang_rt.asan.so is correctly preloaded and binary runs without segfault.
  • Test 3 (RISC-V): builder.py build --profile riscv_firesim -> Success if it invokes the specific gcc linker script (htif.ld) defined in the toolchain file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions