Skip to content

Native nix build for old-gcc? #36

@andreadellacorte

Description

@andreadellacorte

Hi! Following on from the macOS support work in #33 / #34 (build scripts) and #35 (HOST_WIDE_INT fix), I've been thinking about whether old-gcc would benefit from a nix-based build path.

Two motivations:

  1. The linux Dockerfile path and the macOS .sh path drift from each other in subtle ways — xm-darwin: force 32-bit HOST_WIDE_INT to match Linux i386 reference #35 is a good example, the bug only existed on the macOS side because the Dockerfile passes -m32 and the shell script can't on Apple Silicon. With one nix derivation used on both, that whole class of issue disappears.
  2. Local-CI parity. Right now a macOS contributor can't easily reproduce a linux-CI failure without spinning up docker, and a linux contributor can't reproduce a macOS-CI failure at all. With nix, anyone running nix build gets the exact same toolchain CI does, on whichever host they happen to be on.

I have a working proof on the macOS side: one flake.nix builds gcc-2.7.2-psx and produces a cc1 functionally identical to the current release tarball (verified by compiling a real ~4500-line TU and md5-comparing the .s output). The linux side is just nixpkgs stdenv on ubuntu, no cross-compilation needed - same flake, different host.

Two questions:

  1. Are you open to migrating builds to nix? Either replacing the Dockerfile + .sh paths entirely, or running nix alongside them with the eventual goal of replacing.
  2. If yes, would you want all 22 gcc versions covered in one go, or just the three with active macOS support today (2.7.2-psx, 2.7.2-cdk, 2.8.1-psx) first, with the others following later?

Happy to draft the PR if there's appetite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions