Skip to content

Stop installing native extension build logs#9700

Open
hsbt wants to merge 3 commits into
masterfrom
claude/dreamy-wu-b7dbe4
Open

Stop installing native extension build logs#9700
hsbt wants to merge 3 commits into
masterfrom
claude/dreamy-wu-b7dbe4

Conversation

@hsbt

@hsbt hsbt commented Jul 17, 2026

Copy link
Copy Markdown
Member

Building a C extension writes mkmf.log and gem_make.out into the installed extension directory under extensions/. Those logs are noisy and non-reproducible, so they pollute the install tree and break bit-for-bit reproducibility checks on distributions like Guix and Nix that verify build output.

A successful build now leaves no logs anywhere in the installation tree, neither in the extension directory nor in the unpacked gem source ext directory. A failed build still keeps the logs for inspection, but writes them to the build_info directory as <full_name>.mkmf.log and <full_name>.gem_make.out, next to the existing <full_name>.info. The build error message points at those new paths, and uninstalling the gem removes both files.

This changes a long-standing behavior. gem_make.out was previously always present in the extension directory after a successful build. Anything that relied on reading that file on success will no longer find it, and on failure it now lives in build_info rather than the extension directory.

A failed build now reports the log location like this.

ERROR: Failed to build gem native extension.

Gem files will remain installed in /path/to/gems/foo-1.0 for inspection.
Results logged to /path/to/build_info/foo-1.0.gem_make.out

Refs:
https://bugs.ruby-lang.org/issues/21995
#6259

hsbt and others added 2 commits June 30, 2026 16:16
mkmf.log and gem_make.out were written into the installed extension
directory, polluting the install tree and breaking bit-for-bit
reproducibility checks on distros like Guix and Nix. A successful build
now leaves no logs behind, and a failed build writes them to build_info
(<full_name>.mkmf.log / <full_name>.gem_make.out) for inspection.

https://bugs.ruby-lang.org/issues/21995
#6259

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Clean up the per-gem mkmf.log and gem_make.out left in build_info by a
failed extension build when the gem is uninstalled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 17, 2026 03:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

These specs read the `make -jN` command line from `gem_make.out`, which a
successful build no longer writes. The integration specs in `install_spec`
now force the build to fail so the command lands in `build_info`, and the
`parallel_installer` specs assert on the number of jobserver slots each
gem's build acquired, which is exactly what becomes `make -jN`, instead of
reading a build log.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants