psych icon indicating copy to clipboard operation
psych copied to clipboard

Interest in supporting precompiled gems?

Open gjtorikian opened this issue 4 months ago • 4 comments

Hiya! I migrated an app from 3.3.1 to 3.4.5 and got blocked on psych, because of a missing yaml.h file.

I was wondering if you would support a PR to change CI to build the gems ahead of time, before pushing?

Basically, you set up your CI matrix for every platform you're interested in, then CI installs all the tools necessary to compile the extension. The compiled extension is packaged into one gem per platform, and then each platform version is pushed to Rubygems. The result is that every user automatically gets the correctly compiled gem for their specific platform--they don't need to build the gem themselves.

Image

If a platform is not supported, a plain ruby version is pushed. This would run the compilation locally on the user's machine, just as it is done now.

I've done this for a bunch of projects and took the idea from Nokogiri. I do not mind at all doing the work necessary to get this working; the challenge is that, since this would run on GitHub Actions, and I don't have admin privileges, someone on the team would need to trigger the builds to test it out. I can do my best building locally with rake-compiler-dock, but inevitably there will be errors on the CI machine while working the flow out. There always are. 😆

gjtorikian avatar Aug 01 '25 14:08 gjtorikian

Bumping for interest. This would make installation of the gem drastically simpler and less prone to error.

gjtorikian avatar Oct 14 '25 20:10 gjtorikian

I'm interested, but the issue isn't organized. I think we should follow the discussion at https://github.com/ruby/json/pull/907.

hsbt avatar Dec 03 '25 00:12 hsbt

I'm not sure I should close this or not based on the referenced issue. Personally I would like to keep the conversation going, but I'm just proposing a contribution, I am not the maintainer here.

From the json gem issue, the two issues I see coming out of that thread are:

  • resulting gem size is too big...but it seems that the 7MB comes from improperly packaging the gem
  • the technique is untested and shouldn't be tried out on json, psych, etc...but nokogiri and grpc each have hundreds of millions of downloads using this fat gem technique and they have no reported problems

I would love to work on a path forward here but I don't know what shape that would look like. Where can a centralized discussion of the pros and cons to the idea—not even necessarily the implementation—be had?

gjtorikian avatar Dec 08 '25 19:12 gjtorikian

I would love to work on a path forward here but I don't know what shape that would look like. Where can a centralized discussion of the pros and cons to the idea—not even necessarily the implementation—be had?

I think @kou may open a ticket on the RubyGems tracker. AFAICT, people seem in agreement that we should be shipping binary gems and really the sticking point is the implementation 😅

tenderlove avatar Dec 17 '25 17:12 tenderlove

Ok, in that case I think this can be closed ✌️

gjtorikian avatar Dec 18 '25 17:12 gjtorikian