Skip to content

Point mkmf at the vcpkg packages on mswin - #977

Open
hsbt wants to merge 3 commits into
masterfrom
claude/mswin-vcpkg-include-aee3df
Open

hsbt wants to merge 3 commits into
masterfrom
claude/mswin-vcpkg-include-aee3df

Conversation

@hsbt

@hsbt hsbt commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Since #971, ruby-version: mswin installs the master build from cache.ruby-lang.org, and native extensions that need vcpkg libraries fail in extconf.rb. openssl cannot find openssl/ssl.h, and fiddle and psych cannot find ffi.h and yaml.h.

ruby-loco configured Ruby with --with-opt-dir set to the runner's vcpkg directory, so mkmf found them through configure_args. The new build keeps build-machine paths out of configure_args and has an empty PKG_CONFIG, so mkmf also falls back to the MSYS2 pkg-config on PATH, which returns MinGW flags.

This prepends the vcpkg include and lib directories to INCLUDE and LIB, and points PKG_CONFIG and PKG_CONFIG_PATH at the pkgconf and .pc files shipped in the vcpkg packages.

Fixes #976

Generated with Claude Code

hsbt and others added 3 commits November 18, 2026 06:02
The mswin builds from cache.ruby-lang.org keep the build machine's paths out of configure_args, so extconf.rb no longer finds the vcpkg headers and libraries that ruby-loco located through --with-opt-dir.

#976

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
json builds without any external library, so it did not catch mkmf losing track of vcpkg.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The mswin builds have an empty PKG_CONFIG in RbConfig, so mkmf ran the MSYS2 pkg-config on PATH, which pointed fiddle at the MinGW libffi headers and broke the MSVC build. ruby-loco meant to set PKG_CONFIG to this pkgconf, but its path missed a variable and pointed nowhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ntkme ntkme left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is good enough for now.

The follow up question for later is that whether we should have a mechanism for mswin ruby to automatically detect $VCPKG_ROOT and enhance its search paths.

Comment thread windows.js
// Without this mkmf runs the MSYS2 pkg-config on PATH, whose MinGW flags break MSVC builds
exportEnv({
PKG_CONFIG: `${vcpkgDir}\\tools\\pkgconf\\pkgconf.exe`,
PKG_CONFIG_PATH: `${vcpkgDir}\\lib\\pkgconfig`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I tested and found that only INCLUDE, LIB, and PKG_CONFIG are required. It seems to work without setting PKG_CONFIG_PATH.

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.

New mswin ruby from ruby-lang.org cannot locate headers in vcpkg

2 participants