Skip to content

ci: clear MAKEFLAGS so the mswin build's nmake works#3007

Closed
soutaro wants to merge 2 commits into
masterfrom
claude/exciting-wozniak-oihiol
Closed

ci: clear MAKEFLAGS so the mswin build's nmake works#3007
soutaro wants to merge 2 commits into
masterfrom
claude/exciting-wozniak-oihiol

Conversation

@soutaro

@soutaro soutaro commented Jun 18, 2026

Copy link
Copy Markdown
Member

Problem

The compile (mswin) job in Ruby on Windows has been failing on master since around Jun 16 (it passed on Jun 10). It dies during bundle install while building native gem extensions (ffi, racc, zlib, strscan, …):

current directory: D:/ruby-mswin/lib/ruby/gems/4.1.0+3/gems/ffi-1.17.4/ext/ffi_c
nmake sitearchdir\=./.gem.20260616-6852-l6mmqk sitelibdir\=./.gem.20260616-6852-l6mmqk clean

Microsoft (R) Program Maintenance Utility Version 14.51.36246.0
NMAKE : fatal error U1065: invalid option '-'
Stop.

Example run: https://github.com/ruby/rbs/actions/runs/27622377214/job/81674542835

Root cause

Only the mswin matrix entry fails; ucrt and 3.4 pass. The difference is the make program: mswin uses MSVC's nmake, the others use GNU make.

The echoed command nmake sitearchdir=... clean contains no -, so the - that nmake rejects comes from an inherited MAKEFLAGS environment variable. GNU make accepts its own GNU-style MAKEFLAGS; nmake parses the leading - and aborts with U1065. This is the same MAKEFLAGS + nmake incompatibility documented in rust-lang/cargo#4156.

ruby/setup-ruby sets MAKE=nmake for mswin but does not export MAKEFLAGS, so the value comes from the base environment and a workflow-level env: reliably overrides it. This is independent of any particular PR — master itself is affected.

Fix

Clear MAKEFLAGS for the compile job so nmake receives no flags. It's a harmless no-op for the mingw/UCRT GNU make builds, and it also protects the rake compile step (which builds the RBS C extension via nmake on mswin).

  compile:
    runs-on: "windows-latest"
    env:
      MAKEFLAGS: ""

🤖 Generated with Claude Code

https://claude.ai/code/session_014RENNXiMZ7ihuquCwKM4Ht


Generated by Claude Code

claude added 2 commits June 18, 2026 14:49
The mswin (MSVC) job builds native gem extensions with `nmake`, which
aborts with "NMAKE : fatal error U1065: invalid option '-'" when it
inherits a GNU-make-style MAKEFLAGS from the environment. This broke
`bundle install` (and would break `rake compile`) for the mswin matrix
entry, while the mingw/UCRT GNU make builds tolerated the flag.

Clear MAKEFLAGS for the compile job so nmake receives no flags. It is a
harmless no-op for the GNU make builds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RENNXiMZ7ihuquCwKM4Ht
Temporarily print the raw MAKEFLAGS/MFLAGS values before clearing them
in-script, to confirm what value the mswin nmake build was choking on.
The in-script clear keeps the build green. This will be reverted to the
clean job-level `env: MAKEFLAGS: ""` fix once the value is captured.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014RENNXiMZ7ihuquCwKM4Ht

soutaro commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

Closing — this turned out to be an upstream RubyGems bug that is already fixed, so the workaround here is unnecessary.

Root cause: RubyGems' new make jobserver feature (b4d1813 "Implement a make jobserver", 2026-06-16) injects MAKEFLAGS (with -j) into the make child process before building native extensions. On the mswin matrix entry make is nmake, which can't parse the GNU-style -j and aborts with NMAKE : fatal error U1065: invalid option '-'. (That's also why the value never showed up in the shell's MAKEFLAGS — RubyGems sets it on the child process, not the parent shell.)

Already fixed upstream: current lib/rubygems/ext/builder.rb special-cases nmake (unless is_nmake), so nmake is no longer given -j/jobserver flags. That fix has now propagated into the prebuilt mswin head Ruby.

Verification: re-running the previously-failed compile (mswin) job on master (commit a8f8f27, no fix at all) now passes — bundle install and compile both green (run 27738194928, attempt 2). So master is green on its own and this workaround is not needed.


Generated by Claude Code

@soutaro soutaro closed this Jun 18, 2026
@hsbt

hsbt commented Jun 18, 2026

Copy link
Copy Markdown
Member

🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants