From: "mame (Yusuke Endoh) via ruby-core" Date: 2025-11-18T02:09:31+00:00 Subject: [ruby-core:123838] [Ruby Bug#21692] Basic gems like `date` require a compiler Issue #21692 has been updated by mame (Yusuke Endoh). Ah, it seems this happens on Ubuntu 24.04, without a `Gemfile.lock`, and when the `Gemfile` does not list the indirect dependencies. I found three workarounds. ### 1\. Add a `Gemfile.lock` If a proper `Gemfile.lock` is present, `--prefer-local` seems to avoid the installation. ``` $ ls Gemfile� Gemfile.lock $ cat Gemfile source "https://rubygems.org" gem "net-imap" gem "date", "3.3.3" $ cat Gemfile.lock GEM � remote: https://rubygems.org/ � specs: � � date (3.3.3) � � net-imap (0.3.4.1) � � � date � � � net-protocol � � net-protocol (0.2.1) � � � timeout � � timeout (0.3.1) PLATFORMS � x86_64-linux-gnu DEPENDENCIES � date (= 3.3.3) � net-imap BUNDLED WITH � �2.4.20 $ bundle install --prefer-local Bundle complete! 2 Gemfile dependencies, 5 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. ``` ### 2\. List all dependencies in the Gemfile If the `Gemfile` lists all dependencies, including the indirect ones, `--prefer-local` also seems to avoid the installation. ``` $ ls Gemfile $ cat Gemfile source "https://rubygems.org" gem "timeout" gem "net-protocol" gem "net-imap" gem "date", "3.3.3" $ bundle install --prefer-local Resolving dependencies... Bundle complete! 4 Gemfile dependencies, 5 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. ``` ### 3\. Use `bundler` from a newer Ubuntu release I think this behavior is a bug in the older version of `bundler`. With Ubuntu 25.10, it works well as expected, as shown below: ``` $ ls Gemfile $ cat Gemfile source "https://rubygems.org" gem "net-imap" gem "date", "3.3.4" $ bundle install --prefer-local Fetching gem metadata from https://rubygems.org/... Resolving dependencies... Bundle complete! 2 Gemfile dependencies, 5 gems now installed. Use `bundle info [gemname]` to see where a bundled gem is installed. ``` ---------------------------------------- Bug #21692: Basic gems like `date` require a compiler https://bugs.ruby-lang.org/issues/21692#change-115237 * Author: getajobmike (Mike Perham) * Status: Open * ruby -v: 3.2.3 * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- I'm trying to use Ruby in a high security environment which does not allow a compiler to be installed. This was easy years ago when all of standard library was included with Ruby itself and I could use `apt install ruby`. But as the standard library has broken off into separate, optional gems it has become impossible to `bundle` a reasonable pure Ruby application without requiring basic gems like `date` which require a compiler to install. Are there any plans to make native extensions optional for gems? With tools like ZJIT it can be better to use pure Ruby for performance; I would like to see Ruby encourage fewer native extensions and/or make them optional. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/