Skip to content

feat(ruby): set PKG_CONFIG_PATH for native gem extensions#7457

Merged
jdx merged 2 commits intomainfrom
feat/ruby-pkg-config-path
Dec 19, 2025
Merged

feat(ruby): set PKG_CONFIG_PATH for native gem extensions#7457
jdx merged 2 commits intomainfrom
feat/ruby-pkg-config-path

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Dec 19, 2025

Summary

When the rubygems_plugin is loaded, prepend the Ruby installation's lib/pkgconfig directory to PKG_CONFIG_PATH. This allows gems with native extensions (openssl, psych, ffi, etc.) to find the bundled headers and libraries from precompiled Ruby binaries.

Background

Precompiled Ruby binaries from jdx/ruby now include:

  • Headers from portable dependencies (openssl, libyaml, libffi, zlib)
  • Static libraries (libssl.a, libcrypto.a, libyaml.a, etc.)
  • pkg-config files with relocatable paths using ${pcfiledir}

However, for gem install openssl to work, pkg-config needs to find these .pc files. This PR sets PKG_CONFIG_PATH in the rubygems plugin so it's only active during gem operations.

Related PR: jdx/ruby#1

Test plan

  1. Install precompiled Ruby via mise (experimental mode)
  2. Run gem install openssl - should succeed without manual PKG_CONFIG_PATH setup
  3. Run gem install psych - should find libyaml headers

🤖 Generated with Claude Code


Note

Prepends Ruby’s lib/pkgconfig to PKG_CONFIG_PATH in the rubygems plugin so native gem extensions can find bundled headers and libraries.

  • Core RubyGems plugin:
    • Prepend Ruby’s lib/pkgconfig to PKG_CONFIG_PATH in src/plugins/core/assets/rubygems_plugin.rb (when present) so native gem extensions can locate bundled headers/libs.

Written by Cursor Bugbot for commit f0e9b93. This will update automatically on new commits. Configure here.

When the rubygems_plugin is loaded, prepend the Ruby installation's
lib/pkgconfig directory to PKG_CONFIG_PATH. This allows gems with
native extensions (openssl, psych, ffi, etc.) to find the bundled
headers and libraries from precompiled Ruby binaries.

Fixes: #7268

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Copilot AI review requested due to automatic review settings December 19, 2025 17:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds automatic PKG_CONFIG_PATH configuration for the rubygems plugin to support native gem extensions. When the plugin loads, it prepends Ruby's pkg-config directory to PKG_CONFIG_PATH, enabling gems with native extensions (openssl, psych, ffi) to locate bundled headers and libraries from precompiled Ruby binaries without manual environment setup.

Key changes:

  • Adds PKG_CONFIG_PATH configuration at plugin initialization
  • Uses RbConfig to locate Ruby's pkg-config directory
  • Preserves existing PKG_CONFIG_PATH values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugins/core/assets/rubygems_plugin.rb Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 19, 2025

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.12 x -- echo 20.5 ± 0.7 19.1 24.9 1.03 ± 0.04
mise x -- echo 20.0 ± 0.4 19.2 22.2 1.00

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.12 env 19.3 ± 0.7 18.6 25.7 1.00
mise env 19.5 ± 0.3 18.8 21.3 1.01 ± 0.04

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.12 hook-env 19.4 ± 0.3 18.8 20.4 1.00
mise hook-env 19.8 ± 0.5 19.1 23.6 1.02 ± 0.03

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2025.12.12 ls 17.1 ± 0.3 16.4 18.6 1.00
mise ls 17.4 ± 0.9 16.5 26.0 1.01 ± 0.05

xtasks/test/perf

Command mise-2025.12.12 mise Variance
install (cached) 110ms 109ms +0%
ls (cached) 65ms 66ms -1%
bin-paths (cached) 73ms 72ms +1%
task-ls (cached) 2260ms 2268ms +0%

Use File::PATH_SEPARATOR instead of hardcoded colon for PKG_CONFIG_PATH
concatenation. This ensures correct behavior on Windows (which uses ;)
in addition to Unix-like systems (which use :).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@jdx jdx merged commit c9daff3 into main Dec 19, 2025
34 checks passed
@jdx jdx deleted the feat/ruby-pkg-config-path branch December 19, 2025 18:47
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.

2 participants